Skip to main content

Crate fluentbase_types

Crate fluentbase_types 

Source
Expand description

Shared primitive types, syscall indices, and constants used across the Fluentbase stack.

Re-exports§

pub use byteorder;
pub use hashbrown;
pub use paste;

Modules§

aliases
Type aliases for common primitive types.
bincode
bytes
Provides abstractions for working with bytes.
fd
hash_map
A hash map implemented with quadratic probing and SIMD lookup.
hash_set
A hash set implemented as a HashMap where the value is ().
hex
githubcrates-iodocs-rs
ruint
Rust uint crate using const-generics
system
utils
Common Ethereum utilities.

Macros§

address
Converts a sequence of string literals containing hex-encoded data into a new Address at compile time.
b64
Converts a sequence of string literals containing hex-encoded data into a new B64 at compile time.
b128
Converts a sequence of string literals containing hex-encoded data into a new B128 at compile time.
b256
Converts a sequence of string literals containing hex-encoded data into a new B256 at compile time.
b512
Converts a sequence of string literals containing hex-encoded data into a new B512 at compile time.
bloom
Converts a sequence of string literals containing hex-encoded data into a new Bloom at compile time.
bytes
Converts a sequence of string literals containing hex-encoded data into a new Bytes at compile time.
fixed_bytes
Converts a sequence of string literals containing hex-encoded data into a new FixedBytes at compile time.
hex
Macro for converting sequence of string literals containing hex-encoded data into an array of bytes.
try_vec
Tries to create a Vec containing the arguments.
wrap_fixed_bytes
Wrap a fixed-size byte array in a newtype, delegating all methods to the underlying crate::FixedBytes.

Structs§

Address
An Ethereum address, 20 bytes in length.
AddressChecksumBuffer
Stack-allocated buffer for efficiently computing address checksums.
BigIntConversionError
The error type that is returned when conversion to or from a integer fails.
Bloom
Ethereum 256 byte bloom filter.
Bytes
Wrapper type around bytes::Bytes to support “0x” prefixed hex strings.
FixedBytes
A byte array of fixed length ([u8; N]).
Function
An Ethereum ABI function pointer, 24 bytes in length.
GenesisContract
HashMap
A hash map implemented with quadratic probing and SIMD lookup.
HashSet
A hash set implemented as a HashMap where the value is ().
Keccak256
Simple Keccak-256 hasher.
Log
A log consists of an address, and some log data.
LogData
An Ethereum event log object.
Sealed
A consensus hashable item, with its memoized hash.
Signature
An Ethereum ECDSA signature.
Signed
Signed integer wrapping a ruint::Uint.
SyscallInvocationParams
SyscallResult
Uint
The ring of numbers modulo $2^{\mathtt{BITS}}$.

Enums§

AddressError
Error type for address checksum validation.
BloomInput
Input to the Bloom::accrue method.
BytecodeOrHash
BytecodeType
ExitCode
Exit codes representing various execution outcomes and error conditions.
ParseSignedError
The error type that is returned when parsing a signed integer.
Sign
Enum to represent the sign of a 256-bit signed integer.
SignatureError
Errors in signature parsing or verification.
SysFuncIdx
TxKind
The to field of a transaction. Either a target address, or empty for a contract creation.

Constants§

