Skip to content

Commit

Permalink
feat: ✨ implement solidity codecs on xcm::latest
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelmauro committed Feb 19, 2025
1 parent 5a3f891 commit c2eacbc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion precompiles/src/solidity/codec/xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use alloc::{string::String, vec::Vec};
use frame_support::{ensure, traits::ConstU32};
use sp_core::H256;
use sp_weights::Weight;
use xcm::lts::{Junction, Junctions, Location, NetworkId};
use xcm::latest::{Junction, Junctions, Location, NetworkId};

use crate::solidity::{
codec::{bytes::*, Codec, Reader, Writer},
Expand Down Expand Up @@ -76,6 +76,7 @@ pub(crate) fn network_id_to_bytes(network_id: Option<NetworkId>) -> Vec<u8> {
encoded.append(&mut block_hash.into());
encoded
}
/*
Some(NetworkId::Westend) => {
encoded.push(5u8);
encoded.push(4u8);
Expand All @@ -91,6 +92,7 @@ pub(crate) fn network_id_to_bytes(network_id: Option<NetworkId>) -> Vec<u8> {
encoded.push(6u8);
encoded
}
*/
Some(NetworkId::Ethereum { chain_id }) => {
encoded.push(8u8);
encoded.push(7u8);
Expand Down Expand Up @@ -152,9 +154,11 @@ pub(crate) fn network_id_from_bytes(encoded_bytes: Vec<u8>) -> MayRevert<Option<
block_hash,
}))
}
/*
5 => Ok(Some(NetworkId::Westend)),
6 => Ok(Some(NetworkId::Rococo)),
7 => Ok(Some(NetworkId::Wococo)),
*/
8 => {
let mut chain_id: [u8; 8] = Default::default();
chain_id.copy_from_slice(encoded_network_id.read_raw_bytes(8)?);
Expand Down

0 comments on commit c2eacbc

Please sign in to comment.