alloy_eip7702/
constants.rs

1//! [EIP-7702] constants.
2//!
3//! [EIP-7702]: https://eips.ethereum.org/EIPS/eip-7702
4use alloy_primitives::{uint, U256};
5
6/// Identifier for EIP7702's set code transaction.
7///
8/// See also [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702).
9pub const EIP7702_TX_TYPE_ID: u8 = 4;
10
11/// Magic number used to calculate an EIP7702 authority.
12///
13/// See also [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702).
14pub const MAGIC: u8 = 0x05;
15
16/// An additional gas cost per EIP7702 authorization list item.
17///
18/// See also [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702).
19pub const PER_AUTH_BASE_COST: u64 = 12500;
20
21/// A gas refund for EIP7702 transactions if the authority account already exists in the trie.
22///
23/// The refund is `PER_EMPTY_ACCOUNT_COST - PER_AUTH_BASE_COST`.
24///
25/// See also [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702).
26pub const PER_EMPTY_ACCOUNT_COST: u64 = 25000;
27
28/// The order of the secp256k1 curve, divided by two. Signatures that should be checked according
29/// to EIP-2 should have an S value less than or equal to this.
30pub const SECP256K1N_HALF: U256 =
31    uint!(57896044618658097711785492504343953926418782139537452191302581570759080747168_U256);