BLAKE3_BASE_FUEL_COST
BLAKE3_WORD_FUEL_COST
BLOOM_BITS_PER_ITEM
Number of bits to set per input in Ethereum bloom filter.
BLOOM_SIZE_BITS
Size of the bloom filter in bits
BLOOM_SIZE_BYTES
Size of the bloom filter in bytes.
BLS12381_FP2_SIZE
BLS12381_FP_SIZE
BLS12381
BLS12381_G1_COMPRESSED_SIZE
BLS12381_G1_RAW_AFFINE_SIZE
BLS12381_G2_COMPRESSED_SIZE
BLS12381_G2_RAW_AFFINE_SIZE
BLS_G1_ADD_COST
BLS_G1_DECOMPRESS_COST
BLS_G1_DOUBLE_COST
BLS_G2_ADD_COST
BLS_MAP_G1_COST
BLS_MAP_G2_COST
BLS_PAIRING_COST
BN254_ADD_COST
BN254_DOUBLE_COST
BN254_FP2_SIZE
BN254_FP_SIZE
BN254
BN254_G1_COMPRESSED_SIZE
BN254_G1_COMPRESS_COST
BN254_G1_DECOMPRESS_COST
BN254_G1_RAW_AFFINE_SIZE
BN254_G2_COMPRESSED_SIZE
BN254_G2_COMPRESS_COST
BN254_G2_DECOMPRESS_COST
BN254_G2_RAW_AFFINE_SIZE
BN254_MUL_COST
BN254_PAIRING_COST
CALLDATA_QUADRATIC_DIVISOR
Divisor in surcharge = 3*words + words²/DIVISOR. Chosen so that 14 × 128 KB exceeds 100M gas (max block gas): DIVISOR < words²(53,248) / (100M - 7.4M linear) ≈ 30.6
CALLDATA_QUADRATIC_THRESHOLD
Calldata surcharge threshold (128 KB).
CALL_DEPTH_ROOT
CALL_STACK_LIMIT
A max rWasm call stack limit
CHARGE_FUEL_BASE_COST
COPY_BASE_FUEL_COST
COPY_WORD_FUEL_COST
DEBUG_LOG_BASE_FUEL_COST
DEBUG_LOG_WORD_FUEL_COST
DEFAULT_FEE_MANAGER_AUTH
Default fee manager, should be changed after a chain is live
DEFAULT_UPDATE_GENESIS_AUTH
Authority address that is allowed to update the code of arbitrary accounts.
ED25519_ADD_COST
ED25519_DECOMPRESS_COST
ED25519_POINT_COMPRESSED_SIZE
ED25519
ED25519_POINT_DECOMPRESSED_SIZE
EIP2935_BLOCKHASH_SERVE_WINDOW
In the EVM implementation (EIP-2935)
EIP2935_HISTORY_SERVE_WINDOW
In the EVM implementation (EIP-2935)
EIP7702_SIG
rWASM binary format signature:
EIP7702_SIG_LEN
ENGINE_METERED_PRECOMPILES
Addresses whose execution should be charged by the runtime.
EVM_MAX_CODE_SIZE
EIP-170: Contract code size limit
EVM_MAX_INITCODE_SIZE
EIP-3860: Limit and meter initcode
EXECUTE_USING_SYSTEM_RUNTIME_ADDRESSES
Addresses whose execution is delegated to the system runtime implementation.
EXT_CODE_COPY_MAX_COPY_SIZE
A maximum allowed bytes to be copied using EXT_CODE_COPY instruction
FP1_ADD_COST
FP1_BLS_ADD_COST
FP1_BLS_MUL_COST
FP1_MUL_COST
FP2_ADD_COST
FP2_BLS_ADD_COST
FP2_BLS_MUL_COST
FP2_MUL_COST
FUEL_DENOM_RATE
A relation between fuel and gas, according to our benchmarks, average WebAssembly instruction is ~20 times faster than average EVM instruction.
FUEL_MAX_LINEAR_X
The maximum allowed value for the x parameter used in linear gas cost calculation of builtins. This limit ensures:
FUEL_MAX_QUADRATIC_X
The maximum allowed value for the x parameter used in quadratic gas cost calculation of builtins. This limit ensures:
KECCAK256_EMPTY
The Keccak-256 hash of the empty string "".
KECCAK_BASE_FUEL_COST
KECCAK_EMPTY
KECCAK_WORD_FUEL_COST
NATIVE_TRANSFER_ADDRESS
NATIVE_TRANSFER_KECCAK
keccak256 of “Transfer(address,address,uint256)” that notifies about native transfer of eth
POSEIDON_EMPTY
PRECOMPILE_BIG_MODEXP
Big modular exponentiation precompile (EVM address 0x05).
PRECOMPILE_BLAKE2F
BLAKE2 compression function precompile (EVM address 0x09).
PRECOMPILE_BLS12_381_G1_ADD
BLS12-381 G1 add precompile (EVM address 0x0b).
PRECOMPILE_BLS12_381_G1_MSM
BLS12-381 G1 MSM (multi-scalar multiplication) precompile (EVM address 0x0c).
PRECOMPILE_BLS12_381_G2_ADD
BLS12-381 G2 add precompile (EVM address 0x0d).
PRECOMPILE_BLS12_381_G2_MSM
BLS12-381 G2 MSM (multi-scalar multiplication) precompile (EVM address 0x0e).
PRECOMPILE_BLS12_381_MAP_G1
BLS12-381 map-to-G1 precompile (EVM address 0x10).
PRECOMPILE_BLS12_381_MAP_G2
BLS12-381 map-to-G2 precompile (EVM address 0x11).
PRECOMPILE_BLS12_381_PAIRING
BLS12-381 pairing check precompile (EVM address 0x0f).
PRECOMPILE_BN256_ADD
BN254 (a.k.a. alt_bn128) addition precompile (EVM address 0x06).
PRECOMPILE_BN256_MUL
BN254 (a.k.a. alt_bn128) multiplication precompile (EVM address 0x07).
PRECOMPILE_BN256_PAIR
BN254 (a.k.a. alt_bn128) pairing check precompile (EVM address 0x08).
PRECOMPILE_CREATE2_FACTORY
A precompile smart contract that can deploy child contracts using CREATE/CREATE2.
PRECOMPILE_CREATE2_FACTORY_DEPLOYER
PRECOMPILE_EIP2935
EIP-2935 system contract / precompile address (as specified by the EIP).
PRECOMPILE_EIP7951
EIP-7951 system contract / precompile address (as specified by the EIP).
PRECOMPILE_EVM_RUNTIME
Address of the delegated EVM runtime.
PRECOMPILE_FEE_MANAGER
A precompile smart contract that handles fee management.
PRECOMPILE_IDENTITY
Identity precompile (copies input to output) (EVM address 0x04).
PRECOMPILE_KZG_POINT_EVALUATION
KZG point evaluation precompile (EVM address 0x0a).
PRECOMPILE_NITRO_VERIFIER
Address of the Nitro verifier runtime.
PRECOMPILE_OAUTH2_VERIFIER
Address of the OAuth2 verifier runtime.
PRECOMPILE_RIPEMD160
ripemd160 precompile (EVM address 0x03).
PRECOMPILE_ROLLUP_BRIDGE
A precompile smart contract that handles the bridge.
PRECOMPILE_ROLLUP_BRIDGE_DEPLOYER
PRECOMPILE_RUNTIME_UPGRADE
A precompile smart contract that handles runtime upgrades.
PRECOMPILE_SECP256K1_RECOVER
ecrecover precompile (EVM address 0x01).
PRECOMPILE_SHA256
sha256 precompile (EVM address 0x02).
PRECOMPILE_SVM_RUNTIME
Address of the delegated SVM runtime (Solana VM).
PRECOMPILE_UNIVERSAL_TOKEN_RUNTIME
Address of the delegated Universal Token runtime.
PRECOMPILE_UNUSED_4
Address of the Wrapped ETH contract (ERC-20 compatible representation of native ETH).
PRECOMPILE_WASM_RUNTIME
Address of the delegated Wasm runtime.
PRECOMPILE_WEBAUTHN_VERIFIER
Address of the WebAuthn verifier runtime.
QUADRATIC_DIVISOR
QUADRATIC_WORD_FUEL_COST
RWASM_MAX_CODE_SIZE
rWasm max code size
RWASM_SIG
rWASM binary format signature:
RWASM_SIG_LEN
SECP256K1_ADD_COST
SECP256K1_DECOMPRESS_COST
SECP256K1_DOUBLE_COST
SECP256K1_FP_SIZE
SECP256K1
SECP256K1_G1_COMPRESSED_SIZE
SECP256K1_G1_RAW_AFFINE_SIZE
SECP256K1_G1_SEC1_SIZE
SECP256R1_ADD_COST
SECP256R1_DECOMPRESS_COST
SECP256R1_DOUBLE_COST
SECP256R1_FP_SIZE
SECP256R1
SECP256R1_G1_COMPRESSED_SIZE
SECP256R1_G1_RAW_AFFINE_SIZE
SECP256R1_G1_SEC1_SIZE
SHA256_BASE_FUEL_COST
SHA256_WORD_FUEL_COST
STATE_DEPLOY
STATE_FUEL_COST
STATE_MAIN
SYSTEM_ADDRESS
TESTNET_LEGACY_PRECOMPILE_ADDRESSES
The full set of addresses treated as “system precompiles” by the executor.
UINT256_MUL_MOD_COST
UINT256_X2048_MUL_COST
UNIVERSAL_TOKEN_MAGIC_BYTES
ERC20 magic bytes: as char codes for “ERC” and the number 0x20
UPDATE_GENESIS_PREFIX
Transaction calldata prefix for genesis update. Versioning allows introducing new update semantics without ambiguity.
WASM_MAGIC_BYTES
WebAssembly magic bytes
WASM_MAX_CODE_SIZE
WASM max code size
WASM_SIG
WebAssembly signature (\00ASM)
WASM_SIG_LEN

