Skip to content
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
896c40a
Add decode impl
paulhauner Nov 25, 2024
c124eac
Add encode impl
paulhauner Nov 25, 2024
603b4b2
Add todo impls
paulhauner Nov 25, 2024
6a81218
Fix compile errors
paulhauner Nov 25, 2024
8cd04c6
Fix decode impl
paulhauner Nov 25, 2024
89431fd
Use updated ssz_types repo
paulhauner Nov 25, 2024
3964cba
Avoid sanitize_offset fn
paulhauner Nov 25, 2024
6eaace5
Use ssz-types with bigger smallvec
paulhauner Nov 26, 2024
fe7e3f5
Impl tree hash
paulhauner Nov 26, 2024
b5b70b1
Tidy, add comments
paulhauner Nov 26, 2024
1e21198
Implement tests for tree_hash
paulhauner Dec 2, 2024
b51ccb1
Add ssz tests
paulhauner Dec 2, 2024
c75f203
Add malicious ssz tests
paulhauner Dec 3, 2024
7fabbc0
Add random vectors to tests
paulhauner Dec 3, 2024
1313255
Custom Checkpoint SSZ impls
paulhauner Dec 3, 2024
31ea1d5
Implement serde
paulhauner Dec 4, 2024
dd7b97e
Impl arbitrary
paulhauner Dec 4, 2024
56ad1ce
Rename struct, fix tests and lints
paulhauner Dec 4, 2024
ff5258d
Merge branch 'unstable' into tx-opaque
paulhauner Dec 4, 2024
e0fd189
Fix clippy lint
paulhauner Dec 4, 2024
3ca39f2
Bump some crate versions
paulhauner Dec 5, 2024
06f4b68
Merge branch 'unstable' into tx-opaque
paulhauner Dec 19, 2024
432755c
Bump ssz_types version
paulhauner Jan 6, 2025
9dffa74
Change milhouse commit
paulhauner Jan 6, 2025
07785d9
Bump ssz version
paulhauner Jan 6, 2025
c67f9b1
Fix bitfield compile errors
paulhauner Jan 6, 2025
af13240
Bump to milhouse 0.5
paulhauner Jan 16, 2025
0d81f1c
Merge remote-tracking branch 'origin/unstable' into tx-opaque
michaelsproul Jan 20, 2025
6fe58c9
Fix test_utils
michaelsproul Jan 20, 2025
01e1c17
Add ssz_fixed_len impl
paulhauner Feb 4, 2025
2d39282
Avoid clippy ignores with saturating math
paulhauner Feb 4, 2025
d9476f7
Merge branch 'unstable' into tx-opaque
paulhauner Feb 4, 2025
10cf10f
Use `String` for decoding
paulhauner Feb 4, 2025
9900ad8
Revert "Avoid clippy ignores with saturating math"
paulhauner Feb 4, 2025
88c85da
Use unchecked math
paulhauner Feb 4, 2025
91ecdde
Add test for ssz_bytes_len
paulhauner Feb 4, 2025
ebfdc0b
Fix tests
paulhauner Feb 4, 2025
505429b
Bump size tests
paulhauner Feb 5, 2025
200ff53
Wrap `MetaData` in an Arc
paulhauner Feb 5, 2025
adf95fa
Fix stack size clippy lint
paulhauner Feb 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 53 additions & 15 deletions Cargo.lock

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

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ discv5 = { version = "0.9", features = ["libp2p"] }
env_logger = "0.9"
ethereum_hashing = "0.7.0"
ethereum_serde_utils = "0.7"
ethereum_ssz = "0.7"
ethereum_ssz_derive = "0.7"
ethereum_ssz = "0.8.2"
ethereum_ssz_derive = "0.8.2"
ethers-core = "1"
ethers-providers = { version = "1", default-features = false }
exit-future = "0.2"
Expand All @@ -155,7 +155,7 @@ libsecp256k1 = "0.7"
log = "0.4"
lru = "0.12"
maplit = "1"
milhouse = "0.3"
milhouse = { rev = "1df8db756200fa1ad77af17dbc036b85a444fd1a", git = "https://github.com/paulhauner/milhouse" }
num_cpus = "1"
parking_lot = "0.12"
paste = "1"
Expand Down Expand Up @@ -192,7 +192,7 @@ slog-term = "2"
sloggers = { version = "2", features = ["json"] }
smallvec = { version = "1.11.2", features = ["arbitrary"] }
snap = "1"
ssz_types = { rev = "26716095d94e02a2cbd72c94a8b3b8549ecf14d1", git = "https://github.com/paulhauner/ssz_types.git" }
ssz_types = "0.10"
strum = { version = "0.24", features = ["derive"] }
superstruct = "0.8"
syn = "1"
Expand All @@ -211,8 +211,8 @@ tracing-appender = "0.2"
tracing-core = "0.1"
tracing-log = "0.2"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
tree_hash = "0.8"
tree_hash_derive = "0.8"
tree_hash = "0.9"
tree_hash_derive = "0.9"
url = "2"
uuid = { version = "0.8", features = ["serde", "v4"] }
warp = { version = "0.3.7", default-features = false, features = ["tls"] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ pub enum EpochProcessingError {
BeaconStateError(BeaconStateError),
InclusionError(InclusionError),
SszTypesError(ssz_types::Error),
BitfieldError(ssz::BitfieldError),
ArithError(safe_arith::ArithError),
InconsistentStateFork(InconsistentFork),
InvalidJustificationBit(ssz_types::Error),
InvalidJustificationBit(ssz::BitfieldError),
InvalidFlagIndex(usize),
MilhouseError(milhouse::Error),
EpochCache(EpochCacheError),
Expand Down Expand Up @@ -49,6 +50,12 @@ impl From<ssz_types::Error> for EpochProcessingError {
}
}

impl From<ssz::BitfieldError> for EpochProcessingError {
fn from(e: ssz::BitfieldError) -> EpochProcessingError {
EpochProcessingError::BitfieldError(e)
}
}

impl From<safe_arith::ArithError> for EpochProcessingError {
fn from(e: safe_arith::ArithError) -> EpochProcessingError {
EpochProcessingError::ArithError(e)
Expand Down
13 changes: 7 additions & 6 deletions consensus/types/src/attestation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use super::{
#[derive(Debug, PartialEq)]
pub enum Error {
SszTypesError(ssz_types::Error),
BitfieldError(ssz::BitfieldError),
AlreadySigned(usize),
SubnetCountIsZero(ArithError),
IncorrectStateVariant,
Expand Down Expand Up @@ -225,7 +226,7 @@ impl<E: EthSpec> Attestation<E> {
}
}

pub fn get_aggregation_bit(&self, index: usize) -> Result<bool, ssz_types::Error> {
pub fn get_aggregation_bit(&self, index: usize) -> Result<bool, ssz::BitfieldError> {
match self {
Attestation::Base(att) => att.aggregation_bits.get(index),
Attestation::Electra(att) => att.aggregation_bits.get(index),
Expand Down Expand Up @@ -337,13 +338,13 @@ impl<E: EthSpec> AttestationElectra<E> {
if self
.aggregation_bits
.get(committee_position)
.map_err(Error::SszTypesError)?
.map_err(Error::BitfieldError)?
{
Err(Error::AlreadySigned(committee_position))
} else {
self.aggregation_bits
.set(committee_position, true)
.map_err(Error::SszTypesError)?;
.map_err(Error::BitfieldError)?;

self.signature.add_assign(signature);

Expand Down Expand Up @@ -395,13 +396,13 @@ impl<E: EthSpec> AttestationBase<E> {
if self
.aggregation_bits
.get(committee_position)
.map_err(Error::SszTypesError)?
.map_err(Error::BitfieldError)?
{
Err(Error::AlreadySigned(committee_position))
} else {
self.aggregation_bits
.set(committee_position, true)
.map_err(Error::SszTypesError)?;
.map_err(Error::BitfieldError)?;

self.signature.add_assign(signature);

Expand All @@ -411,7 +412,7 @@ impl<E: EthSpec> AttestationBase<E> {

pub fn extend_aggregation_bits(
&self,
) -> Result<BitList<E::MaxValidatorsPerSlot>, ssz_types::Error> {
) -> Result<BitList<E::MaxValidatorsPerSlot>, ssz::BitfieldError> {
self.aggregation_bits.resize::<E::MaxValidatorsPerSlot>()
}
}
Expand Down
3 changes: 2 additions & 1 deletion consensus/types/src/sync_aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use tree_hash_derive::TreeHash;
#[derive(Debug, PartialEq)]
pub enum Error {
SszTypesError(ssz_types::Error),
BitfieldError(ssz::BitfieldError),
ArithError(ArithError),
}

Expand Down Expand Up @@ -68,7 +69,7 @@ impl<E: EthSpec> SyncAggregate<E> {
sync_aggregate
.sync_committee_bits
.set(participant_index, true)
.map_err(Error::SszTypesError)?;
.map_err(Error::BitfieldError)?;
}
}
sync_aggregate
Expand Down
3 changes: 2 additions & 1 deletion consensus/types/src/sync_committee_contribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use tree_hash_derive::TreeHash;
#[derive(Debug, PartialEq)]
pub enum Error {
SszTypesError(ssz_types::Error),
BitfieldError(ssz::BitfieldError),
AlreadySigned(usize),
SubnetCountIsZero(ArithError),
}
Expand Down Expand Up @@ -53,7 +54,7 @@ impl<E: EthSpec> SyncCommitteeContribution<E> {
) -> Result<Self, Error> {
let mut bits = BitVector::new();
bits.set(validator_sync_committee_index, true)
.map_err(Error::SszTypesError)?;
.map_err(Error::BitfieldError)?;
Ok(Self {
slot: message.slot,
beacon_block_root: message.beacon_block_root,
Expand Down
Loading