ChainSafe / ChainSafe/gossamer
Submitting a transaction on devnet for latest runtime cause a storage root mismatch error
- Dominant language
- Go
- Stars
- 454
- Forks
- 144
- PR merge metrics
- No merged PRs in 30d
Description
## Describe the bug
- When running multiple nodes on a local devnet on the 9.19 branch, submitting a transaction results in a root mismatch in the trie state. This happens in the maintainTransactionPool function in core/service when it calls the trieState function. We hit this panic case: https://github.com/ChainSafe/gossamer/blob/3a471d91f61c1ba10022ff11403b9cebb71c8666/dot/state/storage.go#L130
## Expected Behavior
- The roots should match
## Current Behavior
- Roots do not match
## Possible Solution
- This appears to be some kind of race condition where the root is being modified after retrieval. A possible solution that I tried is in core/service maintainTransactionPool, call TrieState to get a snapshot of the state and use it to set the runtime context before validating the transaction. This allowed for transactions to be submitted in a local devnet setting, however I found that this broke other things in the code base. Specifically, the maintainTransactionPool integration tests were failing due to invalid transactions with the ancient birth block error.
- From me exploring substrate code, I don't see where they would set the runtime context while maintaining the transaction pool, so I am not that confident that this is a fix. It should be considered as an option though when researching potential solutions to this.
Some links I think are relevant:
- https://github.com/paritytech/substrate/blob/8310936bd25519cee81abb01d2b164805f01bc25/client/transaction-pool/src/revalidation.rs#L230
- https://github.com/paritytech/substrate/blob/1d5abf01abafdb6c15bcd0172f5de09fd87c5fbf/client/transaction-pool/src/lib.rs#L614
- https://github.com/paritytech/substrate/blob/8310936bd25519cee81abb01d2b164805f01bc25/client/transaction-pool/src/revalidation.rs#L213
- https://github.com/paritytech/substrate/blob/8310936bd25519cee81abb01d2b164805f01bc25/client/transaction-pool/src/api.rs#L197
## To Reproduce
Steps to reproduce the behaviour:
1. Spin up a local devnet with the 9.19 (or higher) runtime
2. Submit a transaction to the network
Contributor guide
Assessment
This issue has not been assessed yet.