Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement solidity codecs on xcm::latest #1614

Conversation

manuelmauro
Copy link
Contributor

@manuelmauro manuelmauro commented Feb 19, 2025

Motivation

  • Downstream dependencies (e.g., moonkit) depend on this behavior.
  • /primitives/account/src/lib.rs already targets xcm::latest.

Suggested Solution

  • Implement solidity codecs on xcm::latest.

Alternative Solution

  • Add feature flag to support both xcm::lts and xcm::latest.

@RomarQ
Copy link
Contributor

RomarQ commented Feb 19, 2025

This was changed in paritytech/polkadot-sdk#5390

NetworkId::Rococo and NetworkId::Westend can use NetworkId::ByGenesis by importing their genesis.

Something like:

use xcm::latest::ROCOCO_GENESIS_HASH;

pub const NonBridgedRelayNetwork: NetworkId = NetworkId::ByGenesis(ROCOCO_GENESIS_HASH);

Instead of commenting the affected lines, we should replace them with the new approach.

@@ -76,6 +76,7 @@ pub(crate) fn network_id_to_bytes(network_id: Option<NetworkId>) -> Vec<u8> {
encoded.append(&mut block_hash.into());
encoded
}
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code commented can be removed entirely.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 1217ef1

@@ -152,9 +154,11 @@ pub(crate) fn network_id_from_bytes(encoded_bytes: Vec<u8>) -> MayRevert<Option<
block_hash,
}))
}
/*
5 => Ok(Some(NetworkId::Westend)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
5 => Ok(Some(NetworkId::Westend)),
5 => Ok(Some(NetworkId::ByGenesis(WESTEND_GENESIS_HASH))),

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 7f7d587

@@ -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)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
6 => Ok(Some(NetworkId::Rococo)),
6 => Ok(Some(NetworkId::ByGenesis(ROCOCO_GENESIS_HASH))),

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 7f7d587

@@ -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)),
Copy link
Contributor

@RomarQ RomarQ Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, we can return an error

Suggested change
7 => Ok(Some(NetworkId::Wococo)),
7 => Err(RevertReason::custom("Wococo Network is no longer supported").into()),

or

Suggested change
7 => Ok(Some(NetworkId::Wococo)),
7 => Ok(Some(NetworkId::ByGenesis(DUMMY_GENESIS_HASH))),

As done here: paritytech/polkadot-sdk@81c420d

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 7f7d587

@boundless-forest boundless-forest merged commit 4dddde8 into polkadot-evm:master Feb 20, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants