-
Notifications
You must be signed in to change notification settings - Fork 330
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
fix(consensus): fix the hashes-in-blocks
feature implementation
#3529
Conversation
hashes-in-blocks
featurehashes-in-blocks
feature implementation
rs/p2p/artifact_downloader/src/fetch_stripped_artifact/download.rs
Outdated
Show resolved
Hide resolved
rs/p2p/artifact_downloader/src/fetch_stripped_artifact/assembler.rs
Outdated
Show resolved
Hide resolved
rs/p2p/artifact_downloader/src/fetch_stripped_artifact/download.rs
Outdated
Show resolved
Hide resolved
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.
Interface changes LGTM.
One more thing that just crossed my mind: IIRC |
Sure, I'll add a comment to the type definition |
Problem
Currently, with the feature flag enabled, when a node sends a block proposal to their peers it first removes all the ingress messages from the block's payload, leaving behind only the
IngressMessageId
s which identify the ingress messages. When a node receives such a "stripped" block proposal it reconstructs the block by retrieving the referenced ingress messages from:IngressMessageId
there,The problem with the approach is that the
IngressMessageId
s do not uniquely identify the the ingress messages and two ingresses with the same content but with different signatures have the same id. We thus could end up in a situation where peers reconstruct blocks different than what the block maker created.Note
The feature is disabled on the Mainnet so no subnet is currently affected by the issue
Proposal
To address this problem we introduce a new type
SignedIngressId
(which contains bothIngressMessageId
and the hash of a original ingress message bytes) which uniquely identifies aSignedIngress
, which is used only within the the block proposal assembler module. Everything else remains basically the same but we add several checks to make sure we put the correct ingress message in the block:IngressMessageId
s we double check that theSignedIngressId
of the ingress message matches what we are expecting;Alternatives considered
Instead of introducing a new type, we could modify the existing
IngressMessageId
so that it uniquely identifies ingress messages.disadvantages over the proposed solution:
IngressMessageId
would be more expensive and we currently do it quite oftenadvantages over the proposed solution: