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

Wrapper tx replay protection #178

Closed
tzemanovic opened this issue Nov 29, 2021 · 4 comments
Closed

Wrapper tx replay protection #178

tzemanovic opened this issue Nov 29, 2021 · 4 comments
Assignees

Comments

@tzemanovic
Copy link
Member

tzemanovic commented Nov 29, 2021

As noted in https://github.com/anoma/anoma/blob/625bab46c32da6aeb35418869974bfb1ac98cd3e/docs/src/specs/ledger.md: "DKG transactions will include replay protection (this is because we can simply check a counter against the source (i.e. gas payer) of the transaction before the transactions order is committed to by the DKG protocol, which could affect the expected counter order for sources with multiple queued transactions)".

We should add reply protection to the wrapper tx. This can simply be a counter in implicit accounts that is checked and incremented by the wrapper transactions.

┆Issue is synchronized with this Asana task by Unito

@tzemanovic
Copy link
Member Author

tzemanovic commented Nov 29, 2021

The replay protection should probably be implemented in the protocol as it doesn't need to involve any VP. The counter field should then be added to the wrapper tx. For a tx to be valid, it should match the current value of the counter stored for the source implicit account in the ledger. To submit multiple txs from the same account at once, we should allow to explicitly set the --counter for any tx. If not specified, the client can read (default to 0, if no counter is set yet) and use the current value from the ledger.

@tzemanovic
Copy link
Member Author

with anoma/anoma#676, it should be possible to auto-increment the counter so the user never has to specify it explicitly

@batconjurer
Copy link
Member

So after some discussion, we came to the following idea:

  • In each the storage addressed to each implicit account, we keep a counter.
  • Wrapper txs will now include a counter field
  • During process proposal, we check in the wrapper txs that the counter field is >= than the counter in storage.
  • During finalize block, in the write ahead log, for each tx, we take the max of the new counter for the associated implicit acount and the tx counter field.

@sync-by-unito sync-by-unito bot closed this as completed Feb 3, 2022
@juped juped reopened this Feb 3, 2022
@tzemanovic tzemanovic transferred this issue from anoma/anoma Jul 12, 2022
@arafey arafey added enhancement New feature or request namada security labels Aug 19, 2022
@grarco grarco moved this from Todo to WIP in Namada-Old Sep 26, 2022
@grarco
Copy link
Contributor

grarco commented Jan 12, 2023

Closed in favor of #1009

@grarco grarco closed this as completed Jan 12, 2023
@github-project-automation github-project-automation bot moved this from WIP to Tested in Devnet in Namada-Old Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Tested in Devnet
Development

No branches or pull requests

5 participants