Skip to content

Commit a6b53fa

Browse files
committed
feat: merge additional_relay_state_keys into relay_proof_request
1 parent 9a86b41 commit a6b53fa

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

cumulus/client/consensus/aura/src/collator.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use cumulus_client_consensus_common::{
3333
use cumulus_client_parachain_inherent::{ParachainInherentData, ParachainInherentDataProvider};
3434
use cumulus_primitives_core::{
3535
relay_chain::Hash as PHash, DigestItem, ParachainBlockData, PersistedValidationData,
36-
RelayProofRequest,
36+
RelayProofRequest, RelayStorageKey,
3737
};
3838
use cumulus_relay_chain_interface::RelayChainInterface;
3939
use sc_client_api::BackendTransaction;
@@ -178,9 +178,17 @@ where
178178
parent_hash: Block::Hash,
179179
timestamp: impl Into<Option<Timestamp>>,
180180
relay_parent_descendants: Option<RelayParentData>,
181-
relay_proof_request: RelayProofRequest,
181+
mut relay_proof_request: RelayProofRequest,
182182
collator_peer_id: PeerId,
183183
) -> Result<(ParachainInherentData, InherentData), Box<dyn Error + Send + Sync + 'static>> {
184+
// Add additional_relay_state_keys
185+
let additional_relay_state_keys: Vec<Vec<u8>> = Vec::new();
186+
187+
// Merge collator-side keys with runtime-requested keys
188+
relay_proof_request
189+
.keys
190+
.extend(additional_relay_state_keys.into_iter().map(RelayStorageKey::Top));
191+
184192
let paras_inherent_data = ParachainInherentDataProvider::create_at(
185193
relay_parent,
186194
&self.relay_client,
@@ -189,7 +197,6 @@ where
189197
relay_parent_descendants
190198
.map(RelayParentData::into_inherent_descendant_list)
191199
.unwrap_or_default(),
192-
Vec::new(),
193200
relay_proof_request,
194201
collator_peer_id,
195202
)

cumulus/client/parachain-inherent/src/lib.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ async fn collect_relay_storage_proof(
148148
relay_parent: PHash,
149149
include_authorities: bool,
150150
include_next_authorities: bool,
151-
additional_relay_state_keys: Vec<Vec<u8>>,
152151
relay_proof_request: RelayProofRequest,
153152
) -> Option<StorageProof> {
154153
// Get static keys that are always needed
@@ -161,13 +160,6 @@ async fn collect_relay_storage_proof(
161160
)
162161
.await?;
163162

164-
// Add additional_relay_state_keys
165-
let unique_keys: Vec<Vec<u8>> = additional_relay_state_keys
166-
.into_iter()
167-
.filter(|key| !all_top_keys.contains(key))
168-
.collect();
169-
all_top_keys.extend(unique_keys);
170-
171163
// Group requested keys by storage type
172164
let RelayProofRequest { keys } = relay_proof_request;
173165
let mut child_keys: std::collections::BTreeMap<Vec<u8>, Vec<Vec<u8>>> =
@@ -242,7 +234,6 @@ impl ParachainInherentDataProvider {
242234
validation_data: &PersistedValidationData,
243235
para_id: ParaId,
244236
relay_parent_descendants: Vec<RelayHeader>,
245-
additional_relay_state_keys: Vec<Vec<u8>>,
246237
relay_proof_request: RelayProofRequest,
247238
collator_peer_id: PeerId,
248239
) -> Option<ParachainInherentData> {
@@ -268,7 +259,6 @@ impl ParachainInherentDataProvider {
268259
relay_parent,
269260
!relay_parent_descendants.is_empty(),
270261
include_next_authorities,
271-
additional_relay_state_keys,
272262
relay_proof_request,
273263
)
274264
.await?;

0 commit comments

Comments
 (0)