-
Notifications
You must be signed in to change notification settings - Fork 247
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
Move InvalidExtrinsicsRootProof storage so it is easier to combine later #3312
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -414,16 +414,27 @@ impl MaybeDomainRuntimeUpgradedProof { | |
} | ||
|
||
#[derive(Clone, Debug, Decode, Encode, Eq, PartialEq, TypeInfo)] | ||
pub struct DomainInherentExtrinsicDataProof { | ||
pub struct InvalidExtrinsicsDataProof { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Non-blocker but it may be worth having |
||
/// Block randomness storage proof | ||
pub block_randomness_proof: BlockRandomnessProof, | ||
|
||
/// Block timestamp storage proof | ||
pub timestamp_proof: TimestampStorageProof, | ||
|
||
/// Optional domain runtime code upgrade storage proof | ||
pub maybe_domain_runtime_upgrade_proof: MaybeDomainRuntimeUpgradedProof, | ||
|
||
/// Boolean indicating if dynamic cost of storage was used (but as a storage proof) | ||
pub dynamic_cost_of_storage_proof: DynamicCostOfStorageProof, | ||
|
||
/// Transaction fee storage proof | ||
pub consensus_chain_byte_fee_proof: ConsensusTransactionByteFeeProof, | ||
|
||
/// Change in the allowed chains storage proof | ||
pub domain_chain_allowlist_proof: DomainChainsAllowlistUpdateStorageProof, | ||
pub domain_sudo_call_proof: DomainSudoCallStorageProof, | ||
} | ||
|
||
impl DomainInherentExtrinsicDataProof { | ||
impl InvalidExtrinsicsDataProof { | ||
#[cfg(feature = "std")] | ||
#[allow(clippy::let_and_return)] | ||
pub fn generate< | ||
|
@@ -437,6 +448,8 @@ impl DomainInherentExtrinsicDataProof { | |
block_hash: Block::Hash, | ||
maybe_runtime_id: Option<RuntimeId>, | ||
) -> Result<Self, GenerationError> { | ||
let block_randomness_proof = | ||
BlockRandomnessProof::generate(proof_provider, block_hash, (), storage_key_provider)?; | ||
let timestamp_proof = | ||
TimestampStorageProof::generate(proof_provider, block_hash, (), storage_key_provider)?; | ||
let maybe_domain_runtime_upgrade_proof = MaybeDomainRuntimeUpgradedProof::generate( | ||
|
@@ -464,20 +477,13 @@ impl DomainInherentExtrinsicDataProof { | |
storage_key_provider, | ||
)?; | ||
|
||
let domain_sudo_call_proof = DomainSudoCallStorageProof::generate( | ||
proof_provider, | ||
block_hash, | ||
domain_id, | ||
storage_key_provider, | ||
)?; | ||
|
||
Ok(Self { | ||
block_randomness_proof, | ||
timestamp_proof, | ||
maybe_domain_runtime_upgrade_proof, | ||
dynamic_cost_of_storage_proof, | ||
consensus_chain_byte_fee_proof, | ||
domain_chain_allowlist_proof, | ||
domain_sudo_call_proof, | ||
}) | ||
} | ||
|
||
|
@@ -487,6 +493,12 @@ impl DomainInherentExtrinsicDataProof { | |
runtime_id: RuntimeId, | ||
state_root: &Block::Hash, | ||
) -> Result<DomainInherentExtrinsicData, VerificationError> { | ||
let block_randomness = <BlockRandomnessProof as BasicStorageProof<Block>>::verify::<SKP>( | ||
self.block_randomness_proof.clone(), | ||
(), | ||
state_root, | ||
)?; | ||
|
||
let timestamp = <TimestampStorageProof as BasicStorageProof<Block>>::verify::<SKP>( | ||
self.timestamp_proof.clone(), | ||
(), | ||
|
@@ -523,18 +535,14 @@ impl DomainInherentExtrinsicDataProof { | |
state_root, | ||
)?; | ||
|
||
let domain_sudo_call = <DomainSudoCallStorageProof as BasicStorageProof<Block>>::verify::< | ||
SKP, | ||
>( | ||
self.domain_sudo_call_proof.clone(), domain_id, state_root | ||
)?; | ||
|
||
Ok(DomainInherentExtrinsicData { | ||
block_randomness, | ||
timestamp, | ||
maybe_domain_runtime_upgrade, | ||
consensus_transaction_byte_fee, | ||
domain_chain_allowlist, | ||
maybe_sudo_runtime_call: domain_sudo_call.maybe_call, | ||
// Populated by caller | ||
maybe_sudo_runtime_call: None, | ||
}) | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR contains a host function change, which we are planning to revert in #3314