Skip to content

Commit efb1d32

Browse files
authored
Fix tests failing in main (#69)
1 parent 9df5da6 commit efb1d32

19 files changed

Lines changed: 124 additions & 43 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pallets/author-mapping/src/mock.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ impl ExtBuilder {
172172

173173
pallet_balances::GenesisConfig::<Runtime> {
174174
balances: self.balances,
175+
..Default::default()
175176
}
176177
.assimilate_storage(&mut t)
177178
.expect("Pallet balances storage can be assimilated");

pallets/foreign-asset-creator/src/mock.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ impl pallet_assets::Config for Test {
130130
type CallbackHandle = ();
131131
type WeightInfo = ();
132132
type RemoveItemsLimit = ConstU32<1000>;
133+
type Holder = ();
133134
pallet_assets::runtime_benchmarks_enabled! {
134135
type BenchmarkHelper = ();
135136
}
@@ -237,6 +238,7 @@ impl ExtBuilder {
237238

238239
pallet_balances::GenesisConfig::<Test> {
239240
balances: self.balances,
241+
..Default::default()
240242
}
241243
.assimilate_storage(&mut t)
242244
.expect("Pallet balances storage can be assimilated");

pallets/migrations/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ sp-core = { workspace = true }
2323
sp-io = { workspace = true }
2424
sp-runtime = { workspace = true }
2525
sp-std = { workspace = true }
26+
cumulus-primitives-core = { workspace = true }
2627

2728
# Benchmarks
2829
frame-benchmarking = { workspace = true, optional = true }

pallets/migrations/src/mock.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,31 @@ parameter_types! {
122122
pub const InstantAllowed: bool = false;
123123
}
124124

125+
// Taken from frame scheduller mock
126+
parameter_types! {
127+
pub BlockWeights: frame_system::limits::BlockWeights =
128+
frame_system::limits::BlockWeights::simple_max(
129+
Weight::from_parts(frame_support::weights::constants::WEIGHT_REF_TIME_PER_SECOND.saturating_mul(2),
130+
cumulus_primitives_core::relay_chain::MAX_POV_SIZE as u64),
131+
);
132+
}
133+
134+
parameter_types! {
135+
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * BlockWeights::get().max_block;
136+
}
137+
125138
impl pallet_scheduler::Config for Runtime {
126139
type RuntimeEvent = RuntimeEvent;
127140
type RuntimeOrigin = RuntimeOrigin;
128141
type PalletsOrigin = OriginCaller;
129142
type RuntimeCall = RuntimeCall;
130-
type MaximumWeight = ();
143+
type MaximumWeight = MaximumSchedulerWeight;
131144
type ScheduleOrigin = EnsureRoot<AccountId>;
132145
type MaxScheduledPerBlock = ();
133-
type WeightInfo = ();
146+
type WeightInfo = pallet_scheduler::weights::SubstrateWeight<Runtime>;
134147
type OriginPrivilegeCmp = EqualPrivilegeOnly; // TODO : Simplest type, maybe there is better ?
135148
type Preimages = ();
149+
type BlockNumberProvider = ();
136150
}
137151

138152
parameter_types! {

pallets/randomness/src/mock.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ impl ExtBuilder {
214214

215215
pallet_balances::GenesisConfig::<Test> {
216216
balances: self.balances,
217+
..Default::default()
217218
}
218219
.assimilate_storage(&mut t)
219220
.expect("Pallet balances storage can be assimilated");

pallets/relay-storage-roots/src/mock.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ impl ExtBuilder {
183183

184184
pallet_balances::GenesisConfig::<Test> {
185185
balances: self.balances,
186+
..Default::default()
186187
}
187188
.assimilate_storage(&mut t)
188189
.expect("Pallet balances storage can be assimilated");

precompiles/assets-erc20/src/mock.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ impl pallet_evm::Config for Runtime {
194194
type GasLimitStorageGrowthRatio = ();
195195
type Timestamp = Timestamp;
196196
type WeightInfo = pallet_evm::weights::SubstrateWeight<Runtime>;
197+
type CreateOriginFilter = ();
198+
type CreateInnerOriginFilter = ();
197199
}
198200

199201
type ForeignAssetInstance = pallet_assets::Instance1;
@@ -241,6 +243,7 @@ impl pallet_assets::Config<ForeignAssetInstance> for Runtime {
241243
type AssetIdParameter = AssetId;
242244
type CreateOrigin = AsEnsureOriginWithArg<EnsureNever<AccountId>>;
243245
type CallbackHandle = ();
246+
type Holder = ();
244247
pallet_assets::runtime_benchmarks_enabled! {
245248
type BenchmarkHelper = BenchmarkHelper;
246249
}
@@ -282,6 +285,7 @@ impl ExtBuilder {
282285

283286
pallet_balances::GenesisConfig::<Runtime> {
284287
balances: self.balances,
288+
..Default::default()
285289
}
286290
.assimilate_storage(&mut t)
287291
.expect("Pallet balances storage can be assimilated");

precompiles/assets-erc20/src/tests.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ fn approve() {
245245
value: 500.into(),
246246
},
247247
)
248-
.expect_cost(37024756)
248+
.expect_cost(30211756)
249249
.expect_log(log3(
250250
ForeignAssetId(0u128),
251251
SELECTOR_LOG_APPROVAL,
@@ -286,7 +286,7 @@ fn approve_saturating() {
286286
value: U256::MAX,
287287
},
288288
)
289-
.expect_cost(37024756)
289+
.expect_cost(30211756)
290290
.expect_log(log3(
291291
ForeignAssetId(0u128),
292292
SELECTOR_LOG_APPROVAL,
@@ -415,7 +415,7 @@ fn transfer() {
415415
value: 400.into(),
416416
},
417417
)
418-
.expect_cost(50509756) // 1 weight => 1 gas in mock
418+
.expect_cost(40921756) // 1 weight => 1 gas in mock
419419
.expect_log(log3(
420420
ForeignAssetId(0u128),
421421
SELECTOR_LOG_TRANSFER,
@@ -542,7 +542,7 @@ fn transfer_from() {
542542
value: 400.into(),
543543
},
544544
)
545-
.expect_cost(70172756) // 1 weight => 1 gas in mock
545+
.expect_cost(60468756) // 1 weight => 1 gas in mock
546546
.expect_log(log3(
547547
ForeignAssetId(0u128),
548548
SELECTOR_LOG_TRANSFER,
@@ -620,7 +620,7 @@ fn transfer_from_non_incremental_approval() {
620620
value: 500.into(),
621621
},
622622
)
623-
.expect_cost(37024756)
623+
.expect_cost(30211756)
624624
.expect_log(log3(
625625
ForeignAssetId(0u128),
626626
SELECTOR_LOG_APPROVAL,
@@ -643,7 +643,7 @@ fn transfer_from_non_incremental_approval() {
643643
value: 300.into(),
644644
},
645645
)
646-
.expect_cost(76042756)
646+
.expect_cost(61543756)
647647
.expect_log(log3(
648648
ForeignAssetId(0u128),
649649
SELECTOR_LOG_APPROVAL,
@@ -751,7 +751,7 @@ fn transfer_from_self() {
751751
value: 400.into(),
752752
},
753753
)
754-
.expect_cost(50509756) // 1 weight => 1 gas in mock
754+
.expect_cost(40921756) // 1 weight => 1 gas in mock
755755
.expect_log(log3(
756756
ForeignAssetId(0u128),
757757
SELECTOR_LOG_TRANSFER,
@@ -898,7 +898,7 @@ fn permit_valid() {
898898
s: H256::from(rs.s.b32()),
899899
},
900900
)
901-
.expect_cost(37023000)
901+
.expect_cost(30210000)
902902
.expect_log(log3(
903903
ForeignAssetId(0u128),
904904
SELECTOR_LOG_APPROVAL,
@@ -1007,7 +1007,7 @@ fn permit_valid_named_asset() {
10071007
s: H256::from(rs.s.b32()),
10081008
},
10091009
)
1010-
.expect_cost(37023000)
1010+
.expect_cost(30210000)
10111011
.expect_log(log3(
10121012
ForeignAssetId(0u128),
10131013
SELECTOR_LOG_APPROVAL,
@@ -1485,7 +1485,7 @@ fn permit_valid_with_metamask_signed_data() {
14851485
s: H256::from(s_real),
14861486
},
14871487
)
1488-
.expect_cost(37023000)
1488+
.expect_cost(30210000)
14891489
.expect_log(log3(
14901490
ForeignAssetId(1u128),
14911491
SELECTOR_LOG_APPROVAL,

precompiles/balances-erc20/src/mock.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ impl pallet_evm::Config for Runtime {
143143
type GasLimitStorageGrowthRatio = ();
144144
type Timestamp = Timestamp;
145145
type WeightInfo = pallet_evm::weights::SubstrateWeight<Runtime>;
146+
type CreateOriginFilter = ();
147+
type CreateInnerOriginFilter = ();
146148
}
147149

148150
// Configure a mock runtime to test the pallet.
@@ -205,6 +207,7 @@ impl ExtBuilder {
205207

206208
pallet_balances::GenesisConfig::<Runtime> {
207209
balances: self.balances,
210+
..Default::default()
208211
}
209212
.assimilate_storage(&mut t)
210213
.expect("Pallet balances storage can be assimilated");

0 commit comments

Comments
 (0)