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

Add contract creation allow lists to EVM domains #3350

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Conversation

teor2345
Copy link
Member

@teor2345 teor2345 commented Jan 15, 2025

This PR adds a pallet which filters ethereum contract creation using an allow list. The allow list can be updated by the domain sudo account.

By default, all accounts can create contracts, to maintain compatibility with existing EVM domains. But the chainspec can be configured with an initial allow list of accounts. For our "private" EVM, that will be the domain sudo.

Close #3344.

I couldn't work out how to do a dynamic check for the domain sudo inside the pallet or runtime. I'm not sure if that's needed, because we can add the sudo account in the chainspec, or they can add themselves to the list using the (sudo) call provided by the pallet.

Part of #3353.

Code contributor checklist:

@teor2345 teor2345 added enhancement New feature or request execution Subspace execution labels Jan 15, 2025
@teor2345 teor2345 self-assigned this Jan 15, 2025
@teor2345

This comment was marked as resolved.

NingLin-P

This comment was marked as resolved.

teor2345

This comment was marked as resolved.

@vedhavyas
Copy link
Member

Will review this today.
As for the tests, I think this is what we want

  • Instantiate domain with allowlist passed
  • Contract creation should fail(should cover all possible routes)
  • Ability to add and remove addresses from list

Will think on more and add here

@teor2345

This comment was marked as resolved.

@vedhavyas

This comment was marked as resolved.

vedhavyas

This comment was marked as resolved.

domains/pallets/evm_nonce_tracker/src/lib.rs Show resolved Hide resolved
domains/runtime/evm/src/lib.rs Outdated Show resolved Hide resolved
crates/pallet-domains/src/runtime_registry.rs Outdated Show resolved Hide resolved
crates/pallet-domains/src/domain_registry.rs Outdated Show resolved Hide resolved
pub struct CheckContractCreation;

impl SignedExtension for CheckContractCreation {
const IDENTIFIER: &'static str = "CheckContractCreation";
Copy link
Member

Choose a reason for hiding this comment

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

Can we move this Extension to the pallet itself?

This also makes sense to me, as we can use this extension in the test evm runtime too, and we can write integration test for it.

Also ideal if we change the name of pallet to something more alighed with new changes
maybe just pallet-evm-tracker ?

It is okay to change the crate name but notice we can't change the pallet name in the runtime, because the pallet name is used to construct the storage key changing it make break compatibility with the existing evm domain on Taurus

teor2345

This comment was marked as resolved.

@teor2345

This comment was marked as resolved.

@nazar-pc

This comment was marked as resolved.

@@ -161,7 +162,7 @@ pub type BlockTreeNodeFor<T> = crate::block_tree::BlockTreeNode<
>;

/// The current storage version.
const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
Copy link
Member

Choose a reason for hiding this comment

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

Is this due to Taurus being on storage version 2 already ?

@@ -136,7 +136,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: Cow::Borrowed("subspace"),
impl_name: Cow::Borrowed("subspace"),
authoring_version: 0,
spec_version: 2,
Copy link
Member

Choose a reason for hiding this comment

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

lets not bump this yet.

I do a see a new problem with maintaing a new branch for taurus @dariolina
Apart from the spec_versin, there is also sometime storge versions for each pallet that involves migrations. This will problematic when we have a seperate branch for Taurus.

I still think having a single source of truth with same spec_version would be most non-confusing way to go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request execution Subspace execution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Private" EVM
4 participants