Skip to content

Commit

Permalink
fix(pop-api): read_state uses RelayChainDataProvider (#34)
Browse files Browse the repository at this point in the history
* fix(pop-api): read_state uses RelayChainDataProvider

* style: format

---------

Co-authored-by: Frank Bell <frank@r0gue.io>
  • Loading branch information
al3mart and evilrobot-01 authored Mar 10, 2024
1 parent bf9d70f commit 308305d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions runtime/src/extensions.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use cumulus_pallet_parachain_system::RelaychainDataProvider;
use cumulus_primitives_core::relay_chain::BlockNumber;
use frame_support::{
dispatch::{GetDispatchInfo, RawOrigin},
Expand All @@ -13,7 +14,10 @@ use pop_api_primitives::{
CollectionId, ItemId,
};
use sp_core::crypto::UncheckedFrom;
use sp_runtime::{traits::Dispatchable, DispatchError};
use sp_runtime::{
traits::{BlockNumberProvider, Dispatchable},
DispatchError,
};
use sp_std::{boxed::Box, vec::Vec};
use xcm::{
latest::{prelude::*, OriginKind::SovereignAccount},
Expand Down Expand Up @@ -210,7 +214,7 @@ where
ParachainSystemKeys::LastRelayChainBlockNumber => {
env.charge_weight(T::DbWeight::get().reads(1_u64))?;
let relay_block_num: BlockNumber =
cumulus_pallet_parachain_system::Pallet::<T>::last_relay_block_number();
RelaychainDataProvider::<T>::current_block_number();
log::debug!(
target:LOG_TARGET,
"{} last relay chain block number is: {:?}.", LOG_PREFIX, relay_block_num
Expand Down Expand Up @@ -608,7 +612,7 @@ mod tests {
new_test_ext().execute_with(|| {
let _ = env_logger::try_init();

let (wasm_binary, _) = load_wasm_module::<Runtime>("../contracts/pop-api-examples/read-runtime-state/target/ink/pop_api_extension_demo.wasm").unwrap();
let (wasm_binary, _) = load_wasm_module::<Runtime>("../contracts/pop-api-examples/read-runtime-state/target/ink/pop_api_read_state_example.wasm").unwrap();

let init_value = 100;

Expand Down

0 comments on commit 308305d

Please sign in to comment.