diff --git a/crates/light-client-prover/src/circuit/initial_values.rs b/crates/light-client-prover/src/circuit/initial_values.rs index 923828282a..381e494244 100644 --- a/crates/light-client-prover/src/circuit/initial_values.rs +++ b/crates/light-client-prover/src/circuit/initial_values.rs @@ -10,7 +10,7 @@ use sov_rollup_interface::Network; #[cfg(feature = "native")] use self::non_empty_slice::NonEmptySlice; #[cfg(feature = "native")] -use crate::circuit::{SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE, SECURITY_COUNCIL_MEMBER_COUNT}; +use crate::circuit::SECURITY_COUNCIL_MEMBER_COUNT; /// Genesis root for the Light Client Prover's Jellyfish Merkle Tree. pub(crate) const LCP_JMT_GENESIS_ROOT: [u8; 32] = match const_hex::const_decode_to_array( @@ -31,8 +31,10 @@ const fn decode_to_u32_array(hex: &str) -> [u32; 8] { /// Module containing initial values for the mock DA specification. pub mod mockda { + use alloy_primitives::{address, Address}; + use super::non_empty_slice::NonEmptySlice; - use crate::circuit::{SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE, SECURITY_COUNCIL_MEMBER_COUNT}; + use crate::circuit::SECURITY_COUNCIL_MEMBER_COUNT; /// Genesis L2 genesis root for the mock DA. pub const GENESIS_ROOT: [u8; 32] = match const_hex::const_decode_to_array( @@ -64,52 +66,27 @@ pub mod mockda { /// Public keys of the method ID upgrade authority in the mock DA. /// 3 out of 5 signatures are required to upgrade method IDs. - pub const METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS: [[u8; - SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE]; - SECURITY_COUNCIL_MEMBER_COUNT] = [ + pub const METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES: [Address; SECURITY_COUNCIL_MEMBER_COUNT] = [ // Private key: 79122E48DF1A002FB6584B2E94D0D50F95037416C82DAF280F21CD67D17D9077 - match const_hex::const_decode_to_array( - b"0313c4ff65eb94999e0ac41cfe21592baa52910f5a5ada9074b816de4f560189db", - ) { - Ok(k) => k, - Err(_) => panic!(), - }, + address!("0xd51bd554b82aa486f56030bef90b70a27a4f6d20"), // Private key: 79122E48DF1A002FB6584B2E94D0D50F95037416C82DAF280F21CD67D17D9076 - match const_hex::const_decode_to_array( - b"03b15df91f38ec6e0520b71fca528780820e75541f3371f6389a4f77ad0e5b823e", - ) { - Ok(k) => k, - Err(_) => panic!(), - }, + address!("0xfef24931c137d6c0df4f76116e0e58d281203360"), // Private key: 79122E48DF1A002FB6584B2E94D0D50F95037416C82DAF280F21CD67D17D9075 - match const_hex::const_decode_to_array( - b"03fb89fd189501b9f55863a8194a8daff5b684cc52c0c21092f02ce428374c59f7", - ) { - Ok(k) => k, - Err(_) => panic!(), - }, + address!("0xbb3833932330eef589dd56e855f2ca1ac015d200"), // Private key: 79122E48DF1A002FB6584B2E94D0D50F95037416C82DAF280F21CD67D17D9074 - match const_hex::const_decode_to_array( - b"037d415a6027c2dc598c3ee52e6e93e0b61dabf9ea224895533a4de34fef4b91e0", - ) { - Ok(k) => k, - Err(_) => panic!(), - }, + address!("0xe976fdbc72670c34b7973ae3fa7d38478eade018"), // Private key: 79122E48DF1A002FB6584B2E94D0D50F95037416C82DAF280F21CD67D17D9073 - match const_hex::const_decode_to_array( - b"022fad5142da490bed9c86beda47fe8538ec184d12e39db55ebf3ec41d180352d0", - ) { - Ok(k) => k, - Err(_) => panic!(), - }, + address!("0x8632ebc44c4515c9b85fae29eae3fd3722fd35ea"), ]; } /// Module containing initial values for the Bitcoin DA (Data Availability) specification. pub mod bitcoinda { + use alloy_primitives::{address, Address}; + use super::decode_to_u32_array; use super::non_empty_slice::NonEmptySlice; - use crate::circuit::{SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE, SECURITY_COUNCIL_MEMBER_COUNT}; + use crate::circuit::SECURITY_COUNCIL_MEMBER_COUNT; /// Genesis L2 root for the Bitcoin DA on Mainnet. pub const MAINNET_GENESIS_ROOT: [u8; 32] = match const_hex::const_decode_to_array( @@ -356,290 +333,186 @@ pub mod bitcoinda { } }; - /// Public keys of the method ID upgrade authority in the Bitcoin DA on Mainnet. + // TODO: Update with real addresses + /// Addresses of the method ID upgrade authority in the Bitcoin DA on Mainnet. /// 3 out of 5 signatures are required to upgrade method IDs. - pub const MAINNET_METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS: [[u8; - SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE]; + pub const MAINNET_METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES: [Address; SECURITY_COUNCIL_MEMBER_COUNT] = [ - match const_hex::const_decode_to_array( - b"031f44b16dfa50f33382568ae10391779f06c4a6ed5e9e3c83409d8b6ede26ed57", - ) { - Ok(k) => k, - Err(_) => { - panic!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY must be valid 33-byte hex string") - } - }, - match const_hex::const_decode_to_array( - b"0284aece094f0190da7d20660828cb13c9807e4ed5fa1f6eb92d21a3bfd8db6f95", - ) { - Ok(k) => k, - Err(_) => { - panic!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY must be valid 33-byte hex string") - } - }, - match const_hex::const_decode_to_array( - b"0280cbbafd6115883a7adeb2d40034348e2334ad79d197386ea6bdf60ac28525f6", - ) { - Ok(k) => k, - Err(_) => { - panic!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY must be valid 33-byte hex string") - } - }, - match const_hex::const_decode_to_array( - b"03fac103b0964d29d1787506e1ecf72d3d0714692ed09e31ada71fb646878b44d3", - ) { - Ok(k) => k, - Err(_) => { - panic!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY must be valid 33-byte hex string") - } - }, - match const_hex::const_decode_to_array( - b"022dc52b114ca23f4ea3d9bda6de89edd5622c6b6864c555f3b96c393bd1e20592", - ) { - Ok(k) => k, - Err(_) => { - panic!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY must be valid 33-byte hex string") - } - }, + // TODO: Remove place holder addresses + address!("0xffffffffffffffffffffffffffffffffffffffff"), + address!("0xffffffffffffffffffffffffffffffffffffffff"), + address!("0xffffffffffffffffffffffffffffffffffffffff"), + address!("0xffffffffffffffffffffffffffffffffffffffff"), + address!("0xffffffffffffffffffffffffffffffffffffffff"), ]; - // TODO: Update with real keys - /// Public keys of the method ID upgrade authority in the Bitcoin DA on Testnet. + + // TODO: Update with real addresses + /// Addresses of the method ID upgrade authority in the Bitcoin DA on Testnet. /// 3 out of 5 signatures are required to upgrade method IDs. - pub const TESTNET_METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS: [[u8; - SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE]; + pub const TESTNET_METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES: [Address; SECURITY_COUNCIL_MEMBER_COUNT] = [ - match const_hex::const_decode_to_array( - b"03f56e848d9864362f4925e0d53863902c5f86766ee59359f52647df43a0890ce7", - ) { - Ok(pub_key) => pub_key, - Err(_) => { - panic!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY must be valid 33-byte hex string") - } - }, - match const_hex::const_decode_to_array( - b"03e6028f183993c8fd7bb4082a27c3b44f716bba91dcd8c6f37f7c1e6a77233379", - ) { - Ok(pub_key) => pub_key, - Err(_) => { - panic!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY must be valid 33-byte hex string") - } - }, - match const_hex::const_decode_to_array( - b"02fe5c4d28e173998d148d0cd67f00faa87f2b19e30447bc92c5af431da5106357", - ) { - Ok(pub_key) => pub_key, - Err(_) => { - panic!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY must be valid 33-byte hex string") - } - }, - match const_hex::const_decode_to_array( - b"03840f3d82dcd4c60e86c63df785ed3df06ee3b81f20f179e02fb818cfd123de38", - ) { - Ok(pub_key) => pub_key, - Err(_) => { - panic!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY must be valid 33-byte hex string") - } - }, - match const_hex::const_decode_to_array( - b"02379cb28a72784ce7e13ce6beb4a04e8831db2a61887941e60d905ed59e7e6a22", - ) { - Ok(pub_key) => pub_key, - Err(_) => { - panic!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY must be valid 33-byte hex string") - } - }, + // TODO: Remove place holder addresses + address!("0xffffffffffffffffffffffffffffffffffffffff"), + address!("0xffffffffffffffffffffffffffffffffffffffff"), + address!("0xffffffffffffffffffffffffffffffffffffffff"), + address!("0xffffffffffffffffffffffffffffffffffffffff"), + address!("0xffffffffffffffffffffffffffffffffffffffff"), ]; - /// Public keys of the method ID upgrade authority in the Bitcoin DA on Devnet. + // TODO: Update with real addresses + /// Addresses of the method ID upgrade authority in the Bitcoin DA on Devnet. /// 3 out of 5 signatures are required to upgrade method IDs. - pub const DEVNET_METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS: [[u8; - SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE]; + pub const DEVNET_METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES: [Address; SECURITY_COUNCIL_MEMBER_COUNT] = [ - match const_hex::const_decode_to_array( - b"038bd8c3227297d59b6b64dd41c38b9d3b72202d7ecb87f65de99d397d76872cbd", - ) { - Ok(pub_key) => pub_key, - Err(_) => { - panic!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY must be valid 33-byte hex string") - } - }, - match const_hex::const_decode_to_array( - b"0266be33af7844b1d9b0732fe1ae4c1a1dd5fd21c8901e015cee87076cf6cafcc6", - ) { - Ok(pub_key) => pub_key, - Err(_) => { - panic!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY must be valid 33-byte hex string") - } - }, - match const_hex::const_decode_to_array( - b"02f3ee46b8e82c526a3c9b5db63a5220decdbd6289f7a31c1ce73bd8683abae272", - ) { - Ok(pub_key) => pub_key, - Err(_) => { - panic!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY must be valid 33-byte hex string") - } - }, - match const_hex::const_decode_to_array( - b"027b89f75fd042874b8ee9fa3d6429c3d7b71c2d5de953800df1c0169156f1cea7", - ) { - Ok(pub_key) => pub_key, - Err(_) => { - panic!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY must be valid 33-byte hex string") - } - }, - match const_hex::const_decode_to_array( - b"03a955c047a3fefdcd0548d91ed83e865436fbfa19138179af0cf1db83c694a0e1", - ) { - Ok(pub_key) => pub_key, - Err(_) => { - panic!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY must be valid 33-byte hex string") - } - }, + // TODO: Remove place holder addresses + address!("0xffffffffffffffffffffffffffffffffffffffff"), + address!("0xffffffffffffffffffffffffffffffffffffffff"), + address!("0xffffffffffffffffffffffffffffffffffffffff"), + address!("0xffffffffffffffffffffffffffffffffffffffff"), + address!("0xffffffffffffffffffffffffffffffffffffffff"), ]; - /// Public keys of the method ID upgrade authority in the Bitcoin DA on Nightly. - /// This public key is set at compile time via the `METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY` environment variable. - /// If the variable is not set, it defaults to a predefined value. + /// Addresses of the method ID upgrade authority in the Bitcoin DA on Nightly. + /// These addresses are set at compile time via the `METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS` environment variable. + /// If the variables are not set, they default to a predefined value. /// 3 out of 5 signatures are required to upgrade method IDs. - pub const NIGHTLY_METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS: [[u8; - SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE]; + pub const NIGHTLY_METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES: [Address; SECURITY_COUNCIL_MEMBER_COUNT] = [ { - let hex_pub_key = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_1") { + let address_str = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_1") { Some(k) => k, // Private key: 79122E48DF1A002FB6584B2E94D0D50F95037416C82DAF280F21CD67D17D9077 - None => "0313c4ff65eb94999e0ac41cfe21592baa52910f5a5ada9074b816de4f560189db", + None => "0xd51bd554b82aa486f56030bef90b70a27a4f6d20", }; - match const_hex::const_decode_to_array(hex_pub_key.as_bytes()) { - Ok(pk) => pk, + match const_hex::const_decode_to_array(address_str.as_bytes()) { + Ok(address) => Address::new(address), Err(_) => panic!( - "METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_1 must be valid 33-byte hex string" + "METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_1 must be valid 20-byte hex string" ), } }, { - let hex_pub_key = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_2") { + let address_str = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_2") { Some(k) => k, // Private key: 79122E48DF1A002FB6584B2E94D0D50F95037416C82DAF280F21CD67D17D9076 - None => "03b15df91f38ec6e0520b71fca528780820e75541f3371f6389a4f77ad0e5b823e", + None => "0xfef24931c137d6c0df4f76116e0e58d281203360", }; - match const_hex::const_decode_to_array(hex_pub_key.as_bytes()) { - Ok(pk) => pk, + match const_hex::const_decode_to_array(address_str.as_bytes()) { + Ok(address) => Address::new(address), Err(_) => panic!( - "METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_2 must be valid 33-byte hex string" + "METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_2 must be valid 20-byte hex string" ), } }, { - let hex_pub_key = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_3") { + let address_str = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_3") { Some(k) => k, // Private key: 79122E48DF1A002FB6584B2E94D0D50F95037416C82DAF280F21CD67D17D9075 - None => "03fb89fd189501b9f55863a8194a8daff5b684cc52c0c21092f02ce428374c59f7", + None => "0xbb3833932330eef589dd56e855f2ca1ac015d200", }; - match const_hex::const_decode_to_array(hex_pub_key.as_bytes()) { - Ok(pk) => pk, + match const_hex::const_decode_to_array(address_str.as_bytes()) { + Ok(address) => Address::new(address), Err(_) => panic!( - "METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_3 must be valid 33-byte hex string" + "METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_3 must be valid 20-byte hex string" ), } }, { - let hex_pub_key = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_4") { + let address_str = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_4") { Some(k) => k, // Private key: 79122E48DF1A002FB6584B2E94D0D50F95037416C82DAF280F21CD67D17D9074 - None => "037d415a6027c2dc598c3ee52e6e93e0b61dabf9ea224895533a4de34fef4b91e0", + None => "0xe976fdbc72670c34b7973ae3fa7d38478eade018", }; - match const_hex::const_decode_to_array(hex_pub_key.as_bytes()) { - Ok(pk) => pk, + match const_hex::const_decode_to_array(address_str.as_bytes()) { + Ok(address) => Address::new(address), Err(_) => panic!( - "METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_4 must be valid 33-byte hex string" + "METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_4 must be valid 20-byte hex string" ), } }, { - let hex_pub_key = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_5") { + let address_str = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_5") { Some(k) => k, // Private key: 79122E48DF1A002FB6584B2E94D0D50F95037416C82DAF280F21CD67D17D9073 - None => "022fad5142da490bed9c86beda47fe8538ec184d12e39db55ebf3ec41d180352d0", + None => "0x8632ebc44c4515c9b85fae29eae3fd3722fd35ea", }; - match const_hex::const_decode_to_array(hex_pub_key.as_bytes()) { - Ok(pk) => pk, + match const_hex::const_decode_to_array(address_str.as_bytes()) { + Ok(address) => Address::new(address), Err(_) => panic!( - "METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_5 must be valid 33-byte hex string" + "METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_5 must be valid 20-byte hex string" ), } }, ]; - /// Public keys of the method ID upgrade authority in the Bitcoin DA on Test Network with Forks. - /// This public key is set at compile time via the `METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY` environment variable. - /// If the variable is not set, it defaults to a predefined value. + /// Addresses of the method ID upgrade authority in the Bitcoin DA on Test Network with Forks. + /// These addresses are set at compile time via the `METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS` environment variable. + /// If the variables are not set, they default to a predefined value. /// 3 out of 5 signatures are required to upgrade method IDs. - pub const TEST_NETWORK_WITH_FORKS_METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS: [[u8; - SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE]; + pub const TEST_NETWORK_WITH_FORKS_METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES: [Address; SECURITY_COUNCIL_MEMBER_COUNT] = [ { - let hex_pub_key = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_1") { + let address_str = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_1") { Some(k) => k, // Private key: 79122E48DF1A002FB6584B2E94D0D50F95037416C82DAF280F21CD67D17D9077 - None => "0313c4ff65eb94999e0ac41cfe21592baa52910f5a5ada9074b816de4f560189db", + None => "0xd51bd554b82aa486f56030bef90b70a27a4f6d20", }; - match const_hex::const_decode_to_array(hex_pub_key.as_bytes()) { - Ok(pk) => pk, + match const_hex::const_decode_to_array(address_str.as_bytes()) { + Ok(address) => Address::new(address), Err(_) => panic!( - "METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_1 must be valid 33-byte hex string" + "METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_1 must be valid 20-byte hex string" ), } }, { - let hex_pub_key = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_2") { + let address_str = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_2") { Some(k) => k, // Private key: 79122E48DF1A002FB6584B2E94D0D50F95037416C82DAF280F21CD67D17D9076 - None => "03b15df91f38ec6e0520b71fca528780820e75541f3371f6389a4f77ad0e5b823e", + None => "0xfef24931c137d6c0df4f76116e0e58d281203360", }; - match const_hex::const_decode_to_array(hex_pub_key.as_bytes()) { - Ok(pk) => pk, + match const_hex::const_decode_to_array(address_str.as_bytes()) { + Ok(address) => Address::new(address), Err(_) => panic!( - "METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_2 must be valid 33-byte hex string" + "METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_2 must be valid 20-byte hex string" ), } }, { - let hex_pub_key = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_3") { + let address_str = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_3") { Some(k) => k, // Private key: 79122E48DF1A002FB6584B2E94D0D50F95037416C82DAF280F21CD67D17D9075 - None => "03fb89fd189501b9f55863a8194a8daff5b684cc52c0c21092f02ce428374c59f7", + None => "0xbb3833932330eef589dd56e855f2ca1ac015d200", }; - match const_hex::const_decode_to_array(hex_pub_key.as_bytes()) { - Ok(pk) => pk, + match const_hex::const_decode_to_array(address_str.as_bytes()) { + Ok(address) => Address::new(address), Err(_) => panic!( - "METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_3 must be valid 33-byte hex string" + "METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_3 must be valid 20-byte hex string" ), } }, { - let hex_pub_key = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_4") { + let address_str = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_4") { Some(k) => k, // Private key: 79122E48DF1A002FB6584B2E94D0D50F95037416C82DAF280F21CD67D17D9074 - None => "037d415a6027c2dc598c3ee52e6e93e0b61dabf9ea224895533a4de34fef4b91e0", + None => "0xe976fdbc72670c34b7973ae3fa7d38478eade018", }; - match const_hex::const_decode_to_array(hex_pub_key.as_bytes()) { - Ok(pk) => pk, + match const_hex::const_decode_to_array(address_str.as_bytes()) { + Ok(address) => Address::new(address), Err(_) => panic!( - "METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_4 must be valid 33-byte hex string" + "METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_4 must be valid 20-byte hex string" ), } }, { - let hex_pub_key = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_5") { + let address_str = match option_env!("METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_5") { Some(k) => k, // Private key: 79122E48DF1A002FB6584B2E94D0D50F95037416C82DAF280F21CD67D17D9073 - None => "022fad5142da490bed9c86beda47fe8538ec184d12e39db55ebf3ec41d180352d0", + None => "0x8632ebc44c4515c9b85fae29eae3fd3722fd35ea", }; - match const_hex::const_decode_to_array(hex_pub_key.as_bytes()) { - Ok(pk) => pk, + match const_hex::const_decode_to_array(address_str.as_bytes()) { + Ok(address) => Address::new(address), Err(_) => panic!( - "METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEY_5 must be valid 33-byte hex string" + "METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESS_5 must be valid 20-byte hex string" ), } }, @@ -662,9 +535,9 @@ pub trait InitialValueProvider { fn sequencer_da_public_key(&self) -> [u8; 33]; /// Returns the public key of the method ID upgrade authority. - fn method_id_upgrade_authority_da_public_keys( + fn method_id_upgrade_authority_da_addresses( &self, - ) -> [[u8; SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE]; SECURITY_COUNCIL_MEMBER_COUNT]; + ) -> [alloy_primitives::Address; SECURITY_COUNCIL_MEMBER_COUNT]; } #[cfg(feature = "native")] @@ -684,11 +557,11 @@ impl InitialValueProvider for Network { mockda::BATCH_PROVER_DA_PUBLIC_KEY } - fn method_id_upgrade_authority_da_public_keys( + fn method_id_upgrade_authority_da_addresses( &self, - ) -> [[u8; SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE]; SECURITY_COUNCIL_MEMBER_COUNT] { + ) -> [alloy_primitives::Address; SECURITY_COUNCIL_MEMBER_COUNT] { assert_eq!(self, &Network::Nightly, "Only nightly allowed on mock da!"); - mockda::METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS + mockda::METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES } fn sequencer_da_public_key(&self) -> [u8; 33] { @@ -733,16 +606,16 @@ impl InitialValueProvider for Network { } } - fn method_id_upgrade_authority_da_public_keys( + fn method_id_upgrade_authority_da_addresses( &self, - ) -> [[u8; SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE]; SECURITY_COUNCIL_MEMBER_COUNT] { + ) -> [alloy_primitives::Address; SECURITY_COUNCIL_MEMBER_COUNT] { match self { - Network::Mainnet => bitcoinda::MAINNET_METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, - Network::Testnet => bitcoinda::TESTNET_METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, - Network::Devnet => bitcoinda::DEVNET_METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, - Network::Nightly => bitcoinda::NIGHTLY_METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + Network::Mainnet => bitcoinda::MAINNET_METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, + Network::Testnet => bitcoinda::TESTNET_METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, + Network::Devnet => bitcoinda::DEVNET_METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, + Network::Nightly => bitcoinda::NIGHTLY_METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::TestNetworkWithForks => { - bitcoinda::TEST_NETWORK_WITH_FORKS_METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS + bitcoinda::TEST_NETWORK_WITH_FORKS_METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES } } } diff --git a/crates/light-client-prover/src/circuit/method_id_verifier.rs b/crates/light-client-prover/src/circuit/method_id_verifier.rs index dd98857361..01ba457747 100644 --- a/crates/light-client-prover/src/circuit/method_id_verifier.rs +++ b/crates/light-client-prover/src/circuit/method_id_verifier.rs @@ -1,19 +1,48 @@ -use alloy_primitives::eip191_hash_message; -use k256::ecdsa::signature::hazmat::PrehashVerifier; -use k256::ecdsa::{Signature, VerifyingKey}; +use alloy_primitives::{eip191_hash_message, keccak256, Address}; +use k256::ecdsa::VerifyingKey; use sov_rollup_interface::da::{ SECURITY_COUNCIL_SIGNATURE_SIZE, SECURITY_COUNCIL_SIGNATURE_THRESHOLD, }; -use crate::circuit::{SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE, SECURITY_COUNCIL_MEMBER_COUNT}; +use crate::circuit::SECURITY_COUNCIL_MEMBER_COUNT; + +/// Error type for public key recovery operations +#[derive(Debug, Clone)] +pub enum PubKeyRecoveryError { + /// Invalid signature length + InvalidSignatureLength, + /// Invalid hash length + InvalidHashLength, + /// Invalid recovery ID (v value) + InvalidRecoveryId(u8), + /// Failed to parse signature bytes + InvalidSignatureBytes(String), + /// Failed to recover the public key + RecoveryFailed(String), +} + +impl std::fmt::Display for PubKeyRecoveryError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + PubKeyRecoveryError::InvalidSignatureLength => write!(f, "Invalid Signature Length"), + PubKeyRecoveryError::InvalidHashLength => write!(f, "Invalid Hash Length"), + PubKeyRecoveryError::InvalidRecoveryId(recovery_id) => { + write!(f, "Invalid Recovery Id: {recovery_id}") + } + PubKeyRecoveryError::InvalidSignatureBytes(bytes_str) => { + write!(f, "Invalid Signature Bytes: {bytes_str}") + } + PubKeyRecoveryError::RecoveryFailed(e) => write!(f, "Recovery Failed with error: {e}"), + } + } +} /// The three out of 5 signatures should be verified for the method id upgrade to be valid. /// For each signature, the corresponding public key from the initial values constants is used to verify the signature. /// If there are less than 3 valid signatures, the verification fails. /// Note that the pubkey indices of signatures must be in strict ascending order and within bounds [0,(SECURITY_COUNCIL_MEMBER_COUNT - 1)] pub fn verify_method_id_security_council( - initial_da_pubkeys: [[u8; SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE]; - SECURITY_COUNCIL_MEMBER_COUNT], + initial_da_addresses: [Address; SECURITY_COUNCIL_MEMBER_COUNT], msg: &[u8], signatures_with_idx: &[([u8; SECURITY_COUNCIL_SIGNATURE_SIZE], u8); SECURITY_COUNCIL_SIGNATURE_THRESHOLD], @@ -43,24 +72,40 @@ pub fn verify_method_id_security_council( for signature_with_idx in signatures_with_idx.iter() { let signature = signature_with_idx.0; - let pubkey_idx = signature_with_idx.1; - let const_pubkey = initial_da_pubkeys[pubkey_idx as usize]; + let address_idx = signature_with_idx.1; + let const_address = initial_da_addresses[address_idx as usize]; + + let recovered_pubkey = match recover_pub_key_from_signature_and_prehash( + signature.as_slice(), + prehash.as_slice(), + ) { + Ok(recovered_pubkey) => recovered_pubkey, + Err(e) => { + log!( + "Failed to recover public key from signature for index {}: {:?}", + address_idx, + e.to_string() + ); + return false; + } + }; - // ensure the inscription pubkey matches the expected constant (compressed 33B) - let verifying_key = VerifyingKey::from_sec1_bytes(const_pubkey.as_slice()) - .expect("Initial DA pubkeys must be parsable to k256 VerifyingKey form sec1 bytes"); + let ep = recovered_pubkey.to_encoded_point(false); // uncompressed form - let Ok(parsed_sig) = Signature::from_bytes(&signature.into()) else { - log!("Invalid signature format"); - return false; // invalid signature format, fail - }; + let bytes = ep.as_bytes(); + debug_assert_eq!(bytes[0], 0x04); + + // Hash the 64 bytes X||Y (skip the 0x04 prefix) + let hash = keccak256(&bytes[1..]); - // verify prehash with the matching verifying key - if verifying_key - .verify_prehash(prehash.as_slice(), &parsed_sig) - .is_err() - { - log!("Signature verification failed for index: {}", pubkey_idx); + // Take last 20 bytes + let address = Address::from_slice(&hash[12..]); + + if address != const_address { + log!( + "Recovered address does not match constant address for index: {}", + address_idx + ); return false; } } @@ -68,6 +113,47 @@ pub fn verify_method_id_security_council( true } +/// Recovers the public key from a signature (65 bytes: r(32) + s(32) + v(1)) and the message prehash. +fn recover_pub_key_from_signature_and_prehash( + signature: &[u8], + message_prehash: &[u8], +) -> Result { + use k256::ecdsa::RecoveryId; + + if signature.len() != 65 { + return Err(PubKeyRecoveryError::InvalidSignatureLength); + } + if message_prehash.len() != 32 { + return Err(PubKeyRecoveryError::InvalidHashLength); + } + + let v = signature[64]; + let recid_u8 = match v { + 0..=3 => v, + 27..=30 => v - 27, + _ => return Err(PubKeyRecoveryError::InvalidRecoveryId(v)), + }; + + let mut y_odd = (recid_u8 & 1) == 1; + let x_reduced = (recid_u8 & 2) == 2; + + let mut signature = k256::ecdsa::Signature::from_slice(&signature[0..64]) + .map_err(|e| PubKeyRecoveryError::InvalidSignatureBytes(format!("{e:?}")))?; + + // low-s normalization requires flipping parity + if let Some(s) = signature.normalize_s() { + signature = s; + y_odd = !y_odd; + } + + VerifyingKey::recover_from_prehash( + message_prehash, + &signature, + RecoveryId::new(y_odd, x_reduced), + ) + .map_err(|e| PubKeyRecoveryError::RecoveryFailed(format!("{e:?}"))) +} + #[cfg(test)] mod tests { use sov_rollup_interface::da::{BatchProofMethodId, BatchProofMethodIdBody}; @@ -75,7 +161,7 @@ mod tests { use super::*; use crate::circuit::citrea_network_to_chain_id; - use crate::{create_valid_signatures, generate_initial_pub_keys_with_signers}; + use crate::{create_valid_signatures, generate_initial_addresses_with_signers}; #[test] fn test_valid_signatures() { @@ -87,7 +173,7 @@ mod tests { let msg = body.serialize(); let prehash = eip191_hash_message(msg); - let (initial_pubkeys, signers) = generate_initial_pub_keys_with_signers(); + let (initial_addresses, signers) = generate_initial_addresses_with_signers(); let signatures_with_index = create_valid_signatures(&signers, &prehash); @@ -101,7 +187,7 @@ mod tests { }; assert!(verify_method_id_security_council( - initial_pubkeys, + initial_addresses, batch_proof_method_id.body.serialize().as_slice(), &batch_proof_method_id.signatures_with_index )); @@ -117,7 +203,7 @@ mod tests { let msg = body.serialize(); let prehash = eip191_hash_message(msg); - let (initial_pubkeys, signers) = generate_initial_pub_keys_with_signers(); + let (initial_addresses, signers) = generate_initial_addresses_with_signers(); let mut signatures_with_index = create_valid_signatures(&signers, &prehash); @@ -129,7 +215,7 @@ mod tests { signatures_with_index, }; assert!(!verify_method_id_security_council( - initial_pubkeys, + initial_addresses, batch_proof_method_id.body.serialize().as_slice(), &batch_proof_method_id.signatures_with_index )); @@ -145,7 +231,7 @@ mod tests { let msg = body.serialize(); let prehash = eip191_hash_message(msg); - let (initial_pubkeys, signers) = generate_initial_pub_keys_with_signers(); + let (initial_addresses, signers) = generate_initial_addresses_with_signers(); let mut signatures_with_index = create_valid_signatures(&signers, &prehash); @@ -157,7 +243,7 @@ mod tests { signatures_with_index, }; assert!(!verify_method_id_security_council( - initial_pubkeys, + initial_addresses, batch_proof_method_id.body.serialize().as_slice(), &batch_proof_method_id.signatures_with_index )); @@ -172,7 +258,7 @@ mod tests { }; let msg = body.serialize(); let prehash = eip191_hash_message(msg); - let (initial_pubkeys, signers) = generate_initial_pub_keys_with_signers(); + let (initial_addresses, signers) = generate_initial_addresses_with_signers(); let mut signatures_with_index = create_valid_signatures(&signers, &prehash); // Set an out-of-bounds index signatures_with_index[0].1 = 5; // valid indexes are 0- @@ -181,7 +267,7 @@ mod tests { signatures_with_index, }; assert!(!verify_method_id_security_council( - initial_pubkeys, + initial_addresses, batch_proof_method_id.body.serialize().as_slice(), &batch_proof_method_id.signatures_with_index )); @@ -197,7 +283,7 @@ mod tests { let msg = body.serialize(); let prehash = eip191_hash_message(msg); - let (initial_pubkeys, signers) = generate_initial_pub_keys_with_signers(); + let (initial_addresses, signers) = generate_initial_addresses_with_signers(); let mut signatures_with_index = create_valid_signatures(&signers, &prehash); @@ -213,7 +299,7 @@ mod tests { // Should not verify because points to different pubkeys now assert!(!verify_method_id_security_council( - initial_pubkeys, + initial_addresses, batch_proof_method_id.body.serialize().as_slice(), &batch_proof_method_id.signatures_with_index )); @@ -225,6 +311,7 @@ mod tests { fn test_eip191_signature_verification() { use alloy_signer::SignerSync; use alloy_signer_local::PrivateKeySigner; + use k256::ecdsa::signature::hazmat::PrehashVerifier; // signature created with cast: cast wallet sign --private-key d38ba32d6971702225da49b49baac41c5a7ec2f5e3f2bb426976195ccd3266f7 0x48656c6c6f2c20776f726c6421 let msg = b"Hello, world!"; @@ -243,8 +330,11 @@ fn test_eip191_signature_verification() { let prehash = eip191_hash_message(msg); let eip_191_signature = signer.sign_hash_sync(&prehash).unwrap(); - let recovered_pub_key = - recover_pub_key_from_cast_sig_and_hash(&eip_191_signature.as_bytes(), prehash.as_slice()); + let recovered_pub_key = recover_pub_key_from_signature_and_prehash( + &eip_191_signature.as_bytes(), + prehash.as_slice(), + ) + .unwrap(); assert_eq!(pubkey, recovered_pub_key.to_sec1_bytes()); @@ -262,19 +352,3 @@ fn test_eip191_signature_verification() { .verify_prehash(prehash.as_slice(), &signature) .is_ok()); } - -/// Recovers the public key from a cast-style signature (65 bytes: r(32) + s(32) + v(1)) and the message hash. -#[cfg(test)] -fn recover_pub_key_from_cast_sig_and_hash(cast_sig: &[u8], hash: &[u8]) -> VerifyingKey { - use k256::ecdsa::RecoveryId; - assert_eq!(cast_sig.len(), 65, "Invalid signature length"); - assert_eq!(hash.len(), 32, "Invalid hash length"); - - let y_odd = cast_sig[64] - 27; - let y_odd = y_odd != 0; - - let signature = k256::ecdsa::Signature::from_slice(&cast_sig[0..64]).unwrap(); - - VerifyingKey::recover_from_prehash(hash, &signature, RecoveryId::new(y_odd, false)) - .expect("Failed to recover public key") -} diff --git a/crates/light-client-prover/src/circuit/mod.rs b/crates/light-client-prover/src/circuit/mod.rs index aecdd47713..e053ada3fc 100644 --- a/crates/light-client-prover/src/circuit/mod.rs +++ b/crates/light-client-prover/src/circuit/mod.rs @@ -7,6 +7,7 @@ use accessors::{ BatchProofMethodIdAccessor, BlockHashAccessor, ChunkAccessor, SequencerCommitmentAccessor, VerifiedStateTransitionForSequencerCommitmentIndexAccessor, }; +use alloy_primitives::Address; use borsh::BorshDeserialize; use citrea_primitives::{network_to_dev_mode, MAX_COMPRESSED_BLOB_SIZE}; use initial_values::LCP_JMT_GENESIS_ROOT; @@ -366,7 +367,7 @@ impl LightClientProofCircuit { /// * `initial_batch_proof_method_ids` - The initial batch proof method IDs that are used to initialize the batch proof method IDs in the JMT state if this is the first light client proof output. /// * `batch_prover_da_public_key` - The public key of the batch prover to check the sender of the batch proof transactions. /// * `sequencer_da_public_key` - The public key of the sequencer to check the sender of the sequencer commitment transactions. - /// * `method_id_upgrade_authority_da_public_key` - The public key of the method ID upgrade authority to check the sender of the batch proof method ID transactions. + /// * `method_id_upgrade_authority_da_addresses` - The addresses of the method ID upgrade authority to be verified against the signatures by recovering pubkeys. /// /// # Logic /// - The block hash of the header is inserted into the JMT. @@ -393,8 +394,7 @@ impl LightClientProofCircuit { initial_batch_proof_method_ids: InitialBatchProofMethodIds, batch_prover_da_public_key: &[u8], sequencer_da_public_key: &[u8], - method_id_upgrade_authority_da_public_keys: &[[u8; SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE]; - SECURITY_COUNCIL_MEMBER_COUNT], + method_id_upgrade_authority_da_addresses: &[Address; SECURITY_COUNCIL_MEMBER_COUNT], ) -> RunL1BlockResult { let mut working_set = WorkingSet::with_witness(storage.clone(), witness, Default::default()); @@ -550,7 +550,7 @@ impl LightClientProofCircuit { // Verify the signatures only if the activation height is greater than the last one // This prevents replay attacks of old method IDs if !verify_method_id_security_council( - *method_id_upgrade_authority_da_public_keys, + *method_id_upgrade_authority_da_addresses, batch_proof_method_id.body.serialize().as_slice(), batch_proof_method_id.signatures_with_index(), ) { @@ -676,8 +676,7 @@ impl LightClientProofCircuit { initial_batch_proof_method_ids: InitialBatchProofMethodIds, batch_prover_da_public_key: &[u8], sequencer_da_public_key: &[u8], - method_id_upgrade_authority_da_public_keys: &[[u8; SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE]; - SECURITY_COUNCIL_MEMBER_COUNT], + method_id_upgrade_authority_da_addresses: &[Address; SECURITY_COUNCIL_MEMBER_COUNT], ) -> Result> where DaV: DaVerifier, @@ -735,7 +734,7 @@ impl LightClientProofCircuit { initial_batch_proof_method_ids, batch_prover_da_public_key, sequencer_da_public_key, - method_id_upgrade_authority_da_public_keys, + method_id_upgrade_authority_da_addresses, ); Ok(LightClientCircuitOutput { diff --git a/crates/light-client-prover/src/da_block_handler.rs b/crates/light-client-prover/src/da_block_handler.rs index c7455c0b08..4251cafb08 100644 --- a/crates/light-client-prover/src/da_block_handler.rs +++ b/crates/light-client-prover/src/da_block_handler.rs @@ -251,7 +251,7 @@ where self.network.initial_batch_proof_method_ids().to_vec(), &self.network.batch_prover_da_public_key(), &self.network.sequencer_da_public_key(), - &self.network.method_id_upgrade_authority_da_public_keys(), + &self.network.method_id_upgrade_authority_da_addresses(), ); // This is not exactly right, but works for now because we have a single elf for diff --git a/crates/light-client-prover/src/tests/mod.rs b/crates/light-client-prover/src/tests/mod.rs index 77a1479340..5d33ca2000 100644 --- a/crates/light-client-prover/src/tests/mod.rs +++ b/crates/light-client-prover/src/tests/mod.rs @@ -20,7 +20,7 @@ use crate::circuit::accessors::{ BatchProofMethodIdAccessor, SequencerCommitmentAccessor, VerifiedStateTransitionForSequencerCommitmentIndexAccessor, }; -use crate::circuit::initial_values::mockda::METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS; +use crate::circuit::initial_values::mockda::METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES; use crate::circuit::{LightClientProofCircuit, LightClientVerificationError}; type Height = u64; @@ -85,7 +85,7 @@ fn test_light_client_circuit_valid_da_valid_data() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -99,7 +99,7 @@ fn test_light_client_circuit_valid_da_valid_data() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -150,7 +150,7 @@ fn test_light_client_circuit_valid_da_valid_data() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -164,7 +164,7 @@ fn test_light_client_circuit_valid_da_valid_data() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -243,7 +243,7 @@ fn test_light_client_circuit_commitment_chaining() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -257,7 +257,7 @@ fn test_light_client_circuit_commitment_chaining() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -321,7 +321,7 @@ fn test_previous_commitment_not_set_should_not_transition() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -335,7 +335,7 @@ fn test_previous_commitment_not_set_should_not_transition() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -385,7 +385,7 @@ fn test_batch_proof_with_missing_commitment_not_set_should_not_transition() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -399,7 +399,7 @@ fn test_batch_proof_with_missing_commitment_not_set_should_not_transition() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -462,7 +462,7 @@ fn test_wrong_order_da_blocks_should_still_work() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -476,7 +476,7 @@ fn test_wrong_order_da_blocks_should_still_work() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -547,7 +547,7 @@ fn create_unchainable_outputs_then_chain_them_on_next_block() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -561,7 +561,7 @@ fn create_unchainable_outputs_then_chain_them_on_next_block() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -627,7 +627,7 @@ fn create_unchainable_outputs_then_chain_them_on_next_block() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -641,7 +641,7 @@ fn create_unchainable_outputs_then_chain_them_on_next_block() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -705,7 +705,7 @@ fn test_header_chain_proof_height_and_hash() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -719,7 +719,7 @@ fn test_header_chain_proof_height_and_hash() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -771,7 +771,7 @@ fn test_header_chain_proof_height_and_hash() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -785,7 +785,7 @@ fn test_header_chain_proof_height_and_hash() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ); assert!(matches!( res, @@ -860,7 +860,7 @@ fn test_unverifiable_batch_proofs() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -874,7 +874,7 @@ fn test_unverifiable_batch_proofs() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -952,7 +952,7 @@ fn test_unverifiable_prev_light_client_proof() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -966,7 +966,7 @@ fn test_unverifiable_prev_light_client_proof() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -1005,7 +1005,7 @@ fn test_unverifiable_prev_light_client_proof() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -1019,7 +1019,7 @@ fn test_unverifiable_prev_light_client_proof() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); } @@ -1068,7 +1068,7 @@ fn test_new_method_id_txs() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -1082,7 +1082,7 @@ fn test_new_method_id_txs() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key.clone(), &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); let mut working_set = WorkingSet::new( @@ -1116,7 +1116,7 @@ fn test_new_method_id_txs() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -1130,7 +1130,7 @@ fn test_new_method_id_txs() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); let batch_proof_method_ids = @@ -1162,7 +1162,7 @@ fn test_new_method_id_txs() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -1176,7 +1176,7 @@ fn test_new_method_id_txs() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key.clone(), &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -1228,7 +1228,7 @@ fn test_wrong_network_method_id_update_should_fail() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -1242,7 +1242,7 @@ fn test_wrong_network_method_id_update_should_fail() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); let mut working_set = WorkingSet::new( @@ -1311,7 +1311,7 @@ fn test_unverifiable_batch_proof_is_ignored() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -1325,7 +1325,7 @@ fn test_unverifiable_batch_proof_is_ignored() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key.clone(), &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -1440,7 +1440,7 @@ fn test_light_client_circuit_verify_chunks() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -1454,7 +1454,7 @@ fn test_light_client_circuit_verify_chunks() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key.clone(), &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -1557,7 +1557,7 @@ fn test_missing_chunk() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -1571,7 +1571,7 @@ fn test_missing_chunk() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key.clone(), &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -1661,7 +1661,7 @@ fn test_light_client_circuit_aggregate_size_overflow() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -1675,7 +1675,7 @@ fn test_light_client_circuit_aggregate_size_overflow() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key.clone(), &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -1755,7 +1755,7 @@ fn test_malicious_aggregate_should_not_work() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -1769,7 +1769,7 @@ fn test_malicious_aggregate_should_not_work() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key.clone(), &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -1808,7 +1808,7 @@ fn test_malicious_aggregate_should_not_work() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -1822,7 +1822,7 @@ fn test_malicious_aggregate_should_not_work() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key.clone(), &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -1874,7 +1874,7 @@ fn test_malicious_aggregate_should_not_work() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -1888,7 +1888,7 @@ fn test_malicious_aggregate_should_not_work() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key.clone(), &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -1960,7 +1960,7 @@ fn test_unknown_block_hash_in_batch_proof_not_verified() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -1974,7 +1974,7 @@ fn test_unknown_block_hash_in_batch_proof_not_verified() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -2033,7 +2033,7 @@ fn test_unknown_block_hash_in_batch_proof_not_verified() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -2047,7 +2047,7 @@ fn test_unknown_block_hash_in_batch_proof_not_verified() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -2102,7 +2102,7 @@ fn test_light_client_circuit_verify_sequencer_commitment() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -2116,7 +2116,7 @@ fn test_light_client_circuit_verify_sequencer_commitment() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key.clone(), &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -2153,7 +2153,7 @@ fn test_light_client_circuit_verify_sequencer_commitment() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -2167,7 +2167,7 @@ fn test_light_client_circuit_verify_sequencer_commitment() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key.clone(), &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -2229,7 +2229,7 @@ fn wrong_pubkey_sequencer_commitment_should_not_work() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -2243,7 +2243,7 @@ fn wrong_pubkey_sequencer_commitment_should_not_work() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key.clone(), &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -2280,7 +2280,7 @@ fn wrong_pubkey_sequencer_commitment_should_not_work() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -2294,7 +2294,7 @@ fn wrong_pubkey_sequencer_commitment_should_not_work() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key.clone(), &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -2370,7 +2370,7 @@ fn test_lcp_input_values_cant_be_tampered() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -2384,7 +2384,7 @@ fn test_lcp_input_values_cant_be_tampered() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -2411,7 +2411,7 @@ fn test_lcp_input_values_cant_be_tampered() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -2465,7 +2465,7 @@ fn test_lcp_input_values_cant_be_tampered() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); } @@ -2525,7 +2525,7 @@ fn test_lcp_cant_be_passed_roots_from_a_different_tree() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -2539,7 +2539,7 @@ fn test_lcp_cant_be_passed_roots_from_a_different_tree() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); @@ -2572,7 +2572,7 @@ fn test_lcp_cant_be_passed_roots_from_a_different_tree() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::Nightly, ); @@ -2586,7 +2586,7 @@ fn test_lcp_cant_be_passed_roots_from_a_different_tree() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &batch_prover_da_pub_key, &sequencer_da_pub_key, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); } diff --git a/crates/light-client-prover/src/tests/test_utils.rs b/crates/light-client-prover/src/tests/test_utils.rs index a82b5d5d2a..3d90af803b 100644 --- a/crates/light-client-prover/src/tests/test_utils.rs +++ b/crates/light-client-prover/src/tests/test_utils.rs @@ -2,7 +2,7 @@ use std::collections::BTreeMap; use std::path::PathBuf; use std::sync::Arc; -use alloy_primitives::{eip191_hash_message, B256}; +use alloy_primitives::{eip191_hash_message, keccak256, Address, B256}; use alloy_signer::SignerSync; use alloy_signer_local::PrivateKeySigner; use rand::{thread_rng, Rng}; @@ -241,25 +241,25 @@ pub(crate) fn generate_initial_pub_keys_with_signers_from_pks( } /// Generates 5 valid keypairs and returns the public keys and signers -pub(crate) fn generate_initial_pub_keys_with_signers() -> ( - [[u8; SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE]; SECURITY_COUNCIL_MEMBER_COUNT], +pub(crate) fn generate_initial_addresses_with_signers() -> ( + [Address; SECURITY_COUNCIL_MEMBER_COUNT], Vec, ) { - let mut initial_da_pubkeys = - [[0u8; SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE]; SECURITY_COUNCIL_MEMBER_COUNT]; + let mut initial_da_addresses = [Address::random(); SECURITY_COUNCIL_MEMBER_COUNT]; let mut signers = Vec::new(); // Generate 5 valid keypairs and signatures - for (i, public_key) in initial_da_pubkeys.iter_mut().enumerate() { + for (i, address) in initial_da_addresses.iter_mut().enumerate() { let secret_key = [i as u8 + 1; 32]; let signer = PrivateKeySigner::from_bytes(&secret_key.into()).unwrap(); let verifying_key = signer.credential().verifying_key(); - let pubkey = verifying_key.to_sec1_bytes(); - *public_key = pubkey.to_vec().try_into().unwrap(); + let ep = verifying_key.to_encoded_point(false); // uncompressed: 0x04 + X(32) + Y(32) + let bytes = ep.as_bytes(); + *address = Address::from_slice(&keccak256(&bytes[1..])[12..]); signers.push(signer); } - (initial_da_pubkeys, signers) + (initial_da_addresses, signers) } /// Creates 3 valid signatures from the first 3 signers for the given prehash @@ -386,8 +386,7 @@ impl NativeCircuitRunner { initial_batch_proof_method_ids: Vec<(u64, [u32; 8])>, batch_prover_da_pub_key: &[u8], sequencer_da_pub_key: &[u8], - method_id_upgrade_authority: &[[u8; SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE]; - SECURITY_COUNCIL_MEMBER_COUNT], + method_id_upgrade_authority: &[Address; SECURITY_COUNCIL_MEMBER_COUNT], network: Network, ) -> LightClientCircuitInput { let prover_storage = self diff --git a/crates/sovereign-sdk/rollup-interface/src/state_machine/da.rs b/crates/sovereign-sdk/rollup-interface/src/state_machine/da.rs index bdb68e5aa1..9346b397ab 100644 --- a/crates/sovereign-sdk/rollup-interface/src/state_machine/da.rs +++ b/crates/sovereign-sdk/rollup-interface/src/state_machine/da.rs @@ -13,7 +13,8 @@ use crate::{BasicAddress, Network}; /// Minimum number of verified signatures required to approve a method id upgrade. pub const SECURITY_COUNCIL_SIGNATURE_THRESHOLD: usize = 3; /// Size of a signature in bytes. -pub const SECURITY_COUNCIL_SIGNATURE_SIZE: usize = 64; +/// 65 bytes long (r(32) + s(32) + v(1)) +pub const SECURITY_COUNCIL_SIGNATURE_SIZE: usize = 65; /// Commitments made to the DA layer from the sequencer. /// Has merkle root of l2 block hashes from L1 start block to L1 end block (inclusive) diff --git a/guests/risc0/light-client-proof/bitcoin/Cargo.lock b/guests/risc0/light-client-proof/bitcoin/Cargo.lock index 08ccc71e7e..1392c53f12 100644 --- a/guests/risc0/light-client-proof/bitcoin/Cargo.lock +++ b/guests/risc0/light-client-proof/bitcoin/Cargo.lock @@ -1616,6 +1616,7 @@ dependencies = [ name = "light-client-proof-bitcoin" version = "1.2.0" dependencies = [ + "alloy-primitives", "anyhow", "bitcoin-da", "citrea-light-client-prover", diff --git a/guests/risc0/light-client-proof/bitcoin/Cargo.toml b/guests/risc0/light-client-proof/bitcoin/Cargo.toml index a1407586cf..313b179dea 100644 --- a/guests/risc0/light-client-proof/bitcoin/Cargo.toml +++ b/guests/risc0/light-client-proof/bitcoin/Cargo.toml @@ -14,6 +14,7 @@ risc0-bigint2 = "1.4.10" risc0-zkvm = { version = "3.0.3", default-features = false, features = ["unstable", "std"] } risc0-zkvm-platform = { version = "2.2.0" } +alloy-primitives = { version = "0.8.26", default-features = false, features = ["serde", "tiny-keccak", "k256"] } anyhow = "1.0.95" bitcoin-da = { path = "../../../../crates/bitcoin-da", default-features = false } citrea-light-client-prover = { path = "../../../../crates/light-client-prover", default-features = false } diff --git a/guests/risc0/light-client-proof/bitcoin/src/bin/light_client_proof_bitcoin.rs b/guests/risc0/light-client-proof/bitcoin/src/bin/light_client_proof_bitcoin.rs index 2ac94acdf3..ebd20dc284 100644 --- a/guests/risc0/light-client-proof/bitcoin/src/bin/light_client_proof_bitcoin.rs +++ b/guests/risc0/light-client-proof/bitcoin/src/bin/light_client_proof_bitcoin.rs @@ -1,11 +1,10 @@ #![no_main] +use alloy_primitives::Address; use bitcoin_da::spec::{BitcoinSpec, RollupParams}; use bitcoin_da::verifier::BitcoinVerifier; use citrea_light_client_prover::circuit::initial_values::bitcoinda; use citrea_light_client_prover::circuit::initial_values::non_empty_slice::NonEmptySlice; -use citrea_light_client_prover::circuit::{ - LightClientProofCircuit, SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE, SECURITY_COUNCIL_MEMBER_COUNT, -}; +use citrea_light_client_prover::circuit::{LightClientProofCircuit, SECURITY_COUNCIL_MEMBER_COUNT}; use citrea_primitives::REVEAL_TX_PREFIX; use citrea_risc0_adapter::guest::Risc0Guest; use sov_rollup_interface::da::DaVerifier; @@ -67,16 +66,14 @@ const BATCH_PROVER_DA_PUBLIC_KEY: [u8; 33] = { } }; -pub const METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS: [[u8; - SECURITY_COUNCIL_COMPRESSED_PUBKEY_SIZE]; - SECURITY_COUNCIL_MEMBER_COUNT] = { +pub const METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES: [Address; SECURITY_COUNCIL_MEMBER_COUNT] = { match NETWORK { - Network::Mainnet => bitcoinda::MAINNET_METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, - Network::Testnet => bitcoinda::TESTNET_METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, - Network::Devnet => bitcoinda::DEVNET_METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, - Network::Nightly => bitcoinda::NIGHTLY_METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + Network::Mainnet => bitcoinda::MAINNET_METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, + Network::Testnet => bitcoinda::TESTNET_METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, + Network::Devnet => bitcoinda::DEVNET_METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, + Network::Nightly => bitcoinda::NIGHTLY_METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, Network::TestNetworkWithForks => { - bitcoinda::TEST_NETWORK_WITH_FORKS_METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS + bitcoinda::TEST_NETWORK_WITH_FORKS_METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES } } }; @@ -105,7 +102,7 @@ pub fn main() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &BATCH_PROVER_DA_PUBLIC_KEY, &SEQUENCER_DA_PUBLIC_KEY, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap(); diff --git a/guests/risc0/light-client-proof/mock/src/bin/light_client_proof_mock.rs b/guests/risc0/light-client-proof/mock/src/bin/light_client_proof_mock.rs index 603405ddf0..d46899636b 100644 --- a/guests/risc0/light-client-proof/mock/src/bin/light_client_proof_mock.rs +++ b/guests/risc0/light-client-proof/mock/src/bin/light_client_proof_mock.rs @@ -1,7 +1,7 @@ #![no_main] use citrea_light_client_prover::circuit::initial_values::mockda::{ BATCH_PROVER_DA_PUBLIC_KEY, GENESIS_ROOT, INITIAL_BATCH_PROOF_METHOD_IDS, - METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, SEQUENCER_DA_PUBLIC_KEY, + METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, SEQUENCER_DA_PUBLIC_KEY, }; use citrea_light_client_prover::circuit::LightClientProofCircuit; use citrea_risc0_adapter::guest::Risc0Guest; @@ -35,7 +35,7 @@ pub fn main() { INITIAL_BATCH_PROOF_METHOD_IDS.to_vec(), &BATCH_PROVER_DA_PUBLIC_KEY, &SEQUENCER_DA_PUBLIC_KEY, - &METHOD_ID_UPGRADE_AUTHORITY_DA_PUBLIC_KEYS, + &METHOD_ID_UPGRADE_AUTHORITY_DA_ADDRESSES, ) .unwrap();