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

Send a validator set update only once per epoch #725

Merged
merged 7 commits into from
Nov 7, 2022

Conversation

sug0
Copy link
Contributor

@sug0 sug0 commented Nov 2, 2022

Instead of spamming the chain with validator set update protocol txs, now we only send these once per epoch, at the second block height offset within the epoch.

@james-chf
Copy link
Contributor

james-chf commented Nov 2, 2022

Closes #492

@sug0
Copy link
Contributor Author

sug0 commented Nov 2, 2022

Closes #599 and #600

The related issues were #599 and #600, which are fixed on the branch
leading up to this commit.
Comment on lines +136 to +142
test-unit-debug:
$(debug-cargo) test \
$(TEST_FILTER) -- \
--skip e2e \
--nocapture \
-Z unstable-options --report-time

Copy link
Contributor

Choose a reason for hiding this comment

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

Re. call yday, this should be a separate PR (against main) as well/instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I can create a small PR for main

Comment on lines +599 to 611
fn can_send_validator_set_update(&self, _can_send: SendValsetUpd) -> bool {
// TODO: implement this method for ABCI++; should only be able to send
// a validator set update at the second block of an epoch
true
}

// handle genesis block corner case
if height == BlockHeight(1) {
#[cfg(not(feature = "abcipp"))]
fn can_send_validator_set_update(&self, can_send: SendValsetUpd) -> bool {
// when checking vote extensions in Prepare
// and ProcessProposal, we simply return true
if matches!(can_send, SendValsetUpd::AtPrevHeight) {
return true;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We can get rid of the SendValsetUpd now, we no longer need this context from the caller? can_send_validator_set_update can reason by itself using only the current decision height.

Copy link
Contributor Author

@sug0 sug0 Nov 4, 2022

Choose a reason for hiding this comment

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

we call can_send_validator_set_update from two places:

  • when we create a new vote extension at the ABCI commit phase, where we pass SendValsetUpd::Now as arg
  • when we verify vote extensions e.g. at prepare and process proposal, where we pass SendValsetUpd::AtPrevHeight as arg

we still need to distinguish between these two cases; a BlockHeight parameter wouldn't be enough, since we need SendValsetUpd::AtPrevHeight to always return true. no parameters wouldn't work either, because you need to check the prev height case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you could remove it altogether if we refactored prepare and process proposal to always accept validator set update protocol txs without a predicate check, but then it'd be kind of annoying to write this code again for ABCI++ if/when that happens...

Copy link
Contributor

Choose a reason for hiding this comment

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

you could remove it altogether if we refactored prepare and process proposal to always accept validator set update protocol txs without a predicate check, but then it'd be kind of annoying to write this code again for ABCI++ if/when that happens...

I would actually do this but since we're going to maintain our current abcipp code I guess it's fine

@sug0 sug0 requested a review from james-chf November 4, 2022 11:19
@james-chf
Copy link
Contributor

plz merge only after #723

@sug0 sug0 merged commit 6340944 into eth-bridge-integration Nov 7, 2022
@sug0 sug0 deleted the tiago/ethbridge/can-send-valset-upd branch November 7, 2022 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants