Crate arb_precompiles

Crate arb_precompiles 

Source
Expand description

Arbitrum precompile contracts.

Implements the system contracts at addresses 0x64+ that provide on-chain access to ArbOS state, gas pricing, retryable tickets, Stylus WASM management, and node interface queries.

Re-exports§

pub use arbsys::create_arbsys_precompile;
pub use arbsys::get_cached_l1_block_number;
pub use arbsys::get_current_l2_block;
pub use arbsys::get_tx_is_aliased;
pub use arbsys::set_cached_l1_block_number;
pub use arbsys::set_current_l2_block;
pub use arbsys::set_tx_is_aliased;
pub use arbsys::store_arbsys_state;
pub use arbsys::take_arbsys_state;
pub use arbsys::ArbSysMerkleState;
pub use arbsys::ARBSYS_ADDRESS;
pub use storage_slot::ARBOS_STATE_ADDRESS;

Modules§

arbsys
storage_slot

Constants§

ARBADDRESSTABLE_ADDRESS
ArbAddressTable precompile address (0x66).
ARBAGGREGATOR_ADDRESS
ArbAggregator precompile address (0x6d).
ARBBLS_ADDRESS
ArbBLS precompile address (0x67).
ARBDEBUG_ADDRESS
ArbDebug precompile address (0xff).
ARBFILTEREDTXMANAGER_ADDRESS
ArbFilteredTransactionsManager precompile address (0x74).
ARBFUNCTIONTABLE_ADDRESS
ArbFunctionTable precompile address (0x68).
ARBGASINFO_ADDRESS
ArbGasInfo precompile address (0x6c).
ARBINFO_ADDRESS
ArbInfo precompile address (0x65).
ARBNATIVETOKENMANAGER_ADDRESS
ArbNativeTokenManager precompile address (0x73).
ARBOSACTS_ADDRESS
ArbosActs precompile address (0xa4b05).
ARBOSTEST_ADDRESS
ArbosTest precompile address (0x69). Burns arbitrary amounts of L2 gas.
ARBOWNERPUBLIC_ADDRESS
ArbOwnerPublic precompile address (0x6b).
ARBOWNER_ADDRESS
ArbOwner precompile address (0x70).
ARBRETRYABLETX_ADDRESS
ArbRetryableTx precompile address (0x6e).
ARBSTATISTICS_ADDRESS
ArbStatistics precompile address (0x6f).
ARBWASMCACHE_ADDRESS
ArbWasmCache precompile address (0x72).
ARBWASM_ADDRESS
ArbWasm precompile address (0x71).
NODE_INTERFACE_ADDRESS
NodeInterface virtual contract address (0xc8).
NODE_INTERFACE_DEBUG_ADDRESS
NodeInterfaceDebug virtual contract address (0xc9).
P256VERIFY_ADDRESS
RIP-7212 P256VERIFY precompile address (ArbOS v30+).

Functions§

allow_debug_precompiles
build_fake_tx_bytes
Build the EIP-2718 envelope of a fake EIP-1559 tx used to size the calldata payload for gas estimation (hard-coded random nonce/tip/feeCap/gas/sig fields).
caller_at_depth
msg.sender of the frame at depth (1-indexed). None outside range.
charge_precompile_gas
clear_tx_scratch
compute_l1_gas_for_estimate
L1 gas estimate: brotli-compress a fake EIP-1559 tx, pad units by (units + 256) * 1.01, multiply by pricePerUnit, pad posterCost by 1.10, then divide by max(basefee * 7/8, minBaseFee).
create_arbaddresstable_precompile
create_arbaggregator_precompile
create_arbbls_precompile
create_arbdebug_precompile
create_arbfilteredtxmanager_precompile
create_arbfunctiontable_precompile
create_arbgasinfo_precompile
create_arbinfo_precompile
create_arbnativetokenmanager_precompile
create_arbosacts_precompile
create_arbostest_precompile
create_arbowner_precompile
create_arbownerpublic_precompile
create_arbretryabletx_precompile
create_arbstatistics_precompile
create_arbwasm_precompile
create_arbwasmcache_precompile
create_nodeinterface_debug_precompile
create_nodeinterface_precompile
decode_estimate_args
Decode gasEstimateComponents(address,bool,bytes) calldata into (to, contractCreation, data).
emit_log
get_arbos_version
Get the current ArbOS version.
get_block_timestamp
Get the current block timestamp.
get_current_gas_backlog
Get the current gas backlog value.
get_current_redeemer
get_current_retryable_id
get_current_tx_poster_fee
Get the current tx poster fee.
get_current_tx_sender
Get the current tx sender.
get_evm_depth
Get the current EVM call depth.
get_l1_block_number_for_evm
Get the L1 block number for the NUMBER opcode.
get_l2_block_hash
Get an L2 block hash from the arbBlockHash cache.
get_poster_balance_correction
Get the poster balance correction.
get_precompile_gas
init_precompile_gas
Initialize gas tracking for a precompile call: reset accumulator, charge argsCost (CopyGas * input words) and OpenArbosState (1 SLOAD = 800).
insert_recent_wasm
Insert a Stylus program codehash into the recent WASMs cache. Returns true if the codehash was already present (cache hit).
pop_caller_frame
push_caller_frame
redeem_scheduled_topic
register_arb_precompiles
Registers Arbitrum precompiles into map and applies the per-ArbOS-version adjustments to the standard Ethereum precompile set.
reset_caller_stack
reset_precompile_gas
reset_recent_wasms
Reset the recent WASMs cache for a new block, with the given capacity.
set_allow_debug_precompiles
Set whether ArbDebug / ArbosTest debug precompiles are callable. Driven by the chain spec’s AllowDebugPrecompiles flag.
set_arbos_version
Set the current ArbOS version for precompile version gating.
set_block_timestamp
Set the current block timestamp for precompile queries.
set_current_gas_backlog
Set the current gas backlog value for the Redeem precompile.
set_current_redeemer
set_current_retryable_id
set_current_tx_poster_fee
Set the current tx poster fee for ArbGasInfo.getCurrentTxL1GasFees.
set_current_tx_sender
Set the current tx sender for BALANCE correction.
set_evm_depth
Set the EVM call depth to a specific value. Called by the precompile provider which reads the depth from revm’s journal.
set_l1_block_number_for_evm
Set the L1 block number for the NUMBER opcode.
set_l2_block_hash
Set an L2 block hash in the arbBlockHash cache.
set_poster_balance_correction
Set the poster balance correction for BALANCE opcode adjustment.
set_stylus_activation_data_fee
set_stylus_activation_request
set_stylus_keepalive_request
sol_error_revert
Emit a pre-encoded Solidity custom-error payload (selector + ABI args) as a revert. Adds the copy cost for the payload to the accumulated gas.
take_pending_precompile_logs
take_stylus_activation_data_fee
take_stylus_activation_request
take_stylus_keepalive_request
ticket_created_topic