-
Notifications
You must be signed in to change notification settings - Fork 698
Feat/signer two phase commit impl #6319
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
base: develop
Are you sure you want to change the base?
Feat/signer two phase commit impl #6319
Conversation
Signed-off-by: Jacinta Ferrant <[email protected]>
Signed-off-by: Jacinta Ferrant <[email protected]>
Signed-off-by: Jacinta Ferrant <[email protected]>
Signed-off-by: Jacinta Ferrant <[email protected]>
…e throughout Signed-off-by: Jacinta Ferrant <[email protected]>
Signed-off-by: Jacinta Ferrant <[email protected]>
Signed-off-by: Jacinta Ferrant <[email protected]>
… into feat/signer-two-phase-commit-impl
… into feat/signer-two-phase-commit-impl
… into feat/signer-two-phase-commit-impl
Signed-off-by: Jacinta Ferrant <[email protected]>
… into feat/signer-two-phase-commit-impl
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.
LGTM! Just a few nits. I found your logic very easy to follow
Signed-off-by: Jacinta Ferrant <[email protected]>
Signed-off-by: Jacinta Ferrant <[email protected]>
Signed-off-by: Jacinta Ferrant <[email protected]>
…lock Signed-off-by: Jacinta Ferrant <[email protected]>
bd04283
to
e304a48
Compare
… than Signed-off-by: Jacinta Ferrant <[email protected]>
Signed-off-by: Jacinta Ferrant <[email protected]>
… into feat/signer-two-phase-commit-impl
Signed-off-by: Jacinta Ferrant <[email protected]>
… wait for block commit at correct height Signed-off-by: Jacinta Ferrant <[email protected]>
…n block Signed-off-by: Jacinta Ferrant <[email protected]>
Signed-off-by: Jacinta Ferrant <[email protected]>
d46d4ec
to
0375c72
Compare
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.
Overall LGTM! Just one tiny nit about some debug logs
Signed-off-by: Jacinta Ferrant <[email protected]>
… into feat/signer-two-phase-commit-impl
Signed-off-by: Jacinta Ferrant <[email protected]>
… into feat/signer-two-phase-commit-impl
Signed-off-by: Jacinta Ferrant <[email protected]>
|
||
/// Used by get_block_pre_committers | ||
static CREATE_BLOCK_PRE_COMMITS_BY_SIGHASH_INDEX: &str = r#" | ||
CREATE INDEX idx_block_pre_commits_by_sighash ON block_pre_commits(signer_signature_hash); |
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.
I'm wondering if this index is really needed (and could be removed to save disk space).
Looking at our queries, they are already covered by the composite index created by the PRIMARY KEY (signer_signature_hash, signer_addr)
.
Since signer_signature_hash
is the leftmost column of the primary key, it efficiently supports lookups like those in get_block_pre_committers(..) without requiring an extra index.
Did you find a scenario where the extra index might actually provide a benefit?
// Make sure the sender is part of our signing set | ||
let is_valid_sender = self.signer_addresses.iter().any(|addr| { | ||
// it only matters that the address hash bytes match | ||
stacker_address.bytes() == addr.bytes() | ||
}); | ||
|
||
if !is_valid_sender { | ||
debug!("{self}: Received pre-commit message from an unknown sender {stacker_address:?}. Will not store."); | ||
return; | ||
} |
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.
sanity check:
Could this kind of control be applied to any message a Signer receives from another Signer?
If it makes sense, we might consider generalizing it by moving it into handle_event_match(..)
.
Closes #6099