add offline EVM load scenarios - #57
Conversation
PR SummaryLow Risk Overview
Tests cover signing, genesis writes, config rejection, and an in-geth EVM ERC20 transfer that checks sender/recipient storage. Reviewed by Cursor Bugbot for commit e5d7c2f. Bugbot is set up for automated code reviews on this repo. Configure here. |
| case cfg.ChainID == nil || cfg.ChainID.Sign() <= 0: | ||
| return fmt.Errorf("chain ID must be positive") | ||
| case cfg.GasPrice == nil || cfg.GasPrice.Sign() < 0: | ||
| return fmt.Errorf("gas price must be non-negative") |
There was a problem hiding this comment.
(oops sorry for leaving these as comment instead of PR review comment)
| case cfg.SenderBalance == nil || cfg.SenderBalance.Sign() < 0: | ||
| return fmt.Errorf("sender balance must be non-negative") | ||
| case cfg.TransferValue == nil || cfg.TransferValue.Sign() < 0: | ||
| return fmt.Errorf("transfer value must be non-negative") |
There was a problem hiding this comment.
Ditto re checking for maximum.
| } | ||
|
|
||
| func (s *erc20TransferScenario) SeedSender(state GenesisWriter, sender common.Address) { | ||
| state.SetBalance(sender, s.cfg.SenderBalance) |
There was a problem hiding this comment.
not a blocker but passing around a mutable clone the big int could cause subtle bugs that are hard to debug.
I see this pattern across the repo, which is worth addressing in a separate body of work.
Summary
generator/offlinescenario API for executors that consume raw Ethereum transactions and explicit genesis statesei-loadcreation bytecode and seed the real_balancesmapping slotWhy
The existing
TxGeneratorscenarios are designed around RPC deployment and submission. Direct executor load tests also need contract code, account balances, and storage available before execution begins. This package exposes that offline setup without couplingsei-loadto a particular executor implementation.The first consumer is sei-protocol/sei-chain#3658, replacing its duplicated native/ERC20 transaction construction and hand-written ERC20 runtime.
Verification
go test ./...go test -race -count=1 ./generator/offlinegolangci-lint v2.12.2 runtransferin geth's EVM and verifies sender debit and recipient credit