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

Handle account sequence correctly in bridge #1170

Merged
merged 2 commits into from
Jun 10, 2024
Merged

Conversation

Raneet10
Copy link
Member

@Raneet10 Raneet10 commented Jun 7, 2024

Description

The job of the broadcaster component is, as the name suggests, to broadcast txs to tendermint. The ante handler is executed during checkTx (invoked by tendermint) and enforces some sanity checks on the tx sent (ensuring enough balance, correct signature, etc.) and at successful verification, increments the account sequence (akin to nonce).
If any of the checks were to fail, the appropriate error code is baked in sdk.TxResponse.

Currently, the broadcaster doesn't account for a failed sanity clause (and only checks for errors that pop up during the broadcast itself). This results in an incorrect increment of the bridge's "cached" account sequence and hence causes mismatch with the DB. This PR aims to fix this.

Changes

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)
  • Changes only for a subset of nodes

Checklist

  • I have added at least 2 reviewer or the whole pos-v1 team
  • I have added sufficient documentation in code
  • I will be resolving comments - if any - by pushing each fix in a separate commit and linking the commit hash in the comment reply

Testing

  • I have added unit tests
  • I have added tests to CI
  • I have tested this code manually on local environment
  • I have tested this code manually on remote devnet using express-cli
  • I have tested this code manually on mumbai or amoy
  • I have created new e2e tests into express-cli

@Raneet10 Raneet10 requested a review from a team June 7, 2024 12:26
Copy link
Contributor

@cffls cffls left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for adding the tests.

bridge/setu/broadcaster/broadcaster_test.go Outdated Show resolved Hide resolved
helper/test_helpers.go Show resolved Hide resolved
helper/test_helpers.go Show resolved Hide resolved
bridge/setu/broadcaster/broadcaster.go Show resolved Hide resolved
bridge/setu/broadcaster/broadcaster_test.go Outdated Show resolved Hide resolved
helper/util.go Outdated Show resolved Hide resolved
@Raneet10 Raneet10 merged commit d71283f into develop Jun 10, 2024
8 of 9 checks passed
@Raneet10 Raneet10 deleted the raneet10/acc-seq-fix branch June 10, 2024 11:55
@marcello33 marcello33 restored the raneet10/acc-seq-fix branch June 19, 2024 12:33
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.

3 participants