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

Race condition of nonce mutation under failed DI STF execution #1990

Open
Kailai-Wang opened this issue Aug 5, 2023 · 1 comment
Open

Race condition of nonce mutation under failed DI STF execution #1990

Kailai-Wang opened this issue Aug 5, 2023 · 1 comment
Labels
D2-bug Something isn't working I2-medium should be completed within 10 working days Stale

Comments

@Kailai-Wang
Copy link
Collaborator

Context

This is a subtle bug.

Imagine we submit a DI request which will eventually fail when executing STF, the DI response will include Invalid TrustedOperationStatus. However, the nonce has been incremented already, but this state mutation will not take effect until the next sidechain block is produced.

It's not guaranteed which one would happen first, the return of DI response or the next block production. In fact, in most of the cases, the DI response will return first.

As a result, if you try to retrieve the nonce of the same request sender (e.g. if you want to construct another TrustedCallSigned), you'll get the old state (before increment), which will eventually cause the execution of the new request to fail due to nonce mismatch.

It's different from the happy path, where the DI will not return until the TOP is of status InSidechainBlock, which guarantees that the state (including the nonce) has been mutated.


✔️ Please set appropriate labels and assignees if applicable.

@Kailai-Wang Kailai-Wang added D2-bug Something isn't working I2-medium should be completed within 10 working days labels Aug 5, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Oct 5, 2023

❗ This issue is stale because it has been open for 60 days with no activity.
Please take proper action against it.
@litentry/parachain

@github-actions github-actions bot added the Stale label Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D2-bug Something isn't working I2-medium should be completed within 10 working days Stale
Projects
None yet
Development

No branches or pull requests

1 participant