diff --git a/docs/pages/developers/polkadot/token-gateway.mdx b/docs/pages/developers/polkadot/token-gateway.mdx
index 05e56a0e..9e8d3f5b 100644
--- a/docs/pages/developers/polkadot/token-gateway.mdx
+++ b/docs/pages/developers/polkadot/token-gateway.mdx
@@ -23,6 +23,7 @@ Let's look at the pallet specific components of the configuration trait:
- `NativeAssetId`: A constant value that represents the identifier of the native asset.
- `Decimals`: A constant that represents the precision of the native currency.
+ - `EvmToSubstrate`: A type that allows conversion of an EVM account to a substrate account.
## Calls
@@ -77,6 +78,8 @@ impl pallet_token_gateway::Config for Runtime {
type AssetIdFactory = ();
// The precision of the native asset
type Decimals = Decimals;
+ // An implementation that converts an evm account to a substrate account
+ type EvmToSubstrate = ();
}
// Add the token gateway pallet to your ISMP router
@@ -166,6 +169,8 @@ pub struct TeleportParams {
pub token_gateway: Vec,
/// Relayer fee
pub relayer_fee: Balance,
+ /// Optional call data
+ pub call_data: Option>
}
```
Let's explore what each parameter holds:
diff --git a/modules/pallets/token-gateway/src/lib.rs b/modules/pallets/token-gateway/src/lib.rs
index 9f8537a8..13814e1a 100644
--- a/modules/pallets/token-gateway/src/lib.rs
+++ b/modules/pallets/token-gateway/src/lib.rs
@@ -40,10 +40,7 @@ use ismp::{
};
use sp_core::{Get, H160, U256};
-use sp_runtime::{
- traits::{Dispatchable, Hash},
- MultiSignature,
-};
+use sp_runtime::{traits::Dispatchable, MultiSignature};
use token_gateway_primitives::{
token_gateway_id, token_governor_id, AssetMetadata, DeregisterAssets,
};
@@ -636,7 +633,7 @@ where
// Verify signature against encoded runtime call
let nonce = frame_system::Pallet::::account_nonce(beneficiary.clone());
let payload = (nonce, substrate_data.runtime_call.clone()).encode();
- let message = <::Hashing as Hash>::hash(&payload);
+ let message = sp_io::hashing::keccak_256(&payload);
let multi_signature = MultiSignature::decode(&mut &*substrate_data.signature)?;
@@ -662,10 +659,8 @@ where
}
},
MultiSignature::Ecdsa(sig) => {
- let mut msg = [0u8; 32];
- msg.copy_from_slice(message.as_ref());
- let pub_key =
- sp_io::crypto::secp256k1_ecdsa_recover(&sig.0, &msg).map_err(|_| {
+ let pub_key = sp_io::crypto::secp256k1_ecdsa_recover(&sig.0, &message)
+ .map_err(|_| {
anyhow!("Failed to recover ecdsa public key from signature")
})?;
let eth_address =
diff --git a/modules/pallets/token-gateway/src/types.rs b/modules/pallets/token-gateway/src/types.rs
index a6a05953..cb7ef188 100644
--- a/modules/pallets/token-gateway/src/types.rs
+++ b/modules/pallets/token-gateway/src/types.rs
@@ -90,8 +90,8 @@ alloy_sol_macro::sol! {
#[derive(Debug, Clone, Encode, Decode, scale_info::TypeInfo, PartialEq, Eq)]
pub struct SubstrateCalldata {
- /// A scale encoded encoded [MultiSignature](sp_runtime::MultiSignature) of the hash of the
- /// encoded runtime call by the beneficiary account
+ /// A scale encoded encoded [MultiSignature](sp_runtime::MultiSignature) of the beneficiary's
+ /// account nonce and the encoded runtime call
pub signature: Vec,
/// Encoded Runtime call that should be executed
pub runtime_call: Vec,