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 @@
## claude/giga-staking-storage-layer #4729 +/- ##
=====================================================================
+ Coverage 61.41% 61.54% +0.12%
=====================================================================
Files 2072 2077 +5
Lines 161229 161692 +463
=====================================================================
+ Hits 99025 99509 +484
+ Misses 62199 62177 -22
- Partials 5 6 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
PR SummaryHigh Risk Overview The implementation ports core x/staking behavior: share math, escrow moves between bonded/not-bonded accounts, max voting power ratio, unbonding/redelegation entry limits, and transitive-redelegation checks, plus Delegate/Redelegate/Undelegate events. Documented divergences from V2/x-staking include no jailing, FIFO queue completion ordering, no slashing of unbonding/redelegation entries, refusing an empty bonded set, and rejecting calls until the first Reviewed by Cursor Bugbot for commit 4358d77. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Adds the giga EVM-only staking precompile, ported from x/staking: delegate, redelegate and undelegate, an EndBlock that updates the bonded set and drains three queues under a budget, plus genesis setup and hooks. Approved because nothing blocks; there are two suggestions on the EndBlock budget and on dropping jailing. Of codex's two findings, the voting-power denominator on redelegation is kept as a pre-existing V2 issue, since it matches sei-cosmos Delegate exactly. The other is dropped: getBeginInfo reading a source validator after Unbond removed it is the same order as BeginRedelegation, and changing it would break the parity #4730 checks.
Non-blocking
2 findings on the changed lines, as inline comments.
Pre-existing
Already true on the base branch, not introduced here.
- suggestion — From codex: sei-cosmos/x/staking/keeper/delegation.go
Delegatechecks the max voting power ratio againstlastTotalPower + bondAmteven when a bonded-to-bonded redelegation leaves total power unchanged. A destination can therefore pass the check and still end above the cap; for example, at 40 of 100 power with a 50% cap, moving 20 more passes as 60/120 but leaves it at 60/100.checkVotingPowerRatio(giga/evmonly/precompiles/staking/delegation.go:131) inherits this faithfully. Fixing it means diverging from V2 in both places together.
seidroid review · decision approve · session 617c275fec5b4badb7798a704d25562a · turn resp_claude_3aa5a2369fcca6c7c6102167a37721bc · item 7dd2118da1785af59e27044d58b35c2c
Findings: 0 blocking | 2 non-blocking | 2 posted inline | 1 pre-existing
| return shares, nil | ||
| } | ||
|
|
||
| // unbond takes shares from delegator's delegation to op and returns the tokens |
There was a problem hiding this comment.
suggestion — With jailing removed, minSelfDelegation is checked only at genesis. An operator can withdraw its entire self-stake and stay in the bonded set, on delegators' stake alone, indefinitely. The description lists this as a deviation, but nothing in this stack restores the guarantee. It needs a tracked follow-up, such as dropping such a validator from the power index, before the precompile is registered on a live chain.
- 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>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
x/staking bonds its genesis validators before the first block, but here the first EndBlock does, so a delegation before it checked the voting power ratio against no bonded power. Run now refuses calls until the bonded set has power. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7c8ab34 to
7982369
Compare
8458326 to
8bafe18
Compare
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.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 67974b9. Configure here.
Run takes calls only once an EndBlock has bonded a set with power, and genesis validators are the only way into the first one. A genesis whose validators were each below one SEI never bonded, so every call failed for good. Genesis now requires each self-delegation to be worth at least one unit of consensus power. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shemnon
left a comment
There was a problem hiding this comment.
Is jailing gone forever or coming back in a future PR? Some comments in the code would be useful so seidroid will chill out. Also, if it's coming backleave something related to sedroids complaints in the right place so when we do bring it back we have notes to fix it.
…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>

Summary
Adds the staking precompile at
0x1005, over the storage layer in the PR below it.Methods:
delegate(address)is payable.redelegate(address,address,uint256)andundelegate(address,uint256)take amounts in wei, which must be a positive whole number of usei. Bad arguments revert before any state is read.Retired V2 methods: V2's string-address forms and authz methods keep their selectors. They revert with a reason naming the replacement.
Ported from x/staking's keeper: share math, Sei's max voting power ratio check, the maxEntries limits, the refusal of transitive redelegations, and the escrow moves between bonded and not-bonded.
EndBlock runs in V2's order:
Each step runs under a snapshot. A failure is reverted and reported as
ErrDegraded, and a failed queue entry is dropped from its queue.Hooksare called at StakingHooks' points, for distribution to implement later. Genesis getsSetParamsandAddGenesisValidator.Deviations from V2
Not in this PR
Test plan
make fmtcheckgo test -race ./giga/evmonly/precompiles/... ./giga/evmonly/Stack
Replaces #4713. Each PR's base is the one above it; review and merge from the top.
🤖 Generated with Claude Code