Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - use tortoise data for ballot eligibility validation #4935

Closed

Conversation

dshulyak
Copy link
Contributor

@dshulyak dshulyak commented Aug 31, 2023

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

@dshulyak
Copy link
Contributor Author

image

@dshulyak dshulyak changed the title use tortoise data for use tortoise data for ballot eligibility validation Aug 31, 2023
@codecov
Copy link

codecov bot commented Aug 31, 2023

Codecov Report

Merging #4935 (1d07c9c) into develop (76addb4) will increase coverage by 0.0%.
Report is 1 commits behind head on develop.
The diff coverage is 92.6%.

@@           Coverage Diff           @@
##           develop   #4935   +/-   ##
=======================================
  Coverage     77.1%   77.1%           
=======================================
  Files          263     263           
  Lines        30560   30570   +10     
=======================================
+ Hits         23573   23587   +14     
+ Misses        5496    5495    -1     
+ Partials      1491    1488    -3     
Files Changed Coverage Δ
tortoise/state.go 96.3% <ø> (ø)
tortoise/algorithm.go 78.3% <80.0%> (+<0.1%) ⬆️
proposals/eligibility_validator.go 100.0% <100.0%> (ø)
proposals/handler.go 87.9% <100.0%> (+0.8%) ⬆️
tortoise/tortoise.go 88.9% <100.0%> (+<0.1%) ⬆️

... and 4 files with indirect coverage changes

@dshulyak dshulyak marked this pull request as ready for review August 31, 2023 10:34
proposals/interface.go Outdated Show resolved Hide resolved
return nil, fmt.Errorf("%w: ref ballot %v", errMissingEpochData, refballot.ID())
refdata := v.tortoise.GetBallot(ballot.RefBallot)
if refdata == nil {
return nil, fmt.Errorf("ref ballot is missing %v", ballot.RefBallot)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in general my concern is when data is outside tortoise's window. why not query this from db in case of failure?

Copy link
Contributor Author

@dshulyak dshulyak Sep 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if data is outside window, we can't decode ballot votes anymore. there have to be some heuristic to reload the window at that time, like a lot of atx weight wasn't counted

this should be a prerequisite for healing for longer than window length

@dshulyak
Copy link
Contributor Author

dshulyak commented Sep 1, 2023

bors merge

bors bot pushed a commit that referenced this pull request Sep 1, 2023
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
@bors
Copy link

bors bot commented Sep 1, 2023

Pull request successfully merged into develop.

Build succeeded!

The publicly hosted instance of bors-ng is deprecated and will go away soon.

If you want to self-host your own instance, instructions are here.
For more help, visit the forum.

If you want to switch to GitHub's built-in merge queue, visit their help page.

@bors bors bot changed the title use tortoise data for ballot eligibility validation [Merged by Bors] - use tortoise data for ballot eligibility validation Sep 1, 2023
@bors bors bot closed this Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants