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-params-subspace #4728 +/- ##
=======================================================================
- Coverage 61.43% 61.41% -0.02%
=======================================================================
Files 2067 2072 +5
Lines 160999 161229 +230
=======================================================================
+ Hits 98903 99025 +122
- Misses 62091 62199 +108
Partials 5 5
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
PR SummaryMedium Risk Overview
Supporting pieces: shared Tests lock layout to Reviewed by Cursor Bugbot for commit c77cd41. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
This PR adds the Go storage layer for the staking precompile over StakingStorage.sol: layout constants, typed accessors, the sorted power index, 1e18 share math and the packed-address helpers, with tests against solc's layout and a compiled harness. Nothing blocks: the slot, member and packing logic checks out against the schema in the merge tree (953f35a), and the share math matches sdk.Dec. The one real issue, from codex and kept, is that the harness fixture's provenance does not match its source; Go was not available in the sandbox, so the tests were not run.
Non-blocking
1 finding on the changed lines, as inline comments.
Pre-existing
Already true on the base branch, not introduced here.
- suggestion — giga/evmonly/precompiles/params/testdata/ParamsStorageHarness.bin-runtime on the base branch has the same mismatch: its metadata says solc 0.8.28, but ParamsStorageHarness.sol requires exactly 0.8.30. Rebuild both harness fixtures together.
1 nit, not posted on the code
giga/evmonly/precompiles/staking/storage.go:433—popdoesn't check thathead < tail. Called on an empty queue, it moves head past tail and leaves state thatcheckreports as corrupt. Unlikepush, it has no error return, so the precondition (callduefirst) is only implicit.
seidroid review · decision approve · session 374a60f3f8b54d2eacc3935119a1a24c · turn resp_claude_b48c45f8429a81ac0f6243947e76e1ec · item 8558353a42995c7b841dffecb53ae627
Findings: 0 blocking | 1 non-blocking | 1 posted inline | 1 pre-existing
- 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>
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>
5a5dda3 to
edf0390
Compare
8458326 to
8bafe18
Compare
…taking-storage-layer
The harness and StakingStorage declare pragma solidity 0.8.30, and the committed binary came from 0.8.28. Rebuild it with 0.8.30 and name the command that reproduces it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shemnon
left a comment
There was a problem hiding this comment.
Two items:
- Stick with solidity 0.8.28 as the fixed version, don't use .30 or anything newwer
- Move the decimal lib to someplace more generic. Govenance uses deilams and we should make sure we are usign the same decimal subroutines. If gov and staking need to be harminized that can be in a different PR, but the correct home for the decimal functions should be part of this PR.
Staking's share math and gov's tally both divide and round 1e18-scaled decimals as sdk.Dec does. Put staking's helpers in precompiles/dec so the precompiles share one implementation; staking keeps its token units and consensus power in units.go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…taking-storage-layer
…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>
Summary
Adds the staking precompile's storage layer over
StakingStorage.sol. It has no methods and no EndBlock yet; those come in the next PR.layout.go: the top-level slots and struct members ofStakingStorage.sol, and the bonded and not-bonded escrow addresses.storage.go: typed reads and writes of validators, the validator set and key lookup, the last bonded set, delegations, unbonding entries, redelegation counts, and the three FIFO queues. Every delegation write keeps both sets, each delegator's validators and each validator's delegators.validator.go: the power index (validatorsByPower), a sorted array kept in x/staking's iteration order, with insert, remove and move.precompiles/dec: 1e18-scaled decimal math that rounds assdk.Decdoes, in a package of its own so every precompile can use it. Staking's token units and consensus power stay inunits.go.solstorage:AddressAt/SetAddressAtfor addresses packed with other members.StakingStorage.sol:ValidatorQueueEntry.completionHeightis renamedunbondingHeight, which is what it holds.Validatortakes 15 slots, without the__gapthe PR below drops, anddeleteValidatorzeroes those.Test plan
go test -race ./giga/evmonly/precompiles/...layout.gois pinned against solc's storage layout ofStakingStorage.sol.sdk.Decandstakingtypes.Validatoron random inputs.Stack
Replaces #4713. Each PR's base is the one above it; review and merge from the top.
🤖 Generated with Claude Code