Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add rust PeerdasKZG crypto library for peerdas functionality and rollback c-kzg dependency to 4844 version #5941

Merged
merged 27 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8331583
chore: add recover_cells_and_compute_proofs method
kevaundray Jun 17, 2024
f84bbde
chore: add rust peerdas crypto library
kevaundray Jun 17, 2024
2f0eefa
chore: integrate peerdaskzg rust library into kzg crate
kevaundray Jun 17, 2024
2bec02c
chore(multi):
kevaundray Jun 17, 2024
6f3c1b6
chore(multi):
kevaundray Jun 17, 2024
d09a495
chore: cleanup of superfluous conversions
kevaundray Jun 17, 2024
d15a8ae
chore: revert c-kzg dependency back to v1
kevaundray Jun 17, 2024
ed418a6
chore: move dependency into correct order
kevaundray Jun 17, 2024
37552cb
chore: update rust dependency
kevaundray Jun 17, 2024
5f142aa
chore: remove Default initialization of PeerDasContext and explicitly…
kevaundray Jun 17, 2024
405e80e
chore: cleanup exports
kevaundray Jun 17, 2024
629ba9f
Merge branch 'das' into kw/add-peerdas-kzg-lib
kevaundray Jun 19, 2024
fc34d59
chore: commit updated cargo.lock
kevaundray Jun 19, 2024
fda359e
Update Cargo.toml
kevaundray Jun 24, 2024
1a57456
chore: rename dependency
kevaundray Jun 26, 2024
42316da
chore: update peerdas lib
kevaundray Jun 26, 2024
ddcd60d
chore: fix clippy lifetime
kevaundray Jun 26, 2024
f34a84d
Merge branch 'das' into kw/add-peerdas-kzg-lib
kevaundray Jun 26, 2024
25e7b72
chore: cargo clippy fix
kevaundray Jun 26, 2024
dda5133
chore: cargo fmt
kevaundray Jun 26, 2024
126ac96
chore: update lib to add redundant checks (these will be removed in c…
kevaundray Jun 26, 2024
05426ee
chore: update dependency to ignore proofs
kevaundray Jun 27, 2024
6440d78
chore: update peerdas lib to latest
kevaundray Jun 28, 2024
8570748
update lib
kevaundray Jul 4, 2024
2b2938a
chore: remove empty proof parameter
kevaundray Jul 4, 2024
7d284bb
Merge branch 'das' into kw/add-peerdas-kzg-lib
kevaundray Jul 6, 2024
d388f54
Merge branch 'das' into kw/add-peerdas-kzg-lib
jimmygchen Jul 8, 2024
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
196 changes: 188 additions & 8 deletions Cargo.lock

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

6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,14 @@ bytes = "1"
clap = { version = "4.5.4", features = ["cargo", "wrap_help"] }
# Turn off c-kzg's default features which include `blst/portable`. We can turn on blst's portable
# feature ourselves when desired.
# TODO(das): switch to c-kzg crate before merging back to unstable (and disable default-features) if possible
# Turn off c-kzg's default features which include `blst/portable`. We can turn on blst's portable
# feature ourselves when desired.
c-kzg = { git = "https://github.com/ethereum/c-kzg-4844", rev = "114fa0382990e9b74b1f90f3b0dc5f97c2f8a7ad" }
c-kzg = { version = "1", default-features = false }
compare_fields_derive = { path = "common/compare_fields_derive" }
criterion = "0.3"
delay_map = "0.3"
derivative = "2"
dirs = "3"
either = "1.9"
eip7594 = { git = "https://github.com/crate-crypto/peerdas-kzg", rev = "5a44c5995ade5de0ac06909bcbacab8437847ba4" }
discv5 = { version = "0.4.1", features = ["libp2p"] }
env_logger = "0.9"
error-chain = "0.12"
Expand Down
9 changes: 6 additions & 3 deletions beacon_node/beacon_chain/src/kzg_utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use kzg::{Blob as KzgBlob, Bytes48, Cell as KzgCell, Error as KzgError, Kzg};
use kzg::{Blob as KzgBlob, Bytes48, CellRef as KzgCellRef, Error as KzgError, Kzg};
use std::sync::Arc;
use types::data_column_sidecar::Cell;
use types::{Blob, DataColumnSidecar, EthSpec, Hash256, KzgCommitment, KzgProof};
Expand All @@ -11,8 +11,11 @@ fn ssz_blob_to_crypto_blob<E: EthSpec>(blob: &Blob<E>) -> Result<KzgBlob, KzgErr

/// Converts a cell ssz List object to an array to be used with the kzg
/// crypto library.
fn ssz_cell_to_crypto_cell<E: EthSpec>(cell: &Cell<E>) -> Result<KzgCell, KzgError> {
KzgCell::from_bytes(cell.as_ref()).map_err(Into::into)
fn ssz_cell_to_crypto_cell<E: EthSpec>(cell: &Cell<E>) -> Result<KzgCellRef, KzgError> {
let cell_bytes: &[u8] = cell.as_ref();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noting that this method is duplicated in data_column_sidecar.rs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, we can probably remove this one

Ok(cell_bytes
.try_into()
.expect("expected cell to have size {BYTES_PER_CELL}. This should be guaranteed by the `FixedVector type"))
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.expect("expected cell to have size {BYTES_PER_CELL}. This should be guaranteed by the `FixedVector type"))
.expect("expected cell to have size {BYTES_PER_CELL}. This should be guaranteed by the `FixedVector` type"))


/// Validate a single blob-commitment-proof triplet from a `BlobSidecar`.
Expand Down
Loading
Loading