-
Notifications
You must be signed in to change notification settings - Fork 246
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
Simplify the consensus chain storage proof in FP by gathering necessary storage into one place #3281
Comments
I think I'm a bit lost here, is the code here something like: let fraud_proof_data = FraudProofData {
block_randomness: StorageKeyProvider::storage_key(FraudProofStorageKeyRequest::BlockRandomness),
...
};
In subspace/crates/sp-domains-fraud-proof/src/fraud_proof.rs Lines 318 to 352 in bdf31b8
|
What I mean is something like: pub struct FraudfProofDataStorageProof(StorageProof);
impl_storage_proof!(FraudfProofDataStorageProof);
impl<Block: BlockT> BasicStorageProof<Block> for FraudfProofDataStorageProof {
type StorageValue = FraudfProofData;
fn storage_key_request(_key: Self::Key) -> FraudProofStorageKeyRequest<NumberFor<Block>> {
FraudProofStorageKeyRequest::FraudfProofData
}
} and |
This is looking a bit complicated, I might start with one of the simpler proofs first. |
I've done some analysis here, and I think the It's also possible to merge the storage for The other proofs are either:
They're also stored using different keys, which might complicate things. |
Here's a copy of my notes for the successful bundles proof. We should consider merging this fraud proof data, if the savings on fraud proof generation outweigh the data duplication.
|
Let's leave |
I'm lost at this stage, I can't work out how to get the value of the Should I make Or is there some other way to call code that needs impl<T: pallet_domains::Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
fn on_finalize(_: BlockNumberFor<T>) {
let block_randomness = pallet_subspace::BlockRandomness::<T: pallet_subspace::Config>::get()
.expect("randomness is always set on initialize; qed"); Here's my draft branch, I'm stuck on commit 1c563d3. |
Yes, that is what I expected, and it already exists: subspace/crates/pallet-domains/src/lib.rs Lines 382 to 383 in 3d5483e
|
subspace/crates/pallet-domains/src/lib.rs Line 56 in 3d5483e
Which has methods that provide access to:
So getting access to |
Not necessary, the subspace/crates/sp-domains-fraud-proof/src/verification.rs Lines 82 to 85 in 3d5483e
which is identical to subspace/crates/pallet-domains/src/lib.rs Lines 2719 to 2723 in 3d5483e
so we can just store the The transaction fee should be something similar where we don't need subspace/crates/sp-domains-fraud-proof/src/storage_proof.rs Lines 512 to 529 in 3d5483e
|
Should they be combined into the shared storage? What should the key be? We also use |
We should use
The We probably should not put the runtime code in |
Tasks
Combine:
Cleanups:
CreateInherentDataProvider
: Fix bug in fraud proof transaction fee value, and combine storage #3320 (review)Description
Atm, there are many consensus chain storage proofs used by different fraud proof, see:
subspace/crates/sp-domains-fraud-proof/src/storage_proof.rs
Lines 55 to 67 in cd44905
And we need to generate and verify each of them during fraud proof generation & verification, to simplify that we can gather all the small storage into one place which does introduce duplicated storage but will simplify things a lot (and even remove some of the proof data) as we only need to generate/verify one storage proof to cover many proof data.
For example:
Then the storage proof of
FraudProofData
can replace many storage proofs usage in https://github.com/autonomys/subspace/blob/main/crates/sp-domains-fraud-proof/src/fraud_proof.rscc @teor2345
The text was updated successfully, but these errors were encountered: