Documentation
¶
Index ¶
- Constants
- func DeployContract(t devtest.T, user *dsl.EOA, bin []byte) (common.Address, *types.Receipt)
- func FetchAndVerifyProofs(t devtest.T, sys *MixedOpProofPreset, address common.Address, ...)
- func LoadArtifact(t devtest.T, artifactPath string) (abi.ABI, []byte)
- func NormalizeProofResponse(res *eth.AccountResult)
- func VerifyProof(res *eth.AccountResult, stateRoot common.Hash) error
- type Artifact
- type Contract
- type MixedOpProofPreset
- type MultiStorage
- type SimpleStorage
- type TokenVault
- func (c *TokenVault) Approve(user *dsl.EOA, spender common.Address, amount *big.Int) *types.Receipt
- func (c *TokenVault) DeactivateAllowance(user *dsl.EOA, spender common.Address) *types.Receipt
- func (c *TokenVault) Deposit(user *dsl.EOA, amount eth.ETH) *types.Receipt
- func (c *TokenVault) GetAllowanceSlot(owner, spender common.Address) common.Hash
- func (c *TokenVault) GetBalanceSlot(user common.Address) common.Hash
- func (c *TokenVault) GetDepositorSlot(index uint64) common.Hash
Constants ¶
const AllowanceSlotIndex = 1
const BalanceSlotIndex = 0
const DepositorSlotIndex = 2
const MultiStorageArtifact = "../contracts/artifacts/MultiStorage.sol/MultiStorage.json"
const SimpleStorageArtifact = "../contracts/artifacts/SimpleStorage.sol/SimpleStorage.json"
const TokenVaultArtifact = "../contracts/artifacts/TokenVault.sol/TokenVault.json"
Variables ¶
This section is empty.
Functions ¶
func DeployContract ¶
DeployContract deploys the contract creation bytecode from the given artifact. user must provide a Plan() method compatible with txplan.NewPlannedTx (kept generic).
func FetchAndVerifyProofs ¶
func FetchAndVerifyProofs(t devtest.T, sys *MixedOpProofPreset, address common.Address, slots []common.Hash, block uint64)
FetchAndVerifyProofs fetches account proofs from both L2EL and L2ELB for the given address
func LoadArtifact ¶
LoadArtifact reads the forge artifact JSON at artifactPath and returns the parsed ABI and the creation bytecode (as bytes). It prefers bytecode.object (creation) and falls back to deployedBytecode.object if needed.
func NormalizeProofResponse ¶
func NormalizeProofResponse(res *eth.AccountResult)
NormalizeProofResponse standardizes an AccountResult obtained from eth_getProof across different client implementations (e.g., Geth, Reth) so that they can be compared meaningfully in tests.
Ethereum clients may encode empty or zeroed data structures differently while still representing the same logical state. For example:
- An empty storage proof may appear as [] (Geth) or ["0x80"] (Reth).
This function normalizes such differences by:
- Converting single-element proofs containing "0x80" to an empty proof slice.
func VerifyProof ¶
func VerifyProof(res *eth.AccountResult, stateRoot common.Hash) error
VerifyProof verifies an account and its storage proofs against a given state root.
This function extends the standard behavior of go-ethereum’s AccountResult.Verify() by gracefully handling the case where the account’s storage trie root is empty (0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421).
Types ¶
type Artifact ¶
type Artifact struct {
ABI json.RawMessage `json:"abi"`
Bytecode struct {
Object string `json:"object"`
} `json:"bytecode"`
}
minimal parts of artifact
type MixedOpProofPreset ¶
type MixedOpProofPreset struct {
Log log.Logger
T devtest.T
L1Network *dsl.L1Network
L1EL *dsl.L1ELNode
L2Chain *dsl.L2Network
L2Batcher *dsl.L2Batcher
L2ELSequencer *dsl.L2ELNode
L2CLSequencer *dsl.L2CLNode
L2ELValidator *dsl.L2ELNode
L2CLValidator *dsl.L2CLNode
Wallet *dsl.HDWallet
FaucetL1 *dsl.Faucet
FaucetL2 *dsl.Faucet
FunderL1 *dsl.Funder
FunderL2 *dsl.Funder
TestSequencer *dsl.TestSequencer
}
MixedOpProofPreset sets up a two-node L2 devnet (sequencer + validator) with configurable EL clients via environment variables:
- OP_DEVSTACK_PROOF_SEQUENCER_EL: "op-geth" (default), "op-reth", or "op-reth-with-proof"
- OP_DEVSTACK_PROOF_VALIDATOR_EL: "op-reth-with-proof" (default), "op-reth", or "op-geth"
func NewMixedOpProofPreset ¶
func NewMixedOpProofPreset(t devtest.T) *MixedOpProofPreset
NewMixedOpProofPreset creates the preset using MixedSingleChainRuntime for full control over EL client types.
func (*MixedOpProofPreset) L2ELSequencerNode ¶
func (m *MixedOpProofPreset) L2ELSequencerNode() *dsl.L2ELNode
func (*MixedOpProofPreset) L2ELValidatorNode ¶
func (m *MixedOpProofPreset) L2ELValidatorNode() *dsl.L2ELNode
func (*MixedOpProofPreset) RethWithProofL2ELNode ¶
func (m *MixedOpProofPreset) RethWithProofL2ELNode() *dsl.L2ELNode
RethWithProofL2ELNode returns the first node running op-reth with proof history. Falls back to the validator, then sequencer.
type MultiStorage ¶
type MultiStorage struct {
*Contract
// contains filtered or unexported fields
}
func DeployMultiStorage ¶
type SimpleStorage ¶
type SimpleStorage struct {
*Contract
// contains filtered or unexported fields
}
func DeploySimpleStorage ¶
func (*SimpleStorage) PlanSetValue ¶
type TokenVault ¶
type TokenVault struct {
*Contract
// contains filtered or unexported fields
}
func DeployTokenVault ¶
func (*TokenVault) DeactivateAllowance ¶
func (*TokenVault) GetAllowanceSlot ¶
func (c *TokenVault) GetAllowanceSlot(owner, spender common.Address) common.Hash
func (*TokenVault) GetBalanceSlot ¶
func (c *TokenVault) GetBalanceSlot(user common.Address) common.Hash
func (*TokenVault) GetDepositorSlot ¶
func (c *TokenVault) GetDepositorSlot(index uint64) common.Hash