-
Notifications
You must be signed in to change notification settings - Fork 104
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
[VID] AvidM integration #2579
[VID] AvidM integration #2579
Conversation
Unable to build without Cargo.lock file. This means that after this change 3rd party projects may have For the first failing build see: https://github.com/EspressoSystems/espresso-sequencer/actions/runs/13417524682 To reproduce locally run
This PR can still be merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed the HS part mainly. It looks good to me but I'd like to wait with the approval until somebody else reviews the sequencer part and crypto.
hotshot-types/src/consensus.rs
Outdated
/// Type alias to avoid complexity | ||
pub type PayloadWithMetadata<TYPES> = ( | ||
<TYPES as NodeType>::BlockPayload, | ||
<<TYPES as NodeType>::BlockPayload as BlockPayload<TYPES>>::Metadata, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a suggestion: could we use a struct with named fields instead of a tuple? I find it easier to reason about the code when I see a name instead of .0
or .1
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to Lucas' suggestion. This seems like it should be a struct with payload
and metadata
fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now wrapped as a struct: 015aa10
@@ -18,7 +18,7 @@ jobs: | |||
strategy: | |||
matrix: | |||
test_suites: | |||
- test-ci-1 | |||
# - test-ci-1 temporarily disabled for (https://github.com/EspressoSystems/espresso-sequencer/issues/2664) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the test currently hanging or not?
I think we should continue to run this if you moved the calculation out of spawn_blocking
and it works. or, at most, I think we should maybe #[ignore]
the specific tests that aren't working
the workflows aren't well-organized so this is disabling some integration tests too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spawn_blocking
is still there. The conclusion was that the real problem is in the test code. There is a ticket for that: #2664
tokio::task::spawn_blocking(move || advz_commitment(&encoded_txns, num_nodes)); | ||
let join_handle = tokio::task::spawn_blocking(move || { | ||
let encoded_tx_len = encoded_txns.len(); | ||
advz_scheme(num_nodes).commit_only(encoded_txns).map(VidCommitment::V0).unwrap_or_else(|err| panic!("VidScheme::commit_only failure:(num_storage_nodes,payload_byte_len)=({num_nodes},{encoded_tx_len}) error: {err}")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it matters either way, but is this keeping the same logic?
the new version seems much less readable to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this is annoying. Good that VID is removed in the recent merge. a2657f8
.as_ref() | ||
.as_ref(), | ||
.var_size_bytes( | ||
<TestBlockHeader as BlockHeader<TestTypes>>::payload_commitment(self).as_ref(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no objection here, but wondering: is this just a cleanup for tests or was the commitment required to be changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh this shall be a fixed_size_bytes
. 015aa10
Commitments won't change, as those actual types in the sequencer.
@@ -5,5 +5,6 @@ | |||
// along with the HotShot repository. If not, see <https://mit-license.org/>. | |||
|
|||
mod tests_1 { | |||
automod::dir!("tests/tests_1"); | |||
// These tests are temporarily disabled for the following issue: <https://github.com/EspressoSystems/espresso-sequencer/issues/2664> | |||
// automod::dir!("tests/tests_1"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should revert this here and just add an #[ignore]
for the specific test that was failing (test_da_task
?)
hotshot-types/src/consensus.rs
Outdated
/// Type alias to avoid complexity | ||
pub type PayloadWithMetadata<TYPES> = ( | ||
<TYPES as NodeType>::BlockPayload, | ||
<<TYPES as NodeType>::BlockPayload as BlockPayload<TYPES>>::Metadata, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to Lucas' suggestion. This seems like it should be a struct with payload
and metadata
fields
/// Helper function for AvidM scheme to parse a namespace table. | ||
/// If the namespace table is invalid, it returns a default single entry namespace table. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add even a rough description of what a valid namespace table is and/or what the layout should be?
e.g. I assume that bytes
is an array with namespace tables at the start and payload_byte_len
bytes at the end, but it would be nice to have this written down here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is mostly copied
from the sequencer repo. Add a link to it 015aa10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use NsTable::ns_range()
which does exactly this already.
types/src/v0/impls/header.rs
Outdated
@@ -813,7 +815,7 @@ impl BlockHeader<SeqTypes> for Header { | |||
height = parent_leaf.block_header().block_number() + 1, | |||
parent_view = ?parent_leaf.view_number(), | |||
payload_commitment, | |||
payload_size = VidSchemeType::get_payload_byte_len(&_vid_common), | |||
// payload_size = ADVZScheme::get_payload_byte_len(&_vid_common), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be deleted? (not just commented out)
I think there's a few lines that were commented out in this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted: 015aa10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mrain crate vid
is directly copied over without new addition, right? anything I should pay special attention to?
vid/rustfmt.toml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: is it a good idea to have sub-crate rustfmt? or should we just forgo this. (personally I like this config but feels intrusive to impose on the entire monorepo)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @rob-maron do you have any suggestion here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this work as you'd expect? i.e. does the formatting in this file apply to the vid
crate (and only the vid
crate) if you run cargo fmt
from the workspace root?
if so I feel like it's completely fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Locally on my side it works well and only applies to the vid
crate.
type VidResult<T> = Result<T, VidError>; | ||
|
||
/// Trait definition for a Verifiable Information Dispersal (VID) scheme. | ||
pub trait VidScheme { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: we already have trait jf_vid::VidScheme
(and used everywhere), would it be confusing to migrate? or can we try to unify the two and stablize this trait to avoid future disruption?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old trait doesn't take weight distribution. My plan is to migrate them into the new VID crate.
/// Helper function for AvidM scheme to parse a namespace table. | ||
/// If the namespace table is invalid, it returns a default single entry namespace table. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use NsTable::ns_range()
which does exactly this already.
Closes #2600
This PR:
Integrate the efficient AvidM scheme.
keccak256
hash function. Should also considerposeidon2
.Temporarily disable hotshot test_1 b/c #2664
This PR does not:
Key places to review: