-
Notifications
You must be signed in to change notification settings - Fork 471
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
ledger: Exclude stake at R-320 that is expired by R #5403
Conversation
This adds a DB method to calculate the total expired stake registered at rnd that is expired by voteRnd. It adds a consensus check to the ledger implementation of the Circulation(rnd) call that agreement makes, which in turn calls onlineAccounts.onlineTotals. If ExcludeExpiredCirculation is set, it subtracts expired stake at rnd+320 from the total online stake at rnd. Details: * when the next round is going to be round R, a proposal/vote will come in for round R (or some other trigger we could add) * query the DB's onlineaccounts table looking for accounts online at R that are expired in any round before R+320 (this using the "updated as of rnd" and "expired by rnd" indexes) * sum up the expired online stake for these accounts * subtract expired stake from total online stake and put in cache to use for all votes seen for R Co-authored-by: Pavel Zbitskiy <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #5403 +/- ##
==========================================
- Coverage 55.42% 54.43% -1.00%
==========================================
Files 452 452
Lines 63689 63812 +123
==========================================
- Hits 35302 34733 -569
- Misses 25972 26603 +631
- Partials 2415 2476 +61
... and 65 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
type simpleLedgerOption func(*simpleLedgerCfg) | ||
|
||
func simpleLedgerOnDisk() simpleLedgerOption { | ||
return func(cfg *simpleLedgerCfg) { cfg.onDisk = true } | ||
} | ||
|
||
func simpleLedgerNotArchival() simpleLedgerOption { | ||
return func(cfg *simpleLedgerCfg) { cfg.notArchival = true } | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neat 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch removes expired voting stake totals from the total online stake for the agreement implementation. It adds a table scan and a sort of the onlineaccounts table to the calculation, and includes a lock-held synchronization check to guard against asynchronous DB advancement.
wip netdeploy: Copy ledger directory for kv tracker database (algorand#5392) assembler: Error if extra args are present in pragmas (algorand#5400) ledger: Exclude stake at R-320 that is expired by R (algorand#5403) Co-authored-by: cce <[email protected]> algod: Don't return a top level array from algod (algorand#5404) revert go get github.com/algorand/[email protected] go get github.com/getkin/[email protected] go mod tidy -compat=1.17 go get github.com/algorand/[email protected] go mod tidy -compat=1.17 go get github.com/algorand/[email protected] revert to master github.com/getkin/kin-openapi v0.117.0 github.com/getkin/kin-openapi v0.117.0 github.com/getkin/kin-openapi v0.117.0 go get golang.org/x/mod/modfile tidy #0 go get github.com/algorand/[email protected] go mod tidy tidy up after every go get simplify revert tidier tg tg
Summary
This adds a DB method to calculate the total expired stake registered at rnd that is expired by voteRnd.
It adds a consensus check to the ledger implementation of the Circulation(rnd) call that agreement makes, which in turn calls onlineAccounts.onlineTotals. If ExcludeExpiredCirculation is set, it subtracts expired stake at rnd+320 from the total online stake at rnd.
Details:
Test Plan
New unit tests added