-
Notifications
You must be signed in to change notification settings - Fork 248
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
"Private" EVM #3344
Comments
There are 3 parts of work to implement "Private" EVM:
NOTE: this only disallow deploying contract on the "Private" EVM, but transfer within the domains and XDM that transfer between other domains and the consensus chain is not affected. Maintenance of the allow-listWe need to introduce a new pallet to maintain the allow-list in the EVM domain, the allowlist should be something similar to subspace/crates/pallet-domains/src/lib.rs Lines 694 to 696 in e0a3f16
subspace/crates/pallet-domains/src/lib.rs Lines 1528 to 1538 in e0a3f16
NOTE: updating the allow-list requires domain sudo and currently the only way to do that is via subspace/crates/pallet-domains/src/lib.rs Lines 1540 to 1547 in e0a3f16
Access control based on the allow-listThe check can be implemented as a check like: fn is_create_contract_allowed(call: &RuntimeCall, signer: &AccountId) -> bool {
is_create_contract(call) && is_allowed(signer)
}
fn is_create_contract(call: &RuntimeCall) -> bool {
match call {
RuntimeCall::EVM(pallet_evm::Call::create {..}) | RuntimeCall::EVM(pallet_evm::Call::create2 {..}) => true,
RuntimeCall::Utility(wrapped_call) => wrapped_call.is_pallet_evm_create_or_create2(),
RuntimeCall::Ethereum(pallet_ethereum::Call::transact { transaction, ..}) => transaction.is_create(),
_ => false
}
}
fn is_allowed(signer: &AccountId) -> bool {
PermissionedActionAllowedBy::<T>::get()
.map(|allowed_by| allowed_by.is_allowed(signer))
.unwrap_or_default()
} Apply the checkThis part is a bit tricky because For For subspace/domains/runtime/evm/src/lib.rs Line 172 in e0a3f16
subspace/domains/runtime/evm/src/lib.rs Line 196 in e0a3f16
|
We already have nonce tracker pallet specific to EVM. please repurpose that. No need to create a new pallet for every feature :) Rest of the approach looks good 👍🏼 |
Allow instantiating an EVM with the same runtime as public Auto-EVM, but with (config?) parameters of an allow-list for addresses that can deploy contracts. The allow-list, by default, should contain the domain sudo (!= consensus sudo) and the domain sudo should be able to add members to it.
The text was updated successfully, but these errors were encountered: