Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,12 @@ jobs:
- name: Cargo build
uses: ./.github/workflow-templates/cargo-build
- name: Upload runtimes
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v4
with:
name: runtimes
path: runtimes
- name: Upload binary
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v4
with:
name: moonkit-template
path: build/moonkit-template
Expand All @@ -228,7 +228,7 @@ jobs:
with:
features: "try-runtime,runtime-benchmarks"
- name: Upload binary
uses: actions/upload-artifact@v3.1.2
uses: actions/upload-artifact@v4
with:
name: moonkit-template-features
path: build/moonkit-template
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use cumulus_client_consensus_common::{
};
use cumulus_client_consensus_proposer::ProposerInterface;
use cumulus_primitives_core::{
relay_chain::{AsyncBackingParams, CoreIndex, vstaging::CoreState, Hash as PHash},
relay_chain::{vstaging::CoreState, AsyncBackingParams, CoreIndex, Hash as PHash},
CollectCollationInfo, ParaId,
};
use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface};
Expand Down
3 changes: 3 additions & 0 deletions precompiles/assets-erc20/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ impl pallet_evm::Config for Runtime {
type GasLimitStorageGrowthRatio = ();
type Timestamp = Timestamp;
type WeightInfo = pallet_evm::weights::SubstrateWeight<Runtime>;
type CreateOrigin = ();
type CreateInnerOrigin = ();
type SuicideQuickClearLimit = ();
}

type ForeignAssetInstance = pallet_assets::Instance1;
Expand Down
3 changes: 3 additions & 0 deletions precompiles/balances-erc20/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ impl pallet_evm::Config for Runtime {
type GasLimitStorageGrowthRatio = ();
type Timestamp = Timestamp;
type WeightInfo = pallet_evm::weights::SubstrateWeight<Runtime>;
type CreateOrigin = ();
type CreateInnerOrigin = ();
type SuicideQuickClearLimit = ();
}

// Configure a mock runtime to test the pallet.
Expand Down
6 changes: 5 additions & 1 deletion precompiles/batch/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ impl pallet_evm::Config for Runtime {
type GasLimitStorageGrowthRatio = ();
type Timestamp = Timestamp;
type WeightInfo = pallet_evm::weights::SubstrateWeight<Runtime>;
type CreateOrigin = ();
type CreateInnerOrigin = ();
type SuicideQuickClearLimit = ();
}