Traits§

CryptoAPI
A low-level API for cryptographic primitives used across the runtime.
FixedBytesSliceExt
Extension trait for flattening a slice of FixedBytes to a byte slice.
FixedBytesVecExt
Extension trait for flattening a Vec of FixedBytes to a Vec<u8>.
IntoLogData
Trait for an object that can be converted into a log data object.
NativeAPI
A trait for providing shared API functionality.
Sealable
Sealeable objects.
UnwrapExitCode

Functions§

calldata_quadratic_surcharge
Returns quadratic surcharge for input_len bytes above CALLDATA_QUADRATIC_THRESHOLD.
eip191_hash_message
Hash a message according to EIP-191 (version 0x01).
import_linker_v1_preview
is_delegated_runtime_address
Returns true if address corresponds to a delegated runtime dispatcher.
is_engine_metered_precompile
Returns true if the contract at address should be charged fuel by the runtime.
is_execute_using_system_runtime
Returns true if address should be executed by the system runtime.
keccak256
Simple interface to the Keccak-256 hash function.
keccak256_uncached
Simple interface to the Keccak-256 hash function.
logs_bloom
Compute the logs bloom filter for the given logs.
normalize_v
Attempts to normalize the v value to a boolean parity value.
resolve_precompiled_runtime_from_input
Resolves and returns the account owner Address based on the provided input byte slice.
to_eip155_v
Applies EIP-155.

