Skip to content

Commit 1226778

Browse files
committed
Fixup.
1 parent d8aa114 commit 1226778

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

Cargo.lock

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

pallets/contracts/src/chain_extension.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,9 @@ where
504504
&mut self,
505505
env: ce::Environment<E, ce::InitState>,
506506
) -> ce::Result<ce::RetVal> {
507+
let ext_id = ((env.ext_id() as u32) << 16) + env.func_id() as u32;
507508
// Decode chain extension id.
508-
let func_id = FuncId::try_from(((env.ext_id() as u32) << 16) + env.func_id() as u32);
509+
let func_id = FuncId::try_from(ext_id);
509510

510511
trace!(
511512
target: "runtime",

pallets/contracts/src/lib.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,14 @@
5555
pub mod benchmarking;
5656

5757
pub mod chain_extension;
58-
pub use chain_extension::ExtrinsicId;
58+
pub use chain_extension::{ExtrinsicId, PolymeshExtension};
5959

6060
use frame_support::{
6161
decl_error, decl_event, decl_module, decl_storage,
6262
dispatch::{
6363
DispatchError, DispatchErrorWithPostInfo, DispatchResult, DispatchResultWithPostInfo,
6464
},
6565
ensure,
66-
log::trace,
6766
traits::Get,
6867
weights::Weight,
6968
};
@@ -130,7 +129,7 @@ macro_rules! cost {
130129

131130
macro_rules! cost_batched {
132131
($name:ident) => {
133-
cost!($name) / Weight::from(CHAIN_EXTENSION_BATCH_SIZE)
132+
cost!($name) / u64::from(CHAIN_EXTENSION_BATCH_SIZE)
134133
};
135134
}
136135

@@ -193,19 +192,19 @@ pub trait WeightInfo {
193192
fn hash_twox_64(r: u32) -> Weight {
194193
let per_byte = cost_byte_batched!(chain_extension_hash_twox_64_per_kb);
195194
cost_batched!(chain_extension_hash_twox_64)
196-
.saturating_add(per_byte.saturating_mul(r as Weight))
195+
.saturating_add(per_byte.saturating_mul(r as u64))
197196
}
198197

199198
fn hash_twox_128(r: u32) -> Weight {
200199
let per_byte = cost_byte_batched!(chain_extension_hash_twox_128_per_kb);
201200
cost_batched!(chain_extension_hash_twox_128)
202-
.saturating_add(per_byte.saturating_mul(r as Weight))
201+
.saturating_add(per_byte.saturating_mul(r as u64))
203202
}
204203

205204
fn hash_twox_256(r: u32) -> Weight {
206205
let per_byte = cost_byte_batched!(chain_extension_hash_twox_256_per_kb);
207206
cost_batched!(chain_extension_hash_twox_256)
208-
.saturating_add(per_byte.saturating_mul(r as Weight))
207+
.saturating_add(per_byte.saturating_mul(r as u64))
209208
}
210209

211210
fn call_runtime(in_len: u32) -> Weight {
@@ -391,7 +390,7 @@ where
391390
{
392391
/// Instantiates a contract using `code` as the WASM code blob.
393392
fn base_update_call_runtime_whitelist(
394-
origin: T::Origin,
393+
origin: T::RuntimeOrigin,
395394
updates: Vec<(ExtrinsicId, bool)>,
396395
) -> DispatchResult {
397396
ensure_root(origin)?;

0 commit comments

Comments
 (0)