Skip to content

Commit

Permalink
Use convert_fns
Browse files Browse the repository at this point in the history
  • Loading branch information
pgherveou committed Nov 13, 2024
1 parent 3a1b689 commit d4364fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions substrate/frame/revive/src/evm/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,10 @@ pub trait EthExtra {
return Err(InvalidTransaction::Call);
}

let value = (value / U256::from(<Self::Config as crate::Config>::NativeToEthRatio::get()))
.try_into()
.map_err(|_| InvalidTransaction::Call)?;
let value = crate::Pallet::<Self::Config>::convert_evm_to_native(value).map_err(|err| {
log::debug!(target: LOG_TARGET, "Failed to convert value to native: {err:?}");
InvalidTransaction::Call
})?;

let call = if let Some(dest) = to {
crate::Call::call::<Self::Config> {
Expand Down
2 changes: 1 addition & 1 deletion substrate/frame/revive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,7 @@ where
};

let mut tx = TransactionLegacyUnsigned {
value: value.into().saturating_mul(T::NativeToEthRatio::get().into()),
value: Self::convert_native_to_evm(value),
input: input.into(),
nonce: nonce.into(),
chain_id: Some(T::ChainId::get().into()),
Expand Down

0 comments on commit d4364fd

Please sign in to comment.