-
Notifications
You must be signed in to change notification settings - Fork 990
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
Kernel sum and MMR sizes in block header #1163
Kernel sum and MMR sizes in block header #1163
Conversation
Blocks are now summed and validated based on their own totals and not the totals since genesis. This allows to get rid of BlockSum and simplified the setting of a new block's roots, kernel sum and MMR sizes. Fixes #1163
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.
Looks great. A lot simpler now in addition to fixing the fast sync vulnerability.
@@ -125,6 +127,13 @@ pub struct BlockHeader { | |||
/// We can derive the kernel offset sum for *this* block from | |||
/// the total kernel offset of the previous block header. | |||
pub total_kernel_offset: BlindingFactor, | |||
/// Total accumulated sum of kernel commitments since genesis block. | |||
/// Should always equal the UTXO commitment sum minus supply. | |||
pub total_kernel_sum: Commitment, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -576,24 +596,17 @@ impl Block { | |||
|
|||
// now sum the kernel_offsets up to give us | |||
// an aggregate offset for the entire block | |||
let total_kernel_offset = { | |||
kernel_offsets.push(prev.total_kernel_offset); | |||
let total_kernel_offset = committed::sum_kernel_offsets(kernel_offsets, vec![])?; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
)?; | ||
// take the kernel offset for this block (block offset minus previous) and | ||
// verify outputs and kernel sums | ||
let block_kernel_offset = if self.header.total_kernel_offset() == prev_kernel_offset.clone() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Maybe done as a separate PR but I think we can get rid of |
Also I think the changes specific to fixing #1165 can be backported to master as they don't depend on the header changes? |
You're right on both counts. And yes, I think removing |
Adds the kernel sum total and output and kernel MMR sizes to block headers. This allows validation of all intermediate kernel roots during fast sync. Also allows getting rid of the
BlockSum
index.Fixes #1162, #1107, and #1165.