You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
existing api always tries to lookup if object exists in the database, this is both inefficient and not robust.
as an example ballot validation
in fact all this objects are available in memory in the tortoise, so there is absolutely no reason to waste resources on doing this database lookups.
another concern is that this is not robust, if tortoise doesn't have dependency when dependant object is processed - it will fail validation and it will retry hopefully in some future.
to address both of those concern component that maintain state should be able to provide information about missing objects (for example as an error), and fetcher should do request based on missing object, regardless of that is stored in the database. after fetching complete validation should be re-done. in other words it should be up to handler to check that data is available, some handlers may do it using database, but in some places we already have all necessary data in memory.
related: #4927
this change eliminates database lookups on ballot validation path, with an exception of when lru cache is not sufficient to hold
vrf nonces and activations. in that case we will have to load them from db, that can be optimized later by fitting more in lru cache #4935 or reusing tortoise dataset as well
- fetcher will be asked for ballots only if we don't have them in memory
- reference ballots for eligibility validation will be fetched from tortoise
existing api always tries to lookup if object exists in the database, this is both inefficient and not robust.
as an example ballot validation
in fact all this objects are available in memory in the tortoise, so there is absolutely no reason to waste resources on doing this database lookups.
another concern is that this is not robust, if tortoise doesn't have dependency when dependant object is processed - it will fail validation and it will retry hopefully in some future.
to address both of those concern component that maintain state should be able to provide information about missing objects (for example as an error), and fetcher should do request based on missing object, regardless of that is stored in the database. after fetching complete validation should be re-done. in other words it should be up to handler to check that data is available, some handlers may do it using database, but in some places we already have all necessary data in memory.
@countvonzero
The text was updated successfully, but these errors were encountered: