Crate zksync_types

Source
Expand description

ZKsync types: essential type definitions for ZKsync network.

zksync_types is a crate containing essential ZKsync network types, such as transactions, operations and blockchain primitives.

Re-exports§

pub use l1::L1TxCommonData;
pub use l2::L2TxCommonData;
pub use protocol_upgrade::ProtocolUpgrade;
pub use protocol_upgrade::ProtocolVersion;
pub use tx::Execute;
pub use storage::*;

Modules§

abi
aggregated_operations
api
base_token_ratio
basic_fri_types
Basic types for FRI prover.
blob
block
bytecode
Bytecode-related types and utils.
commitment
Data structures that have more metadata than their primary versions declared in this crate. For example, L1 batch defined here has the root_hash field which is absent in L1BatchHeader.
debug_flat_call
eip712_signature
This is implementation of a standard for hashing typed structured data for EIP-712 signing standard.
eth_sender
ethabi
Ethereum ABI encoding decoding library.
fee
fee_model
hasher
helpers
l1
Definition of ZKsync network priority operations: operations initiated from the L1.
l2
l2_to_l1_log
network
The network where the ZKsync resides.
packed_eth_signature
priority_op_onchain_data
protocol_upgrade
protocol_version
prover_dal
Types exposed by the prover DAL for general-purpose use.
pubdata_da
Types related to data availability.
secrets
serde_wrappers
Generic serde helpers.
settlement
snapshots
storage
system_contracts
tee_types
tokens
transaction_request
tx
transactions is module that holds the essential information for every transaction.
url
utils
vm
Basic VM types that shared widely enough to not put them in the multivm crate.
web3
Selected Web3 types copied from the web3 crate.
zk_evm_types

Structs§

AccountTreeId
Account place in the global state tree is uniquely identified by its address. Binary this type is represented by 160 bit big-endian representation of account address.
Bloom
Bloom hash type with 256 bytes (2048 bits) size.
Eip712Domain
EncodedStructureMember
H64
H128
Fixed-size uninterpreted hash type with 16 bytes (128 bits) size.
H160
Fixed-size uninterpreted hash type with 20 bytes (160 bits) size.
H256
Fixed-size uninterpreted hash type with 32 bytes (256 bits) size.
H512
Fixed-size uninterpreted hash type with 64 bytes (512 bits) size.
H520
InputData
Optional input Ethereum-like encoded transaction if submitted via Web3 API. If exists, its hash will be used to identify transaction. Note, that for EIP712-type transactions, hash is not equal to the hash of the data, but rather calculated by special formula.
K256PrivateKey
secp256k1 private key wrapper.
L1BatchNumber
ZKsync L1 batch sequential index.
L1BlockNumber
Ethereum network block sequential index.
L1ChainId
ChainId in the Ethereum network. IMPORTANT: Please, use this method when exactly the L1 chain id is required. Note, that typically this is not the case and the majority of methods need to work with settlement layer chain id, which is represented by SLChainId.
L2BlockNumber
ZKsync network block sequential index.
L2ChainId
ChainId in the ZKsync network.
Nonce
ZKsync account nonce.
PackedEthSignature
Struct used for working with Ethereum signatures created using eth_sign (using geth, ethers.js, etc) message is serialized as 65 bytes long 0x prefixed string.
PriorityOpId
Unique identifier of the priority operation in the ZKsync network.
SLChainId
ChainId of a settlement layer.
Signature
Signature encoded as RSV components
Transaction
TransactionTimeRangeConstraint
U64
Little-endian large integer type Unsigned 64-bit integer.
U128
Little-endian large integer type 128-bit unsigned integer.
U256
Little-endian large integer type 256-bit unsigned integer.

Enums§

BloomInput
DeserializeError
ExecuteTransactionCommon
ProtocolVersionId
ProtocolVersionId is a unique identifier of the protocol version. Note, that it is an identifier of the minor semver version of the protocol, with the major version being 0. Also, the protocol version on the contracts may contain potential minor versions, that may have different contract behavior (e.g. Verifier), but it should not impact the users.

Constants§

EIP_712_TX_TYPE
Denotes the first byte of the special ZKsync’s EIP-712-signed transaction.
EIP_1559_TX_TYPE
Denotes the first byte of the EIP-1559 transaction.
EIP_2930_TX_TYPE
Denotes the first byte of the EIP-2930 transaction.
EIP_4844_TX_TYPE
Denotes the first byte of the EIP-4844 transaction.
LEGACY_TX_TYPE
Denotes the first byte of some legacy transaction, which type is unknown to the server.
PRIORITY_OPERATION_L2_TX_TYPE
Denotes the first byte of the priority transaction.
PROTOCOL_UPGRADE_TX_TYPE
Denotes the first byte of the protocol upgrade transaction.

Traits§

EIP712TypedStructure
Interface for defining the structure for the EIP712 signature.
StructBuilder
Interface that collects members of the structure into the structure of the EIP-712 standard.
StructMember

Functions§

address_to_h256
address_to_u256
ceil_div_u256
Computes ceil(a / b).
h256_to_address
Converts H256 value into an Address.
h256_to_u256
parse_h160
Parses H160 from a slice of bytes.
parse_h256
Parses H256 from a slice of bytes.
parse_h256_opt
Parses H256 from an optional slice of bytes.
public_to_address
Convert public key into the address
recover
Recovers the public key from the signature for the message
sign
Signs message with the given secret key. Returns the corresponding signature.
u256_to_address
Converts U256 value into an Address.
u256_to_h256

Type Aliases§

Address
SerialId