Conversation
WalkthroughWalkthroughThe recent changes involve a significant refactoring of how forge dumps are handled across various files in the Changes
Recent Review DetailsConfiguration used: .coderabbit.yml Files selected for processing (6)
Files skipped from review as they are similar to previous changes (5)
Additional Context UsedRuff (6)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
Out of diff range and nitpick comments (1)
op-chain-ops/genesis/config.go (1)
Line range hint
772-799: RefactorUnmarshalJSONmethod inForgeAllocsstruct.The method has been adapted to handle the new JSON structure directly. However, consider using a more efficient way to handle large numbers of allocations, such as parallel processing or optimizing the JSON parsing strategy.
func (d *ForgeAllocs) UnmarshalJSON(b []byte) error { type forgeAllocAccount struct { Balance hexutil.U256 `json:"balance"` Nonce hexutil.Uint64 `json:"nonce"` Code hexutil.Bytes `json:"code,omitempty"` Storage map[common.Hash]common.Hash `json:"storage,omitempty"` } var allocs map[common.Address]forgeAllocAccount if err := json.Unmarshal(b, &allocs); err != nil { return err } d.Accounts = make(types.GenesisAlloc, len(allocs)) for addr, acc := range allocs { acc := acc d.Accounts[addr] = types.Account{ Code: acc.Code, Storage: acc.Storage, Balance: (*uint256.Int)(&acc.Balance).ToBig(), Nonce: (uint64)(acc.Nonce), PrivateKey: nil, } } return nil }
Description
This turns
{ "accounts": { ... }}into just{...}, i.e. unwrapping the allocs files, so that the Go genesis tooling matches the default foundry state-dump format. This applies to both L1 and L2.PSA: when this is merged, anyone running op-e2e or devnet will need to re-run
make devnet-allocs, for unwrapped l1 and l2 allocs files.