Skip to content

Commit

Permalink
resolved comments + added containers
Browse files Browse the repository at this point in the history
  • Loading branch information
varun-doshi committed Dec 13, 2024
1 parent 886c80d commit 3602a61
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 13 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ version = "0.1.0"

[workspace.dependencies]
clap = "4"
alloy-primitives = "0.8.15"
alloy-primitives ={version = "0.8.15", features = ['serde']}
serde = { version = '1.0.216', features = ['derive'] }
3 changes: 2 additions & 1 deletion crates/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ rust-version.workspace = true
version.workspace = true

[dependencies]
alloy-primitives = {workspace = true}
alloy-primitives.workspace = true
serde.workspace = true
1 change: 1 addition & 0 deletions crates/common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod phase0 {
pub mod constants;
pub mod primitives;
pub mod containers;
}
15 changes: 6 additions & 9 deletions crates/common/src/phase0/constants.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use alloy_primitives::{aliases::B32,FixedBytes};
use alloy_primitives::{FixedBytes, aliases::B32};

pub const NODE_ID_BITS: u16 = 256;
pub const GOSSIP_MAX_SIZE: u32 = 10_485_760;
Expand All @@ -11,11 +11,8 @@ pub const ATTESTATION_PROPAGATION_SLOT_RANGE: u8 = 32;
pub const MAXIMUM_GOSSIP_CLOCK_DISPARITY: u16 = 500;
pub const MESSAGE_DOMAIN_INVALID_SNAPPY: B32 = FixedBytes([0x00, 0x00, 0x00, 0x00]);
pub const MESSAGE_DOMAIN_VALID_SNAPPY: B32 = FixedBytes([0x10, 0x00, 0x00, 0x00]);
pub const SUBNETS_PER_NODE:u8=2;
pub const ATTESTATION_SUBNET_COUNT:u8=64;
pub const ATTESTATION_SUBNET_EXTRA_BITS:u8=0;
// ATTESTATION_SUBNET_PREFIX_BITS
pub const MAX_CONCURRENT_REQUESTS:u8=2;



pub const SUBNETS_PER_NODE: u8 = 2;
pub const ATTESTATION_SUBNET_COUNT: u8 = 64;
pub const ATTESTATION_SUBNET_EXTRA_BITS: u8 = 0;
// ATTESTATION_SUBNET_PREFIX_BITS
pub const MAX_CONCURRENT_REQUESTS: u8 = 2;
23 changes: 23 additions & 0 deletions crates/common/src/phase0/containers.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use alloy_primitives::B256;
use serde::{Deserialize, Serialize};

use crate::phase0::primitives::{Epoch, Version};

#[derive(Clone, Copy, PartialEq, Eq, Default, Debug, Deserialize, Serialize)]
pub struct Fork {
pub previous_version: Version,
pub current_version: Version,
pub epoch: Epoch,
}

#[derive(Clone, Copy, PartialEq, Eq, Default, Debug, Deserialize, Serialize)]
pub struct ForkData {
pub curent_version: Version,
pub genesis_validators: B256,
}

#[derive(Clone, Copy, PartialEq, Eq, Default, Debug, Deserialize, Serialize)]
pub struct Checkpoint {
pub epock: Epoch,
pub root: B256,
}
14 changes: 12 additions & 2 deletions crates/common/src/phase0/primitives.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
use alloy_primitives::{U256,U64};
use alloy_primitives::{U256, U64,aliases::B32};

pub type CommiteeIndex = u64; //commitee index at a slot
pub type Domain = B32; //signature Domain
pub type DomainType = B32; // Domain type
pub type Epoch = u64; //epoch number
pub type ForkDigest = B32; //digest of current fork data
pub type Gwei = u64; //amount in gwei
pub type NodeID = U256; //Node Idnetifier
pub type SubnetID=U64; //Subnet Identifier
pub type Slot = u64; //slot number
pub type SubnetID = U64; //Subnet Identifier
pub type ValidatorIndex = u64; //validator registry index
pub type Version = B32; //fork version number

0 comments on commit 3602a61

Please sign in to comment.