-
Notifications
You must be signed in to change notification settings - Fork 956
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
Introduce baseline types required to implement validator set updates #273
Merged
sug0
merged 49 commits into
eth-bridge-integration
from
tiago/ethbridge/valset-update-types
Aug 10, 2022
Merged
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
d6d0433
Add validator set update vext mod
sug0 8eb6e03
Add a TODO
sug0 2dec131
Add tiny-keccak as a dep
sug0 a30cf4f
Validator set update vote extension
sug0 e060784
Return a list of validator addresses and voting powers
sug0 0732bb8
Merge branch 'eth-bridge-integration' into tiago/ethbridge/valset-upd…
sug0 a46cce1
Normalize the voting powers to 2^32
sug0 b6a3c5d
Merge branch 'eth-bridge-integration' into tiago/ethbridge/valset-upd…
sug0 61030d8
WIP: Get keccak hash of validator set update vote extension
sug0 26ab743
Encode test
sug0 27016cd
Get keccak hash of validator set update vote extension
sug0 16c4d4f
Remove AbiEncodePacked
sug0 32b002e
Remove TODO
sug0 ce38f19
Add VextDigest
sug0 c14c8f2
WIP: Ethereum address wrapper type
sug0 944f8c2
Add Borsh serialization for the Ethereum address wrapper
sug0 791cce8
WIP: VextDigest decompress
sug0 768eec1
Decompress validator set update vote extension digest
sug0 8305590
Fix make clippy-abci-plus-plus
sug0 b0ff8a5
Sign stub
sug0 52b6d57
Add VoteExtension type
sug0 5abd8e7
Add VoteExtensionDigest
sug0 dc02085
Rename EncodedData to HexString
sug0 20499f5
Add test docstring
sug0 4f205f5
Add abi_params() stub
sug0 dfa21a9
Make Signed use a generic serialization method
sug0 9e1e32d
WIP: Sign Vext
sug0 d904238
Make tag mod private
sug0 a8ae428
Fix docstrings
sug0 9e473ef
Tighten trait constraints on Signed
sug0 e09944c
Improve Signed docstring
sug0 20cba91
Fix typo in tag enum
sug0 6bb7b41
WIP: Verify validator set update vote extension signature
sug0 4a78619
Refactor voting powers
sug0 adb9c8e
Ethereum keccak hash of signed message
sug0 d0381ab
Remove smart contract version from the hash calc
sug0 afc35d7
Sign validator set update
sug0 69c4fb5
Verify signature of validator set update
sug0 a5a2cde
Add VoteExtensionDigest::get_protocol_txs()
sug0 d72e25e
Rename get_protocol_txs to into_protocol_txs
sug0 6e4a437
Add a TODO
sug0 c7f940f
Revert "Add VoteExtensionDigest::get_protocol_txs()"
sug0 0e13722
Update Cargo.lock
sug0 3ee213d
Manually implement Eq for Signed
sug0 01d0423
Update shared/src/types/vote_extensions/validator_set_update.rs
sug0 445bbfd
Remove duplicated type def
sug0 3f440f9
Use KeccakHash wrapper type instead of raw array
sug0 97021f8
Improve Signed API
sug0 6b442ca
Improve docstring of a Vext field
sug0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ impl From<u64> for Uint { | |
Eq, | ||
PartialOrd, | ||
Ord, | ||
Hash, | ||
BorshSerialize, | ||
BorshDeserialize, | ||
BorshSchema, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,29 @@ | ||
//! This module contains types necessary for processing vote extensions. | ||
|
||
pub mod ethereum_events; | ||
pub mod validator_set_update; | ||
|
||
// TODO: add a `VoteExtension` type | ||
// | ||
// ```ignore | ||
// pub struct VoteExtension { | ||
// pub ethereum_events: Signed<ethereum_events::Vext>, | ||
// pub validator_set_update: Option<validator_set_update::EthSignedVext>, | ||
// } | ||
// ``` | ||
use crate::proto::Signed; | ||
|
||
// TODO: add a `VoteExtensionDigest` type; this will contain | ||
// the values to be proposed, for a quorum of Ethereum events | ||
// vote extensions, and a separate quorum of validator set update | ||
// vote extensions | ||
// | ||
// ```ignore | ||
// pub struct VoteExtensionDigest { | ||
// pub ethereum_events: ethereum_events::VextDigest, | ||
// pub validator_set_update: Option<validator_set_update::VextDigest>, | ||
// } | ||
// ``` | ||
// | ||
// from a `VoteExtensionDigest` we yield two signed `ProtocolTxType` values, | ||
// one of `ProtocolTxType::EthereumEvents` and the other of | ||
// `ProtocolTxType::ValidatorSetUpdate` | ||
/// This type represents the data we pass to the extension of | ||
/// a vote at the PreCommit phase of Tendermint. | ||
pub struct VoteExtension { | ||
/// Vote extension data related with Ethereum events. | ||
pub ethereum_events: Signed<ethereum_events::Vext>, | ||
/// Vote extension data related with validator set updates. | ||
pub validator_set_update: Option<validator_set_update::SignedVext>, | ||
} | ||
|
||
/// The digest of the signatures from different validators | ||
/// in [`VoteExtension`] instances. | ||
/// | ||
/// From a [`VoteExtensionDigest`] we yield two signed | ||
/// [`crate::types::transaction::protocol::ProtocolTxType`] transactions: | ||
/// - A `ProtocolTxType::EthereumEvents` tx, and | ||
/// - A `ProtocolTxType::ValidatorSetUpdate` tx | ||
pub struct VoteExtensionDigest { | ||
/// The digest of Ethereum events vote extension signatures. | ||
pub ethereum_events: ethereum_events::VextDigest, | ||
/// The digest of validator set updates vote extension signatures. | ||
pub validator_set_update: Option<validator_set_update::VextDigest>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It'd be good if we could bound
S
here (if it's possible?) so that it's impossible to construct aSigned
with an invalid tag, something likeThere 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.
we already tighten
Signed
at the impl block starting on line 148. you can only verify signatures ofSigned
instances with a tag which implementsSignedSerialize
. you can't use the struct itself to instantiate new values, since it has a private field, but you can useSigned::new_from
instead. regardless, we hit the same wall, this instance can't do jack ifS
does not implementSignedSerialize
.tl;dr I don't think this is an issue