colibri_simulateTransaction
Simulates a Transaction before signing it. The input arguments are the same as eth_call, but the result represents the events created when executing the transaction.
0
chains/eth/verifier/verify_simulate.c
Build a Tenderly-style generated access list (address + storageKeys)
and attach the verified on-chain codeHash of each accessed account.
Each accessed slot is also recorded under storage with its proven
pre-state value (src_value) and, when the key was hashed during the call
and the preimage is at most 1024 bytes, the keccak preimage as slotSource.
storage is omitted from the JSON unless include_storage is set.
static void build_access_list(ssz_builder_t* builder, call_account_t* accounts, keccak_entry_t* keccak_entries, bool include_storage) {
size_t count = 0;
Parameters
builder: SSZ builder for the simulation resultaccounts: accounts touched while simulating (may beNULL)keccak_entries: keccak preimages captured during the call (may beNULL)include_storage: whether to publish pre-state storage values
0
chains/eth/verifier/verify_simulate.c
Appends unique executed JUMPDEST program counters, one entry per code address.
Program counters are written in ascending order. The field is always encoded; the caller hides it with the result mask when positions were not requested.
static void build_positions(ssz_builder_t* builder, jumpdest_set_t* positions) {
size_t count = 0;
Parameters
builder: SSZ builder for the simulation resultpositions: captured JUMPDEST sets, orNULL
EthSimulationResult
Main simulation result structure (based on Tenderly format).
The Type is defined in src/chains/eth/ssz/verify_data_types.h.
class EthSimulationResult(Container):
_optmask : Uint32 # optional fields mask
blockNumber : Uint64 # block number where simulation was executed
cumulativeGasUsed : Uint64 # cumulative gas used (for simulation: same as gasUsed)
gasUsed : Uint64 # gas used by the transaction
logs : ProgList [EthSimulationLog] # emitted logs
logsBloom : ByteVector [256] # logs bloom filter (future extension)
status : Uint8 # transaction status (0x1 = success, 0x0 = revert) - Tenderly format
trace : ProgList [EthSimulationTrace] # execution trace (future extension)
type : Uint8 # transaction type
returnValue : ProgBytes # return value of the call
stateChanges : ProgList [EthSimulationAccountChange] # per-account state diffs (Tenderly format)
accessList : ProgList [EthSimulationAccessEntry] # generated access list + codeHash + optional storage values (appended; i=11)
positions : ProgList [EthSimulationCodePositions] # unique executed JUMPDEST program counters (appended; i=12)
Referenced Types
- EthSimulationLog
- EthSimulationTrace
- EthSimulationAccountChange
- EthSimulationAccessEntry
- EthSimulationCodePositions
EthSimulationCodePositions
Container type for a generated access-list entry address, storageKeys, codeHash storage field (i=4) Unique JUMPDEST program counters executed by one code address.
The Type is defined in src/chains/eth/ssz/verify_data_types.h.
class EthSimulationCodePositions(Container):
address : Address # code address (delegatecall: the implementation)
pcs : ProgList [uint32Def] # executed JUMPDEST program counters, sorted, unique
EthSimulationAccessEntry
slot + value
slotSource field (i=3)
Generated access-list entry (Tenderly generated_access_list / EIP-2930),
extended with the on-chain codeHash so downstream enrichment can verify
Sourcify metadata against the bytecode that was actually executed.
storage repeats each storageKeys entry with its proven pre-state value
and is visible only when the caller set state_values.
This type is simulation-only -- do not reuse ETH_ACCESS_LIST_DATA (tx encoding).
The Type is defined in src/chains/eth/ssz/verify_data_types.h.
class EthSimulationAccessEntry(Container):
_optmask : Uint8 # bit 4 controls storage visibility
address : Address # accessed account
storageKeys : ProgList [bytes32] # storage keys read or written (EIP-2930)
codeHash : Bytes32 # keccak256 of deployed runtime bytecode (`EMPTY_HASH` for EOAs)
storage : ProgList [EthSimulationStorageRead] # accessed slots with pre-state value
Referenced Types
EthSimulationStorageRead
Container type for a per-account state change
address field (i=1, always visible)
storage field (i=2)
nonce field (i=3)
balance field (i=4)
One accessed storage slot. value is the proven pre-state (src_value).
slotSource is the keccak preimage of slot when the call hashed that key.
The Type is defined in src/chains/eth/ssz/verify_data_types.h.
class EthSimulationStorageRead(Container):
_optmask : Uint8 # bit 3 controls slotSource visibility
slot : ByteVector [32] # storage key (same order as storageKeys)
value : ByteVector [32] # proven pre-state value
slotSource : Bytes[1024] # keccak preimage of the slot key (when available)
EthSimulationAccountChange
Container type for a balance/nonce value change Per-account state diff in a simulation result.
The Type is defined in src/chains/eth/ssz/verify_data_types.h.
class EthSimulationAccountChange(Container):
_optmask : Uint8 # controls visibility of storage, nonce, balance
address : Address # account address
storage : ProgList [EthSimulationStorageChange] # changed storage slots
nonce : EthSimulationValueChange # nonce change (if modified)
balance : EthSimulationValueChange # balance change (if modified)
Referenced Types
EthSimulationValueChange
Container type for a single storage change slot + previousValue + newValue slotSource field (i=4) Balance or nonce value change pair.
The Type is defined in src/chains/eth/ssz/verify_data_types.h.
class EthSimulationValueChange(Container):
previousValue : Bytes[32] # value before the transaction
newValue : Bytes[32] # value after the transaction
EthSimulationStorageChange
Container type for execution trace entries in simulation results Storage slot change in a simulation state diff.
The Type is defined in src/chains/eth/ssz/verify_data_types.h.
class EthSimulationStorageChange(Container):
_optmask : Uint8 # bit 4 controls slotSource visibility
slot : ByteVector [32] # storage key
previousValue : ByteVector [32] # value before the transaction
newValue : ByteVector [32] # value after the transaction
slotSource : Bytes[1024] # keccak preimage of the slot key (when available)
EthSimulationTrace
Container type for enhanced simulation log entries with ABI decoding Trace entry for simulation result (Tenderly format).
The Type is defined in src/chains/eth/ssz/verify_data_types.h.
class EthSimulationTrace(Container):
_optmask : Uint32 # optional fields mask
decodedInput : ProgList [EthSimulationInputParam] # decoded input parameters (ABI decoding)
decodedOutput : ProgList [EthSimulationInputParam] # decoded output parameters (ABI decoding)
from : Address # caller address
gas : Uint64 # gas limit (will be rendered as hex)
gasUsed : Uint64 # gas used (will be rendered as hex)
input : Bytes[1073741824] # call input data
method : String[256] # method name (ABI decoding, e.g. "approve")
output : Bytes[1073741824] # call output data
subtraces : Uint32 # number of subtraces
to : Address # target address
traceAddress : ProgList [uint32Def] # trace address path (e.g. [0])
type : String[32] # trace type ("CALL", "CREATE", etc.)
value : Uint256 # ETH value (will be rendered as hex)
Referenced Types
EthSimulationLog
Container type for raw log data (without ABI decoding) Enhanced log entry for simulation result (Tenderly format).
The Type is defined in src/chains/eth/ssz/verify_data_types.h.
class EthSimulationLog(Container):
_optmask : Uint16 # optional fields mask for future extensions
anonymous : Boolean # whether the event is anonymous (ABI decoding)
inputs : ProgList [EthSimulationInputParam] # decoded event inputs (ABI decoding)
name : String[256] # event name (ABI decoding)
raw : EthSimulationLogRaw # raw log data
Referenced Types
EthSimulationLogRaw
Container type for decoded ABI input/output parameters Raw log data (same structure as ETH_RECEIPT_DATA_LOG)
The Type is defined in src/chains/eth/ssz/verify_data_types.h.
class EthSimulationLogRaw(Container):
address : Address # contract address that emitted the log
data : Bytes[1073741824] # event data
topics : ProgList [bytes32] # event topics
EthSimulationInputParam
Decoded input/output parameter for ABI decoding
The Type is defined in src/chains/eth/ssz/verify_data_types.h.
class EthSimulationInputParam(Container):
name : String[256] # parameter name (e.g. "src","wad")
type : String[256] # parameter type (e.g. "address", "uint256")
value : String[1024] # parameter value as string (e.g. "0xe2e2...", "299")