Skip to content

Commit

Permalink
Merge pull request #300 from peaqnetwork/feat/1208542853916758_typo_r…
Browse files Browse the repository at this point in the history
…evert_backtrace

WIP: Feat/1208542853916758 typo revert backtrace
  • Loading branch information
sfffaaa authored Oct 15, 2024
2 parents e312a4f + 381ec68 commit f6ad859
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions precompiles/assets-erc20/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
24 changes: 12 additions & 12 deletions precompiles/assets-factory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ where
) -> EvmResult<Address> {
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()),
}
}

Expand All @@ -97,13 +97,13 @@ where
let admin: H160 = admin.into();
let asset_id: AssetIdParameterOf<Runtime, Instance> = 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());
}
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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<Runtime, Instance> =
min_balance.try_into().unwrap_or_else(|_| Bounded::max_value());
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
{
Expand All @@ -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.
{
Expand All @@ -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.
{
Expand All @@ -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.
{
Expand Down
2 changes: 1 addition & 1 deletion precompiles/peaq-did/did.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ interface DID {
bytes value,
uint32 validity
);
event RemoveAttribte(
event RemoveAttribute(
address did_account,
bytes name
);
Expand Down
2 changes: 1 addition & 1 deletion precompiles/peaq-did/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Runtime>(PhantomData<Runtime>);

Expand Down
4 changes: 2 additions & 2 deletions precompiles/vesting/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ where
) -> EvmResult<bool> {
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<Runtime> = starting_block.into();
let schedule = VestingInfo::new(locked_amount, per_block_amount, starting_block_converted);

Expand Down

0 comments on commit f6ad859

Please sign in to comment.