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

Make StorageTransactionCache clonable if type parameters permit #38

Conversation

ekovalev
Copy link
Member

We may need to be able to clone the associated RuntimeApi instance while cloning the block builder used to propose a block in order to be able to run the pseudo-inherent at the end of a block with a timeout in a separate thread on top of the overlay changes made by the extrinsics in this block, while keeping the old block builder intact in case we need to fall back to it if the timeout expires.
The RuntimeApi includes a reference to the sp_state_machine::StorageTransactionCache which doesn't implement Clone by default due to its dependent types, but in the real node all the type parameters involved are clonable.

@@ -197,6 +197,18 @@ impl<Transaction, H: Hasher> Default for StorageTransactionCache<Transaction, H>
}
}

impl<Transaction, H: Hasher> Clone for StorageTransactionCache<Transaction, H>
Copy link
Member

Choose a reason for hiding this comment

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

Seems you can derive it

@ekovalev ekovalev merged commit a6b4202 into gear-polkadot-v0.9.41-canary-no-sandbox Sep 13, 2023
1 check failed
@ekovalev ekovalev deleted the ek-clonable-storage-transaction-cache branch September 13, 2023 15:05
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.

2 participants