From d5dee59a94346c43e42d2c17ba4fbf6c6f46716b Mon Sep 17 00:00:00 2001 From: jaypan Date: Mon, 14 Oct 2024 14:07:48 +0200 Subject: [PATCH 1/2] Fix typo --- precompiles/peaq-did/did.sol | 2 +- precompiles/peaq-did/src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/precompiles/peaq-did/did.sol b/precompiles/peaq-did/did.sol index c5e418e6..044971c5 100644 --- a/precompiles/peaq-did/did.sol +++ b/precompiles/peaq-did/did.sol @@ -53,7 +53,7 @@ interface DID { bytes value, uint32 validity ); - event RemoveAttribte( + event RemoveAttribute( address did_account, bytes name ); diff --git a/precompiles/peaq-did/src/lib.rs b/precompiles/peaq-did/src/lib.rs index 24c2ba29..9a8d625a 100644 --- a/precompiles/peaq-did/src/lib.rs +++ b/precompiles/peaq-did/src/lib.rs @@ -43,7 +43,7 @@ pub(crate) const SELECTOR_LOG_UPDATE_ATTRIBUTE: [u8; 32] = keccak256!("UpdateAttribute(address,address,bytes,bytes,uint32)"); pub(crate) const SELECTOR_LOG_REMOVE_ATTRIBUTE: [u8; 32] = - keccak256!("RemoveAttribte(address,bytes)"); + keccak256!("RemoveAttribute(address,bytes)"); pub struct PeaqDIDPrecompile(PhantomData); From 4c1de29f7ab18cc7dee56af38c679229f72e9537 Mon Sep 17 00:00:00 2001 From: jaypan Date: Tue, 15 Oct 2024 17:06:13 +0200 Subject: [PATCH 2/2] Typo --- precompiles/assets-erc20/src/lib.rs | 4 ++-- precompiles/assets-factory/src/lib.rs | 24 ++++++++++++------------ precompiles/vesting/src/lib.rs | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/precompiles/assets-erc20/src/lib.rs b/precompiles/assets-erc20/src/lib.rs index 4b4cd88f..6e1917aa 100644 --- a/precompiles/assets-erc20/src/lib.rs +++ b/precompiles/assets-erc20/src/lib.rs @@ -447,7 +447,7 @@ where handle.record_log_costs_manual(3, 32)?; let addr: H160 = beneficiary.into(); - let amount = Self::u256_to_amount(amount).in_field("value")?; + let amount = Self::u256_to_amount(amount).in_field("amount")?; let origin = Runtime::AddressMapping::into_account_id(handle.context().caller); let beneficiary = Runtime::AddressMapping::into_account_id(addr); @@ -481,7 +481,7 @@ where handle.record_log_costs_manual(3, 32)?; let addr: H160 = who.into(); - let amount = Self::u256_to_amount(amount).in_field("value")?; + let amount = Self::u256_to_amount(amount).in_field("amount")?; let origin = Runtime::AddressMapping::into_account_id(handle.context().caller); let who = Runtime::AddressMapping::into_account_id(addr); diff --git a/precompiles/assets-factory/src/lib.rs b/precompiles/assets-factory/src/lib.rs index b12f6565..d695b3ff 100644 --- a/precompiles/assets-factory/src/lib.rs +++ b/precompiles/assets-factory/src/lib.rs @@ -77,11 +77,11 @@ where ) -> EvmResult
{ let asset_id = id .try_into() - .map_err(|_| RevertReason::value_is_too_large("asset id").in_field("id"))?; + .map_err(|_| RevertReason::value_is_too_large("asset id type").in_field("id"))?; match Runtime::asset_id_to_address(asset_id) { Some(address) => Ok(address.into()), - None => Err(RevertReason::Custom("Invalid asset id".into()).into()), + None => Err(RevertReason::Custom("Invalid id".into()).into()), } } @@ -97,13 +97,13 @@ where let admin: H160 = admin.into(); let asset_id: AssetIdParameterOf = id .try_into() - .map_err(|_| RevertReason::value_is_too_large("asset id").in_field("id"))?; + .map_err(|_| RevertReason::value_is_too_large("asset id type").in_field("id"))?; // Convert to asset id let check_asset_id: PeaqAssetId = asset_id .clone() .try_into() - .map_err(|_| RevertReason::value_is_too_large("asset id").in_field("id"))?; + .map_err(|_| RevertReason::value_is_too_large("asset id type").in_field("id"))?; if !check_asset_id.is_allow_to_create() { return Err(RevertReason::Custom("Invalid asset id".into()).into()); } @@ -145,7 +145,7 @@ where let asset_id = id .try_into() - .map_err(|_| RevertReason::value_is_too_large("asset id").in_field("id"))?; + .map_err(|_| RevertReason::value_is_too_large("asset id type").in_field("id"))?; let name: Vec<_> = name.into(); let symbol: Vec<_> = symbol.into(); @@ -181,7 +181,7 @@ where let asset_id = id .try_into() - .map_err(|_| RevertReason::value_is_too_large("asset id").in_field("id"))?; + .map_err(|_| RevertReason::value_is_too_large("asset id type").in_field("id"))?; let min_balance: BalanceOf = min_balance.try_into().unwrap_or_else(|_| Bounded::max_value()); @@ -218,7 +218,7 @@ where let asset_id = id .try_into() - .map_err(|_| RevertReason::value_is_too_large("asset id").in_field("id"))?; + .map_err(|_| RevertReason::value_is_too_large("asset id type").in_field("id"))?; let issuer: H160 = issuer.into(); let admin: H160 = admin.into(); let freezer: H160 = freezer.into(); @@ -258,7 +258,7 @@ where let asset_id = id .try_into() - .map_err(|_| RevertReason::value_is_too_large("asset id").in_field("id"))?; + .map_err(|_| RevertReason::value_is_too_large("asset id type").in_field("id"))?; let owner: H160 = owner.into(); // Build call with origin. @@ -288,7 +288,7 @@ where let asset_id = id .try_into() - .map_err(|_| RevertReason::value_is_too_large("asset id").in_field("id"))?; + .map_err(|_| RevertReason::value_is_too_large("asset id type").in_field("id"))?; // Build call with origin. { @@ -313,7 +313,7 @@ where let asset_id = id .try_into() - .map_err(|_| RevertReason::value_is_too_large("asset id").in_field("id"))?; + .map_err(|_| RevertReason::value_is_too_large("asset id type").in_field("id"))?; // Build call with origin. { @@ -338,7 +338,7 @@ where let asset_id = id .try_into() - .map_err(|_| RevertReason::value_is_too_large("asset id").in_field("id"))?; + .map_err(|_| RevertReason::value_is_too_large("asset id type").in_field("id"))?; // Build call with origin. { @@ -362,7 +362,7 @@ where let asset_id = id .try_into() - .map_err(|_| RevertReason::value_is_too_large("asset id").in_field("id"))?; + .map_err(|_| RevertReason::value_is_too_large("asset id type").in_field("id"))?; // Build call with origin. { diff --git a/precompiles/vesting/src/lib.rs b/precompiles/vesting/src/lib.rs index 252bbf80..93f145b8 100644 --- a/precompiles/vesting/src/lib.rs +++ b/precompiles/vesting/src/lib.rs @@ -113,8 +113,8 @@ where ) -> EvmResult { let origin = Runtime::AddressMapping::into_account_id(handle.context().caller); let target_account = Runtime::AddressMapping::into_account_id(target.into()); - let locked_amount = Self::u256_to_amount(locked).in_field("amount")?; - let per_block_amount = Self::u256_to_amount(per_block).in_field("amount")?; + let locked_amount = Self::u256_to_amount(locked).in_field("locked")?; + let per_block_amount = Self::u256_to_amount(per_block).in_field("per_block")?; let starting_block_converted: BlockNumberFor = starting_block.into(); let schedule = VestingInfo::new(locked_amount, per_block_amount, starting_block_converted);