Repository navigation
Conversation
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4741 +/- ##
==========================================
+ Coverage 61.58% 61.65% +0.07%
==========================================
Files 2078 2082 +4
Lines 161897 162154 +257
==========================================
+ Hits 99711 99983 +272
+ Misses 62181 62166 -15
Partials 5 5
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| func (a *evmOnlyApplication) bondedValidators() ([]abci.ValidatorUpdate, error) { | ||
| view := a.openSettledView() | ||
| defer view.Close() | ||
| bonded, err := staking.BondedValidators(evmonly.ReadOnlyState(view)) |
There was a problem hiding this comment.
Hmm, we don't have unjail right now, so if you are jailed, you won't be in next Committee no matter how much stake you have?
@philipsu522 is that the semantics we want?
PR SummaryHigh Risk Overview Epoch closing signal. Autobahn sets Per-epoch bonded snapshots. On epoch-close blocks, staking EndBlock copies the bonded set (including consensus keys) into new storage Caveat. Reviewed by Cursor Bugbot for commit 24acfa7. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
This makes the evm-only app serve staking's committed bonded set from GetValidators, which autobahn uses to stage each epoch's committee, and falls back to the configured validators until staking bonds a set. It needs changes because a failed background commit can put a committee from a stale height into the persisted epoch registry. I dropped codex's empty-set finding: applyBondedSet returns errNoBondedPower instead of storing an empty set over a populated one.
Blocking
1 finding on the changed lines, as inline comments.
seidroid review · decision request_changes · session 9f43c20da24e4b8eb5cb28b8b94a8845 · turn resp_claude_6b2045c7f435da4baf8f129e501b6caa · item 6c6ba7ca8dae5b349e03d6b90a935e93
Findings: 1 blocking | 0 non-blocking | 1 posted inline
There was a problem hiding this comment.
The PR diff is unchanged since my last review: only the base merge moved, and the open blocker on validators.go:32 still holds. I dropped codex's empty-set claim again, because applyBondedSet returns errNoBondedPower instead of writing an empty set over a populated one, so a committed set never goes from populated to empty.
Blocking
1 finding on the changed lines, as inline comments.
seidroid review · decision request_changes · session 9f43c20da24e4b8eb5cb28b8b94a8845 · turn resp_claude_cb6ccd70350525ba82c4dc12a4898162 · item 0c67f369c8505178b53065eb8accb4ac
Findings: 1 blocking | 0 non-blocking | 1 posted inline
There was a problem hiding this comment.
Since my last review, bondedValidators calls AwaitCommits itself and returns no validators when a commit has failed; that failure is sticky, so a committee from before the failed block can no longer be staged, and the new failed-commit test covers it. I dropped codex's empty-set claim again, because applyBondedSet returns errNoBondedPower instead of storing an empty set over a populated one, and nothing else blocks.
seidroid review · decision approve · session 9f43c20da24e4b8eb5cb28b8b94a8845 · turn resp_claude_f7343b64209c5760fdf7d51f6ac4489e · item 838acbf8916d59c9ba38468a2a01c38c
Findings: 0 blocking | 0 non-blocking | 0 posted inline
Superseded: the latest review found nothing blocking in this change.
Draft storage layouts for the EVM-only staking, distribution and slashing precompiles, and the rationale behind them, taken from ffd15bb, which is not merged on its own. - staking-design-rationale.md: the proposal, built from three principles (Solidity slot layout, V2 structures for migration, rewards undesigned) - StakingStorage, DistributionStorage, SlashingStorage: draft layouts - Sets.sol: dependency-free AddressSet/UintSet with EnumerableSet's layout
… reads - Drop the consensus address: validators are keyed by operator in staking, distribution and slashing. 0x22 is keyed by the ed25519 key, for the duplicate-key check and key lookups; slashing's 0x03 relation is dropped. - Drop the enumeration sets read only by queries (0x37, unbonding and redelegations by delegator) or by entry slashing (0x33, 0x35). - Keep redelegation entries in the redelegation queue, with a per-triple count for maxEntries. - Store the bonded set as one ValidatorPower array instead of a mapping and a set. - Update the rationale doc to match, including which queue entries the FIFO clamp delays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A mapping value grows at its end and needs no reserved slots. A struct inside another, a top-level struct with variables after it, and an array element cannot grow at their end; say what each can do instead, and add an open question on validatorSlashEvents, the one array of structs kept for good. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Validator is a mapping value, so it grows at its end and needs no __gap. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…alues and sets in the growth rule Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only queries walk signing infos, so the slashing layout keeps no enumeration of them, as the rule for enumerations says. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add a Staking struct to ParamsStorage at slot 16: unbondingTime, maxValidators, maxEntries, maxVotingPowerRatio and maxVotingPowerEnforcementThreshold. - ReadStaking, HasStaking and WriteStaking, which writes them once at genesis; later changes go through gov. - Bound them so a change cannot wedge staking: unbonding time within the period bounds, 1..100 bonded validators (an autobahn committee's limit), at least one entry, and a ratio in (0, 1]. - Regenerate the harness and layout testdata, and keep the gov param-change test to gov's own keys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add the staking precompile's storage layer over StakingStorage.sol: the slot layout, typed accessors for validators, delegations, unbonding and redelegation records and the three queues, the power index, and the 1e18 fixed-point share math. - Add solstorage AddressAt/SetAddressAt for packed addresses, and rename ValidatorQueueEntry.completionHeight to unbondingHeight. - Tests check the layout against solc's, read state a compiled harness wrote, and compare the share math with sdk.Dec. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Validator no longer reserves a __gap, so it takes 15 slots and deleteValidator zeroes those. The layout testdata is regenerated; the harness bytecode never writes the gap and is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add the staking precompile at 0x1005 over its storage: delegate (payable), redelegate and undelegate, by address and in whole usei. V2's string forms and authz methods keep their selectors and revert naming the replacement. - Port x/staking's share math, minSelfDelegation jailing, Sei's max voting power ratio, the maxEntries limits, transitive redelegation refusal, and the bonded/not-bonded escrow moves. - EndBlock applies the bonded set from the sorted power index, then completes the validator, unbonding and redelegation queues under a per-queue budget. Each step runs under a snapshot; a failure is reverted and reported as degraded. - Add Hooks at StakingHooks' points, and genesis SetParams and AddGenesisValidator. Not yet registered in evmonlyapp. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An operator whose self-delegation falls below its minimum keeps its validator in the power index, where x/staking jails it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Runs each delegate, undelegate, redelegate and EndBlock on the precompile and on x/staking's keeper side by side, and requires the same outcome, the same hooks and the same state after every step. Covers the delegation rules and the validator lifecycle in scenarios, plus seeded random operations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…taking-storage-layer
…nly-get-validators Main now hands consensus its validators as proxy.ValidatorUpdate, keyed by autobahn's PublicKey, and NewEVMOnlyApplication takes a genesis alloc. GetValidators serves staking's bonded set in those types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
V2's staking precompile serves a validator's delegations to contracts, and a set of them cannot be filled after launch, since a mapping's keys cannot be listed from its slots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…king-params-subspace
…taking-storage-layer
setDelegation and removeDelegation keep delegationsByValidator in step with delegationsByDelegator, so a validator's delegations can be listed without a migration. The harness and layout testdata are rebuilt with solc 0.8.30. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…king-precompile requireInvariants also checks that each validator's delegators are exactly the accounts delegating to it, so every delegate, undelegate and redelegate test covers the new index. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nly-get-validators
…light Autobahn calls GetValidators before every block, so awaiting the previous block's commit there held execution behind it. Executor.ReadLatest reads the store through the in-flight block's overlay instead, and refuses once a commit is known to have failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The executor sets Header.ClosingEpoch on each epoch's last block, from the epoch package's arithmetic over the genesis initial height, and the EVM-only app carries it to the end blockers' BlockContext. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EndBlock copies lastValidators into epochValidators on an epoch's last block and keeps the latest three, and GetValidators serves the latest snapshot, so every node hands consensus the same set for an epoch's committee. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…torage-layer # Conflicts: # docs/giga-storage/StakingStorage.sol
…nly-get-validators
Taking the last shares out of an unbonded validator removes it before the redelegation's completion is decided, so the move waits a full unbonding period, as x/staking's BeginRedelegation does. The Redelegate event and redelegate's doc now say so, and a test pins it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es with V2 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nly-get-validators
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4715836. Configure here.
A snapshotted validator can leave the bonded set, finish unbonding with no shares and be removed before its snapshot is retired, so reading its key from the live record left GetValidators with no committee. The snapshot now copies each member's key when it is taken, while every member is bonded, and is read on its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…et-validators # Conflicts: # giga/evmonly/precompiles/staking/endblock.go # giga/evmonly/precompiles/staking/helpers_test.go # giga/evmonly/precompiles/staking/layout.go # giga/evmonly/precompiles/staking/layout_test.go # giga/evmonly/precompiles/staking/storage.go # giga/evmonly/precompiles/staking/testdata/StakingStorageHarness.bin-runtime # giga/evmonly/precompiles/staking/testdata/StakingStorageHarness.sol # giga/evmonly/precompiles/staking/testdata/staking_storage_layout.json
Autobahn keeps the committee it derives in its own epoch state, so what it needs from the app is the bonded set as it stands. GetValidators reads staking's lastValidators through BondedValidators again, and the epoch snapshot stays for rewards, built from the same read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Summary
Autobahn derives epoch E+2's committee from
app.GetValidators(), read once epoch E's last road has executed, and keeps that committee in its own epoch state. The evm-only app returned a fixed list built from the autobahn config file. This serves staking's current bonded set instead.GetValidatorsserves staking's bonded set as the last EndBlock stored it, and the configured validators until staking has bonded one. A stored set that does not add up is logged and returns no validators: autobahn then fails to stage the next committee, so the node stops at the epoch boundary rather than serving a committee the state doesn't back.staking.BondedValidatorsreturnslastValidatorswith each member's operator, ed25519 consensus key and power. A set longer than any MaxValidators allows, or a member with no validator record, is an error.Executor.ReadLatestreads state holding every finalized block through the in-flight block's overlay, soGetValidators, which autobahn also calls before every block, never waits on a commit. It refuses once a commit is known to have failed.evmonly.ReadOnlyStatewraps a committed store view as a custom precompileState. A write is dropped and fails the state, as under a static call, and nothing is charged.Header.ClosingEpoch: the autobahn executor marks each epoch's last block, from the epoch package's arithmetic over the genesis initial height (epoch.ClosingEpoch), and the evm-only app carries it to the end blockers'BlockContext. The app never repeats the epoch length.epochValidators[epoch]and keeps the latest three, since the committee serving epoch E is the set at the end of epoch E−2.staking.EpochValidatorsreads the latest. Nothing outside tests reads it until rewards land. A member removed since keeps its key, and a bonded member with no validator record fails the snapshot, leaving the previous one in place. The rationale doc has a section on it.runPushAppHashesreadsGetValidators()at the app tip, which can be past the epoch's last block, so the set it stages is that block's only while no later block has changed it. The comment at the call site says so, with the TODO to ask the app for the set as of that block.Staking isn't registered in the node yet (
evmOnlyCustomPrecompilesbuilds only gov's registry), so a running node still serves the configured validators. Registering it, and writing its params and genesis validators from the autobahn config, is the next step. The consensus keys staking stores have to be the autobahn validator keys for the committee to carry over.Test plan
go test -race ./giga/evmonly/precompiles/staking/BondedValidatorsmoves at any EndBlock, not at a delegation, is empty before staking bonds a set, and fails on a member with no validator or a set longer than MaxValidators allows.go test -race ./giga/evmonly/:ReadLatestserves a block whose commit is held open, and refuses after a failed commit whether or not anything waited on it.go test ./sei-tendermint/internal/autobahn/epoch/:ClosingEpochmarks each epoch's last road.go test -race ./giga/evmonly/... ./sei-tendermint/internal/evmonlyapp/... ./sei-tendermint/internal/proxy/... ./sei-tendermint/internal/autobahn/... ./sei-tendermint/internal/p2p/...ClosingEpochon the block that closes an epoch and on no other.make fmtcheckStack
#4726 to #4730 have merged; this PR is based on main.
🤖 Generated with Claude Code