Type Aliases§

B64
8-byte fixed byte-array type.
B128
16-byte fixed byte-array type.
B256
32-byte fixed byte-array type.
B512
64-byte fixed byte-array type.
BlockHash
A block hash.
BlockNumber
A block number.
BlockTimestamp
A block timestamp.
ChainId
Chain identifier type (introduced in EIP-155).
EvmExitCode
I8
8-bit signed integer type, consisting of 1, 64-bit limbs.
I16
16-bit signed integer type, consisting of 1, 64-bit limbs.
I32
32-bit signed integer type, consisting of 1, 64-bit limbs.
I64
64-bit signed integer type, consisting of 1, 64-bit limbs.
I128
128-bit signed integer type, consisting of 2, 64-bit limbs.
I160
160-bit signed integer type, consisting of 3, 64-bit limbs.
I256
256-bit signed integer type, consisting of 4, 64-bit limbs.
Selector
Solidity contract functions are addressed using the first four bytes of the Keccak-256 hash of their signature.
StorageKey
An account storage key.
StorageValue
An account storage value.
TxHash
A transaction hash is a keccak hash of an RLP encoded signed transaction.
TxIndex
The index of transaction in a block.
TxNonce
The nonce of a transaction.
TxNumber
The sequence number of all existing transactions.
U8
8-bit unsigned integer type, consisting of 1, 64-bit limbs.
U16
16-bit unsigned integer type, consisting of 1, 64-bit limbs.
U32
32-bit unsigned integer type, consisting of 1, 64-bit limbs.
U64
64-bit unsigned integer type, consisting of 1, 64-bit limbs.
U128
128-bit unsigned integer type, consisting of 2, 64-bit limbs.
U160
160-bit unsigned integer type, consisting of 3, 64-bit limbs.
U256
256-bit unsigned integer type, consisting of 4, 64-bit limbs.
U512
512-bit unsigned integer type, consisting of 8, 64-bit limbs.