snowbridge_pallet_ethereum_client/config/mod.rs
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: 2023 Snowfork <hello@snowfork.com>
3use static_assertions::const_assert;
4
5pub mod altair;
6pub mod electra;
7
8/// Sizes related to SSZ encoding
9pub const MAX_EXTRA_DATA_BYTES: usize = 32;
10pub const MAX_LOGS_BLOOM_SIZE: usize = 256;
11pub const MAX_FEE_RECIPIENT_SIZE: usize = 20;
12
13/// Sanity value to constrain the max size of a merkle branch proof.
14pub const MAX_BRANCH_PROOF_SIZE: usize = 20;
15
16/// DomainType('0x07000000')
17/// <https://github.com/ethereum/consensus-specs/blob/dev/specs/altair/beacon-chain.md#domain-types>
18pub const DOMAIN_SYNC_COMMITTEE: [u8; 4] = [7, 0, 0, 0];
19/// Validators public keys are 48 bytes.
20pub const PUBKEY_SIZE: usize = 48;
21/// Signatures produced by validators are 96 bytes.
22pub const SIGNATURE_SIZE: usize = 96;
23
24// Sanity check for the sync committee bits (see SYNC_COMMITTEE_BITS_SIZE).
25const_assert!(SYNC_COMMITTEE_BITS_SIZE == SYNC_COMMITTEE_SIZE / 8);
26
27/// Defined in <https://github.com/ethereum/consensus-specs/tree/f1dff5f6768608d890fc0b347e548297fc3e1f1c/presets/mainnet>
28/// There are 32 slots in an epoch. An epoch is 6.4 minutes long.
29pub const SLOTS_PER_EPOCH: usize = 32;
30/// 256 epochs in a sync committee period. Frequency of sync committee (subset of Ethereum
31/// validators) change is every ~27 hours.
32pub const EPOCHS_PER_SYNC_COMMITTEE_PERIOD: usize = 256;
33/// A sync committee contains 512 randomly selected validators.
34pub const SYNC_COMMITTEE_SIZE: usize = 512;
35/// An array of sync committee block votes, one bit representing the vote of one validator.
36pub const SYNC_COMMITTEE_BITS_SIZE: usize = SYNC_COMMITTEE_SIZE / 8;
37/// The size of the block root array in the beacon state, used for ancestry proofs.
38pub const SLOTS_PER_HISTORICAL_ROOT: usize = 8192;
39/// The index of the block_roots field in the beacon state tree.
40pub const BLOCK_ROOT_AT_INDEX_DEPTH: usize = 13;