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

fix: fix VN merkle root mismatch #220

Merged
merged 5 commits into from
Nov 25, 2022

Conversation

sdbondi
Copy link
Member

@sdbondi sdbondi commented Nov 24, 2022

Description

  • Fixes QC Merkle root mismatch
  • add borsh encoding consensus hasher and tari_bor crate, so that it does not have to depend on tari_template_abi
  • removed a number of panics
  • domain separated hashing
  • number of small fixes
  • updated integration tests

Motivation and Context

Relies on tari-project/tari#4952

Fixes #218

How Has This Been Tested?

Manually
Existing tests updated

applications/tari_validator_node/proto/dan/consensus.proto Outdated Show resolved Hide resolved
dan_layer/core/src/workers/hotstuff_waiter.rs Show resolved Hide resolved
dan_layer/core/src/workers/hotstuff_waiter.rs Outdated Show resolved Hide resolved
// .map_err(|_| HotStuffError::InvalidQuorumCertificate("invalid merkle proof".to_string()))?;
// }
let validator_node_root = self.epoch_manager.get_validator_node_merkle_root(qc.epoch()).await?;
for md in qc.validators_metadata() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Another future optimization: These merkleproofs can be combined into a single merkle proof before the QC is constructed. Then only one validation is needed

// )
// .map_err(|_| HotStuffError::InvalidQuorumCertificate("invalid merkle proof".to_string()))?;
// }
let validator_node_root = self.epoch_manager.get_validator_node_merkle_root(qc.epoch()).await?;
Copy link
Contributor

Choose a reason for hiding this comment

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

This value can also be cached by the epoch manager during scanning

fn sign(&self, challenge: &[u8]) -> Option<Signature> {
let (nonce, public_nonce) = create_key_pair();
let challenge = Self::create_challenge(&public_nonce, self.node_identity.public_key(), challenge);
let sig = Signature::sign(self.node_identity.secret_key().clone(), nonce, &*challenge).ok()?;
Copy link
Contributor

Choose a reason for hiding this comment

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

todo: change to sign_raw when tari_crypto is updated

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I want to update all the tari deps soon

@stringhandler stringhandler merged commit f8480a6 into tari-project:development Nov 25, 2022
sdbondi added a commit to mrnaveira/tari-dan that referenced this pull request Nov 28, 2022
* development:
  fix: db error when starting state sync fixes tari-project#225 (tari-project#227)
  feat: add template name to list templates + minor cleanups (tari-project#226)
  fix: remove handle new valid transaction check (tari-project#224)
  fix: vns should not store transactions for shards outside committee range (see issue tari-project#193) (tari-project#206)
  feat!: add is_mut field to function def (see issue tari-project#213) (tari-project#214)
  fix: fix VN merkle root mismatch (tari-project#220)
  feat: determine leader from payload (tari-project#221)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Merkle proofs do not match base layer
2 participants