From c0d102c8f60666c8e712d931211a0d007d96c1ee Mon Sep 17 00:00:00 2001 From: Gautham Date: Wed, 24 Apr 2024 14:06:32 +0300 Subject: [PATCH] Disable EVM authorities payload generation --- pallets/thea/src/lib.rs | 75 +++++++++++++++++++------------------ runtimes/mainnet/src/lib.rs | 2 +- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/pallets/thea/src/lib.rs b/pallets/thea/src/lib.rs index 804b2aa40..cf07dfb4e 100644 --- a/pallets/thea/src/lib.rs +++ b/pallets/thea/src/lib.rs @@ -771,42 +771,43 @@ impl Pallet { // This last message should be signed by the outgoing set // Similar to how Grandpa's session change works. if incoming != queued { - let mut uncompressed_keys: Vec<[u8; 20]> = vec![]; - for public_key in queued.clone().into_iter() { - let public_key: sp_core::ecdsa::Public = public_key.into(); - if public_key.0 == [0u8; 33] { - uncompressed_keys.push([0u8; 20]); - continue; - } - if let Ok(compressed_key) = libsecp256k1::PublicKey::parse_compressed(&public_key.0) - { - let uncompressed_key = compressed_key.serialize(); - let uncompressed_key: [u8; 64] = - if let Ok(uncompressed_key) = uncompressed_key[1..65].try_into() { - uncompressed_key - } else { - log::error!(target: "thea", "Unable to slice last 64 bytes of uncompressed_key for Evm"); - Self::deposit_event(Event::::UnableToSlicePublicKeyHash( - public_key.into(), - )); - return; - }; - let hash: [u8; 32] = sp_io::hashing::keccak_256(&uncompressed_key); - if let Ok(address) = hash[12..32].try_into() { - uncompressed_keys.push(address); - } else { - log::error!(target: "thea", "Unable to slice last 20 bytes of hash for Evm"); - Self::deposit_event(Event::::UnableToSlicePublicKeyHash( - public_key.into(), - )); - return; - } - } else { - log::error!(target: "thea", "Unable to parse compressed key"); - Self::deposit_event(Event::::UnableToParsePublicKey(public_key.into())); - return; - } - } + let uncompressed_keys: Vec<[u8; 20]> = vec![]; + // TODO: Uncomment the following when parsing is fixed for ethereum keys. + // for public_key in queued.clone().into_iter() { + // let public_key: sp_core::ecdsa::Public = public_key.into(); + // if public_key.0 == [0u8; 33] { + // uncompressed_keys.push([0u8; 20]); + // continue; + // } + // if let Ok(compressed_key) = libsecp256k1::PublicKey::parse_compressed(&public_key.0) + // { + // let uncompressed_key = compressed_key.serialize(); + // let uncompressed_key: [u8; 64] = + // if let Ok(uncompressed_key) = uncompressed_key[1..65].try_into() { + // uncompressed_key + // } else { + // log::error!(target: "thea", "Unable to slice last 64 bytes of uncompressed_key for Evm"); + // Self::deposit_event(Event::::UnableToSlicePublicKeyHash( + // public_key.into(), + // )); + // return; + // }; + // let hash: [u8; 32] = sp_io::hashing::keccak_256(&uncompressed_key); + // if let Ok(address) = hash[12..32].try_into() { + // uncompressed_keys.push(address); + // } else { + // log::error!(target: "thea", "Unable to slice last 20 bytes of hash for Evm"); + // Self::deposit_event(Event::::UnableToSlicePublicKeyHash( + // public_key.into(), + // )); + // return; + // } + // } else { + // log::error!(target: "thea", "Unable to parse compressed key"); + // Self::deposit_event(Event::::UnableToParsePublicKey(public_key.into())); + // return; + // } + // } for network in &active_networks { let network_config = >::get(*network); let message = match network_config.network_type { @@ -849,7 +850,7 @@ impl Pallet { >::put(new_id); for network in active_networks { let message = - Self::generate_payload(PayloadType::ValidatorsRotated, network, Vec::new()); //Empty data means acitvate the next set_id + Self::generate_payload(PayloadType::ValidatorsRotated, network, Vec::new()); //Empty data means activate the next set_id >::insert(network, message.nonce); >::insert(network, message.nonce, message); } diff --git a/runtimes/mainnet/src/lib.rs b/runtimes/mainnet/src/lib.rs index 67f2678be..acf284e2b 100644 --- a/runtimes/mainnet/src/lib.rs +++ b/runtimes/mainnet/src/lib.rs @@ -122,7 +122,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // and set impl_version to 0. If only runtime // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. - spec_version: 349, + spec_version: 350, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 2,