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

Remove Pallet ethereum-chain-id in favor of frontier evm-chain-id #2379

Merged
merged 17 commits into from
Sep 20, 2023

Conversation

ahmadkaouk
Copy link
Contributor

@ahmadkaouk ahmadkaouk commented Jul 5, 2023

What does it do?

Remove Pallet Ethereum Chain Id in favor of Frontier Evm Chain Id

What important points reviewers should know?

Is there something left for follow-up PRs?

What alternative implementations were considered?

Are there relevant PRs or issues in other repositories (Substrate, Polkadot, Frontier, Cumulus)?

What value does it bring to the blockchain users?

@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2023

Coverage generated "Wed Sep 20 15:03:34 UTC 2023":
https://d3ifz9vhxc2wtb.cloudfront.net/pulls/2379/html/index.html

Master coverage: 87.39%
Pull coverage:

Copy link
Contributor

@notlesh notlesh left a comment

Choose a reason for hiding this comment

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

This looks good so far. We may need a migration in order to make sure the new pallet has the same value as the previous one.

Edit (more context): A migration is a FRAME-specific concept where values that are in on-chain storage are modified at the very beginning of a runtime upgrade. In this case, I believe it's necessary because the new pallet's storage item for the chain_id will not be initialized, so it should be copied from the old one.

Feel free to follow up in private for more details :)

is_pallet_index::<moonriver_runtime::EthereumChainId>(50);
is_pallet_index::<moonriver_runtime::EvmChainId>(50);
Copy link
Contributor

Choose a reason for hiding this comment

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

We usually try not to reuse pallet indices like this, but it might be ok if the pallets are identical. I think the safer choice is to use a fresh index (53?) though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Used 54 as 53 was already used by on old pallet.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes always use a different id for a different pallet, the main reason is to avoid incompatibility, mostly due to the fact that the extrinsics use the index to specify the pallet call.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I really think we should use the same pallet index (50). The pallet is identical, so I dont think there is a reason not to re-use it. It also has no extrinsics whatsoever, so there is not really a risk I think..

Copy link
Contributor

Choose a reason for hiding this comment

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

There's disagreement in the comments here, so I unresolved.

@girazoki do you see any harm in using a fresh pallet index? I agree with your assessment, but also don't see any harm in using a new one.

Copy link
Collaborator

Choose a reason for hiding this comment

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

not really, using the same one or different one only affects things like XCM (where you rely on extrinsic indices to perform transactions). So I dont see a risk neither using the same nor using a different one

@ahmadkaouk ahmadkaouk added the B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes label Jul 7, 2023
@ahmadkaouk ahmadkaouk added D9-needsaudit👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited breaking Needs to be mentioned in breaking changes labels Jul 13, 2023
@ahmadkaouk ahmadkaouk marked this pull request as ready for review July 21, 2023 06:52
@notlesh notlesh added D1-audited👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited and removed D9-needsaudit👮 PR contains changes to fund-managing logic that should be properly reviewed and externally audited labels Aug 2, 2023
@noandrea
Copy link
Collaborator

@ahmadkaouk @notlesh is this ready to be merged?

@@ -1359,6 +1359,7 @@ construct_runtime! {
RootTesting: pallet_root_testing::{Pallet, Call, Storage} = 47,
Erc20XcmBridge: pallet_erc20_xcm_bridge::{Pallet} = 48,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 49,
EvmChainId: pallet_evm_chain_id::{Pallet, Storage, Config} = 50,
Copy link
Collaborator

Choose a reason for hiding this comment

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

A migration is not needed as long as the pallet is named the same and the storage uses the same hashers and same name. This right now requires a migration, but if we keep the previous naming, I dont think we would need one.

CC @notlesh to confirm

Copy link
Contributor

Choose a reason for hiding this comment

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

This works for me just as long as we test it

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would still maintain the name just in case someone is using the pallet (no real reason to change it and there are benefits to not change it)

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, this is essentially a "no-op" and we should probably keep it that way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@notlesh @girazoki I made the changes to use the same name for the pallet, as well as using the same index and remove the migration.
cc @noandrea.

@ahmadkaouk ahmadkaouk merged commit bb85df1 into master Sep 20, 2023
25 of 26 checks passed
@ahmadkaouk ahmadkaouk deleted the ahmad-update-chain-id-pallet branch September 20, 2023 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B7-runtimenoteworthy Changes should be noted in any runtime-upgrade release notes breaking Needs to be mentioned in breaking changes D1-audited👍 PR contains changes to fund-managing logic that has been properly reviewed and externally audited
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants