From 1d5d9b446224966abbf6685783e28cddb1f32757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Ber=C4=8Di=C4=8D?= Date: Fri, 26 Jul 2024 19:17:50 +0200 Subject: [PATCH] Add authorization for EVM contract deployment --- runtime/src/lib.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 1a3c854..963b296 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -109,6 +109,19 @@ impl module_evm::Config for Config { const CONFIDENTIAL: bool = true; } +#[allow(clippy::declare_interior_mutable_const)] +impl modules::access::Config for Config { + const METHOD_AUTHORIZATIONS: Lazy = Lazy::new(|| { + modules::access::types::Authorization::with_filtered_methods([( + "evm.Create", + modules::access::types::MethodAuthorization::allow_from([Address::from_bech32( + "oasis1qryqqccycvckcxp453tflalujvlf78xymcdqw4vz", + ) + .unwrap()]), + )]) + }); +} + /// The EVM ParaTime. pub struct Runtime; @@ -142,6 +155,8 @@ impl sdk::Runtime for Runtime { modules::consensus_accounts::Module, // EVM. module_evm::Module, + // Access control module. + modules::access::Module, ); fn trusted_signers() -> Option { @@ -284,6 +299,7 @@ impl sdk::Runtime for Runtime { gas_costs: module_evm::GasCosts {}, }, }, + (), // Access module. ) }