parameter_types! {
Expand Down Expand Up @@ -201,9 +204,10 @@ impl ExtBuilder {
let mut ext = sp_io::TestExternalities::new(t);
ext.execute_with(|| {
System::set_block_number(1);
pallet_evm::Pallet::<Runtime>::create_account(
let _ = pallet_evm::Pallet::<Runtime>::create_account(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this is in tests probably you should just unwrap here, or assert_ok if it works

Revert.into(),
hex_literal::hex!("1460006000fd").to_vec(),
None,
);
});
ext
Expand Down
5 changes: 3 additions & 2 deletions precompiles/batch/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ fn batch_not_callable_by_smart_contract() {
.execute_with(|| {
// "deploy" SC to alice address
let alice_h160: H160 = Alice.into();
pallet_evm::Pallet::<Runtime>::create_account(alice_h160, vec![10u8]);
let _ = pallet_evm::Pallet::<Runtime>::create_account(alice_h160, vec![10u8], None);

// succeeds if not called by SC, see `evm_batch_recursion_under_limit`
let input = PCall::batch_all {
Expand Down Expand Up @@ -1049,9 +1049,10 @@ fn batch_is_not_callable_by_dummy_code() {
.execute_with(|| {
// "deploy" dummy code to alice address
let alice_h160: H160 = Alice.into();
pallet_evm::Pallet::<Runtime>::create_account(
let _ = pallet_evm::Pallet::<Runtime>::create_account(
alice_h160,
[0x60, 0x00, 0x60, 0x00, 0xfd].to_vec(),
None,
);

// succeeds if called by dummy code, see `evm_batch_recursion_under_limit`
Expand Down
6 changes: 5 additions & 1 deletion precompiles/call-permit/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ impl pallet_evm::Config for Runtime {
type GasLimitStorageGrowthRatio = ();
type Timestamp = Timestamp;
type WeightInfo = pallet_evm::weights::SubstrateWeight<Runtime>;
type CreateOrigin = ();
type CreateInnerOrigin = ();
type SuicideQuickClearLimit = ();
}

parameter_types! {
Expand Down Expand Up @@ -187,9 +190,10 @@ impl ExtBuilder {
let mut ext = sp_io::TestExternalities::new(t);
ext.execute_with(|| {
System::set_block_number(1);
pallet_evm::Pallet::<Runtime>::create_account(
let _ = pallet_evm::Pallet::<Runtime>::create_account(
Revert.into(),
hex_literal::hex!("1460006000fd").to_vec(),
None,
);
});
ext
Expand Down
3 changes: 3 additions & 0 deletions precompiles/pallet-xcm/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ impl pallet_evm::Config for Runtime {
type GasLimitStorageGrowthRatio = ();
type Timestamp = Timestamp;
type WeightInfo = pallet_evm::weights::SubstrateWeight<Runtime>;
type CreateOrigin = ();
type CreateInnerOrigin = ();
type SuicideQuickClearLimit = ();
}

parameter_types! {
Expand Down
3 changes: 3 additions & 0 deletions precompiles/proxy/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ impl pallet_evm::Config for Runtime {
type GasLimitStorageGrowthRatio = ();
type Timestamp = Timestamp;
type WeightInfo = pallet_evm::weights::SubstrateWeight<Runtime>;
type CreateOrigin = ();
type CreateInnerOrigin = ();
type SuicideQuickClearLimit = ();
}

parameter_types! {
Expand Down
9 changes: 6 additions & 3 deletions precompiles/proxy/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,8 @@ fn fails_if_called_by_smart_contract() {
.build()
.execute_with(|| {
// Set code to Alice address as it if was a smart contract.
pallet_evm::Pallet::<Runtime>::create_account(H160::from(Alice), vec![10u8]);
let _ =
pallet_evm::Pallet::<Runtime>::create_account(H160::from(Alice), vec![10u8], None);

PrecompilesValue::get()
.prepare_test(
Expand Down Expand Up @@ -776,8 +777,10 @@ fn proxy_proxy_should_fail_if_called_by_smart_contract_for_a_non_eoa_account() {
.build()
.execute_with(|| {
// Set code to Alice & Bob addresses as if they are smart contracts.
pallet_evm::Pallet::<Runtime>::create_account(H160::from(Alice), vec![10u8]);
pallet_evm::Pallet::<Runtime>::create_account(H160::from(Bob), vec![10u8]);
let _ =
pallet_evm::Pallet::<Runtime>::create_account(H160::from(Alice), vec![10u8], None);
let _ =
pallet_evm::Pallet::<Runtime>::create_account(H160::from(Bob), vec![10u8], None);

// Bob allows Alice to make calls on his behalf
assert_ok!(RuntimeCall::Proxy(ProxyCall::add_proxy {
Expand Down
3 changes: 3 additions & 0 deletions precompiles/xcm-utils/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ impl pallet_evm::Config for Runtime {
type GasLimitStorageGrowthRatio = ();
type Timestamp = Timestamp;
type WeightInfo = pallet_evm::weights::SubstrateWeight<Runtime>;
type CreateOrigin = ();
type CreateInnerOrigin = ();
type SuicideQuickClearLimit = ();
}

parameter_types! {
Expand Down
3 changes: 2 additions & 1 deletion precompiles/xcm-utils/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ fn execute_fails_if_called_by_smart_contract() {
.build()
.execute_with(|| {
// Set code to Alice address as it if was a smart contract.
pallet_evm::Pallet::<Runtime>::create_account(H160::from(Alice), vec![10u8]);
let _ =
pallet_evm::Pallet::<Runtime>::create_account(H160::from(Alice), vec![10u8], None);

let xcm_to_execute = VersionedXcm::<()>::from(Xcm(vec![ClearOrigin])).encode();

Expand Down
69 changes: 34 additions & 35 deletions template/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImpo
use cumulus_client_consensus_proposer::Proposer;
use cumulus_client_network::RequireSecondedInBlockAnnounce;
use cumulus_client_parachain_inherent::{MockValidationDataInherentDataProvider, MockXcmConfig};
use cumulus_primitives_core::CollectCollationInfo;
#[allow(deprecated)]
use cumulus_client_service::{
prepare_node_config, start_relay_chain_tasks, DARecoveryProfile, StartRelayChainTasksParams,
Expand All @@ -31,7 +30,6 @@ use cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node_with_rpc;

use polkadot_primitives::UpgradeGoAhead;
use polkadot_service::CollatorPair;
use polkadot_primitives::UpgradeGoAhead;

// Substrate Imports
use futures::FutureExt;
Expand Down Expand Up @@ -142,14 +140,14 @@ pub fn new_partial(
// And sovereign nodes, so we create it anyway.
let select_chain = sc_consensus::LongestChain::new(backend.clone());

let transaction_pool = sc_transaction_pool::Builder::new(
task_manager.spawn_essential_handle(),
client.clone(),
config.role.is_authority().into(),
)
.with_options(config.transaction_pool.clone())
.with_prometheus(config.prometheus_registry())
.build();
let transaction_pool = sc_transaction_pool::Builder::new(
task_manager.spawn_essential_handle(),
client.clone(),
config.role.is_authority().into(),
)
.with_options(config.transaction_pool.clone())
.with_prometheus(config.prometheus_registry())
.build();

let block_import = ParachainBlockImport::new(client.clone(), backend.clone());

Expand All @@ -164,6 +162,7 @@ pub fn new_partial(
&task_manager.spawn_essential_handle(),
config.prometheus_registry().clone(),
false,
true,
)?;

Ok(PartialComponents {
Expand Down Expand Up @@ -191,9 +190,11 @@ async fn build_relay_chain_interface(
if let cumulus_client_cli::RelayChainMode::ExternalRpc(rpc_target_urls) =
collator_options.relay_chain_mode
{
build_minimal_relay_chain_node_with_rpc(polkadot_config,
parachain_config.prometheus_registry(),
task_manager, rpc_target_urls,
build_minimal_relay_chain_node_with_rpc(
polkadot_config,
parachain_config.prometheus_registry(),
task_manager,
rpc_target_urls,
)
.await
} else {
Expand Down Expand Up @@ -561,21 +562,20 @@ where
let hrmp_xcm_receiver = hrmp_xcm_receiver.clone();

let client_for_xcm = client_set_aside_for_cidp.clone();
let current_para_head = client_set_aside_for_cidp
.header(block)
.expect("Header lookup should succeed")
.expect("Header passed in as parent should be present in backend.");
let should_send_go_ahead = match client_set_aside_for_cidp
.runtime_api()
.collect_collation_info(block, &current_para_head)
{
Ok(info) => info.new_validation_code.is_some(),
Err(e) => {
log::error!("Failed to collect collation info: {:?}", e);
false
},
};

let current_para_head = client_set_aside_for_cidp
.header(block)
.expect("Header lookup should succeed")
.expect("Header passed in as parent should be present in backend.");
let should_send_go_ahead = match client_set_aside_for_cidp
.runtime_api()
.collect_collation_info(block, &current_para_head)
{
Ok(info) => info.new_validation_code.is_some(),
Err(e) => {
log::error!("Failed to collect collation info: {:?}", e);
false
}
};

async move {
let time = sp_timestamp::InherentDataProvider::from_system_time();
Expand All @@ -595,13 +595,12 @@ where
raw_downward_messages: downward_xcm_receiver.drain().collect(),
raw_horizontal_messages: hrmp_xcm_receiver.drain().collect(),
para_id: para_id.into(),
upgrade_go_ahead: should_send_go_ahead.then(|| {
log::info!(
"Detected pending validation code, sending go-ahead signal."
);
UpgradeGoAhead::GoAhead
}),

upgrade_go_ahead: should_send_go_ahead.then(|| {
log::info!(
"Detected pending validation code, sending go-ahead signal."
);
UpgradeGoAhead::GoAhead
}),
};

Ok((time, mocked_parachain))
Expand Down
4 changes: 2 additions & 2 deletions template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ impl frame_system::Config for Runtime {
type PreInherents = ();
type PostInherents = ();
type PostTransactions = ();
type ExtensionsWeightInfo = ();
type ExtensionsWeightInfo = ();
}

parameter_types! {
Expand Down Expand Up @@ -384,7 +384,7 @@ impl pallet_balances::Config for Runtime {
type RuntimeFreezeReason = ();
type FreezeIdentifier = ();
type MaxFreezes = ConstU32<0>;
type DoneSlashHandler = ();
type DoneSlashHandler = ();
}

parameter_types! {
Expand Down