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

feat(rs-drive-abci)!: commit and vote extensions signature verification #915

Merged
merged 20 commits into from
Apr 18, 2023

Conversation

lklimek
Copy link
Contributor

@lklimek lklimek commented Apr 14, 2023

Issue being fixed or feature implemented

We want to check if digital signatures returned by Tednerdash are valid.

What was done?

  1. Created Commit struct with verify_signature
  2. Fix: ignore empty signatures when comparing Withdrawal Txs
  3. Implemented verify_signatures() for WithdrawalTxs
  4. Implemented unit tests
  5. Companion PR: feat(proto): add sign_digest() to commit and vote extension rs-tenderdash-abci#20

How Has This Been Tested?

Added unit tests that test vectors generated in Tenderdash

Breaking Changes

Added new configuration option: CHAIN_ID

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

@lklimek lklimek marked this pull request as draft April 14, 2023 11:41
@lklimek lklimek requested a review from QuantumExplorer April 14, 2023 11:42
@lklimek lklimek changed the title feat(rs-drive-abci): verification of commi signature feat(rs-drive-abci)!: verification of commi signature Apr 14, 2023
@lklimek lklimek changed the title feat(rs-drive-abci)!: verification of commi signature feat(rs-drive-abci)!: verification of commit signature Apr 14, 2023
@lklimek lklimek changed the title feat(rs-drive-abci)!: verification of commit signature feat(rs-drive-abci)!: verification of commit and vote extension signatures Apr 17, 2023
@lklimek lklimek changed the title feat(rs-drive-abci)!: verification of commit and vote extension signatures feat(rs-drive-abci)!: commit and vote extensions signature verification Apr 17, 2023
@lklimek lklimek marked this pull request as ready for review April 17, 2023 15:28
@@ -150,7 +150,7 @@ pub struct PlatformConfig {
pub verify_sum_trees: bool,

/// The default quorum type
pub quorum_type: QuorumType,
pub quorum_type: String,
Copy link
Member

Choose a reason for hiding this comment

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

Why have this as a String?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because there is a bug in envy / serde, and flattened structs don't deserialize correctly into enums, ints, etc. softprops/envy#26

Comment on lines +416 to +423
let validation_result = received_withdrawals.verify_signatures(
&self.config.abci.chain_id,
self.config.quorum_type(),
quorum_hash,
height,
round,
validator_public_key,
);
Copy link
Member

Choose a reason for hiding this comment

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

I think this should return a validation result instead of a result

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Returning SimpleValidationResult, moved part of logic to received_withdrawals.verify_signatures

packages/rs-drive-abci/src/execution/engine.rs Outdated Show resolved Hide resolved
packages/rs-drive-abci/src/abci/withdrawal.rs Outdated Show resolved Hide resolved
@lklimek lklimek requested a review from QuantumExplorer April 18, 2023 09:47
@QuantumExplorer QuantumExplorer merged commit 56b8de9 into feat/abci_validation Apr 18, 2023
@QuantumExplorer QuantumExplorer deleted the feat/commit-validation branch April 18, 2023 12:15
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.

2 participants