From 50ac64c37d36e99fb64c5c8942de8b4cd9fab5f3 Mon Sep 17 00:00:00 2001 From: Daniil Polyakov Date: Fri, 31 Jul 2026 13:28:01 +0300 Subject: [PATCH] fix(bedrock): fix new bedrock image setup --- Cargo.lock | 4 + Cargo.toml | 3 + bedrock/deployment-settings.yaml | 157 +++++++++++++++--- bedrock/scripts/run_logos_blockchain_node.sh | 10 +- integration_tests/tests/bridge.rs | 2 +- integration_tests/tests/multi_sequencer.rs | 1 + .../docker-all-in-one/sequencer_config.json | 3 +- lez/sequencer/core/src/block_publisher.rs | 12 +- lez/sequencer/core/src/config.rs | 2 + lez/sequencer/core/src/tests.rs | 2 + .../configs/debug/sequencer_config.json | 3 +- .../configs/docker/sequencer_config.json | 3 +- test_fixtures/Cargo.toml | 5 + test_fixtures/src/config.rs | 32 ++-- test_fixtures/src/setup.rs | 3 +- 15 files changed, 182 insertions(+), 60 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1112061c..c106d05d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10255,12 +10255,15 @@ dependencies = [ "common", "env_logger", "futures", + "hex", "indexer_service", "jsonrpsee", "key_protocol", "lee", "lee_core", "log", + "logos-blockchain-key-management-system-service", + "num-bigint 0.4.6", "programs", "sequencer_core", "sequencer_service", @@ -10269,6 +10272,7 @@ dependencies = [ "serde_json", "tempfile", "testcontainers", + "time", "tokio", "tokio-util", "url", diff --git a/Cargo.toml b/Cargo.toml index 99dd67b8..397eb965 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -132,6 +132,7 @@ openssl = { version = "0.10", features = ["vendored"] } openssl-probe = { version = "0.1.2" } serde = { version = "1.0.60", default-features = false, features = ["derive"] } serde_json = "1.0.81" +serde_yaml = "0.9.34" serde_with = "3.16.1" actix = "0.13.0" actix-cors = "0.7.1" @@ -162,6 +163,7 @@ base64 = "0.22.1" bip39 = "2.2.0" hmac-sha512 = "1.1.7" chrono = "0.4.41" +time = "0.3" borsh = "1.5.7" zstd = "0.13" base58 = "0.2.0" @@ -174,6 +176,7 @@ async-stream = "0.3.6" logos-blockchain-common-http-client = { git = "https://github.com/logos-blockchain/logos-blockchain.git", rev = "0dc34e2c5a6e2ff772140378659489a602ee06bc" } logos-blockchain-key-management-system-service = { git = "https://github.com/logos-blockchain/logos-blockchain.git", rev = "0dc34e2c5a6e2ff772140378659489a602ee06bc" } +logos-blockchain-codec = { git = "https://github.com/logos-blockchain/logos-blockchain.git", rev = "0dc34e2c5a6e2ff772140378659489a602ee06bc" } logos-blockchain-core = { git = "https://github.com/logos-blockchain/logos-blockchain.git", rev = "0dc34e2c5a6e2ff772140378659489a602ee06bc" } logos-blockchain-chain-broadcast-service = { git = "https://github.com/logos-blockchain/logos-blockchain.git", rev = "0dc34e2c5a6e2ff772140378659489a602ee06bc" } logos-blockchain-chain-service = { git = "https://github.com/logos-blockchain/logos-blockchain.git", rev = "0dc34e2c5a6e2ff772140378659489a602ee06bc" } diff --git a/bedrock/deployment-settings.yaml b/bedrock/deployment-settings.yaml index 9c21ee28..005beeb4 100644 --- a/bedrock/deployment-settings.yaml +++ b/bedrock/deployment-settings.yaml @@ -1,48 +1,47 @@ blend: common: - num_blend_layers: 3 + num_blend_layers: 1 minimum_network_size: 30 - protocol_name: /blend/integration-tests - data_replication_factor: 0 + protocol_name: /logos-blockchain-LEZ-DEV/blend/1.0.0 + data_replication_factor: 1 core: scheduler: cover: message_frequency_per_round: 1.0 delayer: - maximum_release_delay_in_rounds: 3 + maximum_release_delay_in_rounds: 1 minimum_messages_coefficient: 1 normalization_constant: 1.03 activity_threshold_sensitivity: 1 network: - kademlia_protocol_name: /integration/logos-blockchain/kad/1.0.0 - identify_protocol_name: /integration/logos-blockchain/identify/1.0.0 - chain_sync_protocol_name: /integration/logos-blockchain/chainsync/1.0.0 + kademlia_protocol_name: /logos-blockchain-LEZ-DEV/kad/1.0.0 + identify_protocol_name: /logos-blockchain-LEZ-DEV/identify/1.0.0 + chain_sync_protocol_name: /logos-blockchain-LEZ-DEV/chainsync/1.0.0 cryptarchia: epoch_config: epoch_stake_distribution_stabilization: 3 epoch_period_nonce_buffer: 3 epoch_period_nonce_stabilization: 4 - security_param: 10 + security_param: 5 slot_activation_coeff: numerator: 1 denominator: 2 - learning_rate: 0.1 + learning_rate: 0.5 sdp_config: service_params: BN: - inactivity_period: 1 - retention_period: 1 + inactivity_period: 2 epoch: 0 min_stake: threshold: 1 timestamp: 0 - gossipsub_protocol: /integration/logos-blockchain/cryptarchia/proto/1.0.0 + gossipsub_protocol: /logos-blockchain-LEZ-DEV/cryptarchia/1.0.0 genesis_block: header: version: Bedrock parent_block: '0000000000000000000000000000000000000000000000000000000000000000' slot: 0 - block_root: b5f8787ac23674822414c70eea15d842da38f2e806ede1a73cf7b5cf0277da07 + block_root: cb5951ac1ffa1aa5d0e585fb54e784bd9c025b28d752324e98b3837f34648692 proof_of_leadership: proof: '0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' entropy_contribution: '0000000000000000000000000000000000000000000000000000000000000000' @@ -56,24 +55,134 @@ cryptarchia: payload: inputs: [] outputs: - - value: 1 - pk: d204000000000000000000000000000000000000000000000000000000000000 - - value: 100 + - value: 1000000 pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' - - value: 1 - pk: ed266e6e887b9b97059dc1aa1b7b2e19b934291753c6336a163fe4ebaa28e717 + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 1000000 + pk: '2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26' + - value: 100000 + pk: '6b2bcd3029fba573cff0c332dc4de7430faf5e261383d693d8dbb5b97665660a' + - value: 18446744073709551615 + pk: c2a6a4a0981d5bdcf8ddeb8d7934fd8c5510efeb1053f613b45871670b6f7b19 - opcode: 17 payload: channel_id: '0000000000000000000000000000000000000000000000000000000000000000' - # chain_id_len=12 (u64_le), chain_id=logos-devnet (utf-8), - # genesis_time=2026-01-10T07:47:56Z (u64_le), epoch_nonce=[0u8; 32] - inscription: '0c000000000000006c6f676f732d6465766e65742c046269000000000000000000000000000000000000000000000000000000000000000000000000' + inscription: '05302e322e3123766c6a2d2ddf918544bca603c5a291c7dd1b902d6769ff4b00021506780e075c06051a' parent: '0000000000000000000000000000000000000000000000000000000000000000' signer: '0000000000000000000000000000000000000000000000000000000000000000' + - opcode: 32 + payload: + service_type: BN + locators: + - /ip4/65.109.51.37/udp/3400/quic-v1 + provider_id: '59c662860b737f4e2515599adb3434856db8070b373a449ff66955ad3da6b473' + zk_id: '6b2bcd3029fba573cff0c332dc4de7430faf5e261383d693d8dbb5b97665660a' + locked_note_id: '7e449a14172fc90679f6fca7b49a2d58c305ebf7ac42ef20202e533c31115222' ops_proofs: + - !ZkSig + pi_a: '0000000000000000000000000000000000000000000000000000000000000000' + pi_b: '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + pi_c: '0000000000000000000000000000000000000000000000000000000000000000' - !Ed25519Sig '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' - - !Ed25519Sig '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + - !ZkAndEd25519Sigs + zk_sig: + pi_a: '0000000000000000000000000000000000000000000000000000000000000000' + pi_b: '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + pi_c: '0000000000000000000000000000000000000000000000000000000000000000' + ed25519_sig: '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' + faucet_pk: c2a6a4a0981d5bdcf8ddeb8d7934fd8c5510efeb1053f613b45871670b6f7b19 time: - slot_duration: '1.0' + slot_duration: '1.000000000' mempool: - pubsub_topic: mantle_e2e_tests + pubsub_topic: /logos-blockchain-LEZ-DEV/mempool/1.0.0 diff --git a/bedrock/scripts/run_logos_blockchain_node.sh b/bedrock/scripts/run_logos_blockchain_node.sh index ffa02e6d..c513d6a3 100755 --- a/bedrock/scripts/run_logos_blockchain_node.sh +++ b/bedrock/scripts/run_logos_blockchain_node.sh @@ -7,14 +7,6 @@ export POL_PROOF_DEV_MODE=true # Use static configs mounted from host. Both node-config.yaml and # deployment-settings.yaml have matching validator keys so the node # can produce blocks as a single-validator network. -# Copy deployment-settings to a writable path because sed -i can't -# rename on a bind-mounted file. -cp /etc/logos-blockchain/deployment-settings.yaml /deployment-settings.yaml - -# Set chain_start_time to "now" so the chain starts immediately. -sed -i "s/PLACEHOLDER_CHAIN_START_TIME/$(date -u '+%Y-%m-%d %H:%M:%S.000000 +00:00:00')/" \ - /deployment-settings.yaml - exec /usr/bin/logos-blockchain-node \ /etc/logos-blockchain/node-config.yaml \ - --deployment /deployment-settings.yaml + --deployment /etc/logos-blockchain/deployment-settings.yaml diff --git a/integration_tests/tests/bridge.rs b/integration_tests/tests/bridge.rs index 6e566592..e24cd69d 100644 --- a/integration_tests/tests/bridge.rs +++ b/integration_tests/tests/bridge.rs @@ -349,7 +349,7 @@ async fn submit_bedrock_deposit( }, change_public_key: balance.address, funding_public_keys: vec![balance.address], - max_tx_fee: 1_000_u64.into(), + max_tx_fee: u64::MAX.into(), }; let response = client diff --git a/integration_tests/tests/multi_sequencer.rs b/integration_tests/tests/multi_sequencer.rs index dfca2cf2..1b01b62d 100644 --- a/integration_tests/tests/multi_sequencer.rs +++ b/integration_tests/tests/multi_sequencer.rs @@ -70,6 +70,7 @@ async fn multi_sequencer_committee_converges() -> Result<()> { &BedrockConfig { channel_id: config::bedrock_channel_id(), node_url: config::addr_to_url(config::UrlProtocol::Http, bedrock_addr)?, + funding_key: config::bedrock_funding_key(), auth: None, }, &Ed25519Key::from_bytes(&key_a), diff --git a/lez/configs/docker-all-in-one/sequencer_config.json b/lez/configs/docker-all-in-one/sequencer_config.json index 90b5d5f3..cd94eea5 100644 --- a/lez/configs/docker-all-in-one/sequencer_config.json +++ b/lez/configs/docker-all-in-one/sequencer_config.json @@ -11,7 +11,8 @@ "max_retries": 5 }, "channel_id": "0101010101010101010101010101010101010101010101010101010101010101", - "node_url": "http://logos-blockchain-node-0:18080" + "node_url": "http://logos-blockchain-node-0:18080", + "funding_key": "2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26" }, "genesis": [ { diff --git a/lez/sequencer/core/src/block_publisher.rs b/lez/sequencer/core/src/block_publisher.rs index 570dea78..5640a8d9 100644 --- a/lez/sequencer/core/src/block_publisher.rs +++ b/lez/sequencer/core/src/block_publisher.rs @@ -12,6 +12,7 @@ use logos_blockchain_core::{ mantle::{ MantleTx, SignedMantleTx, channel::{SlotTimeframe, SlotTimeout}, + gas::GasCost, ops::{ Op, OpProof, channel::{ @@ -33,9 +34,9 @@ use logos_blockchain_zone_sdk::{ adapter::{Node as _, NodeHttpClient}, indexer::ZoneIndexer, sequencer::{ - ChannelUpdateTx, DepositInfo, Event, FinalizedOp, InscriptionInfo, PendingTx, - SequencerConfig as ZoneSdkSequencerConfig, TurnNotification, WithdrawArg, WithdrawInfo, - ZoneSequencer, + ChannelUpdateTx, DepositInfo, Event, FinalizedOp, FundingConfig, InscriptionInfo, + PendingTx, SequencerConfig as ZoneSdkSequencerConfig, TurnNotification, WithdrawArg, + WithdrawInfo, ZoneSequencer, }, }; use tokio::sync::{mpsc, oneshot, watch}; @@ -185,6 +186,11 @@ impl BlockPublisherTrait for ZoneSdkPublisher { let zone_sdk_config = ZoneSdkSequencerConfig { resubmit_interval, + funding: Some(FundingConfig { + funding_pk: config.funding_key, + max_tx_fee: GasCost::new(logos_blockchain_core::mantle::Value::MAX), + priority_fee: FundingConfig::DEFAULT_PRIORITY_FEE, + }), ..ZoneSdkSequencerConfig::default() }; diff --git a/lez/sequencer/core/src/config.rs b/lez/sequencer/core/src/config.rs index 29c30a4f..aff0ae48 100644 --- a/lez/sequencer/core/src/config.rs +++ b/lez/sequencer/core/src/config.rs @@ -12,6 +12,7 @@ pub use cross_zone_inbox_core::{CrossZoneConfig, CrossZonePeer}; use humantime_serde; use lee::{AccountId, Balance}; use logos_blockchain_core::mantle::ops::channel::ChannelId; +use logos_blockchain_key_management_system_service::keys::ZkPublicKey; use serde::{Deserialize, Serialize}; use url::Url; @@ -72,6 +73,7 @@ pub struct BedrockConfig { pub node_url: Url, /// Bedrock auth. pub auth: Option, + pub funding_key: ZkPublicKey, } impl SequencerConfig { diff --git a/lez/sequencer/core/src/tests.rs b/lez/sequencer/core/src/tests.rs index 465a84a9..d2695546 100644 --- a/lez/sequencer/core/src/tests.rs +++ b/lez/sequencer/core/src/tests.rs @@ -30,6 +30,7 @@ use logos_blockchain_core::{ ops::channel::{ChannelId, MsgId, deposit::Metadata}, }, }; +use logos_blockchain_key_management_system_service::keys::ZkPublicKey; use logos_blockchain_zone_sdk::sequencer::DepositInfo; use mempool::MemPoolHandle; use ping_core::{ReceiverInstruction, ping_record_pda}; @@ -91,6 +92,7 @@ fn setup_sequencer_config() -> SequencerConfig { channel_id: ChannelId::from([0; 32]), node_url: "http://not-used-in-unit-tests".parse().unwrap(), auth: None, + funding_key: ZkPublicKey::zero(), }, retry_pending_blocks_timeout: Duration::from_mins(4), genesis: vec![], diff --git a/lez/sequencer/service/configs/debug/sequencer_config.json b/lez/sequencer/service/configs/debug/sequencer_config.json index 7ea85b48..92072e84 100644 --- a/lez/sequencer/service/configs/debug/sequencer_config.json +++ b/lez/sequencer/service/configs/debug/sequencer_config.json @@ -11,7 +11,8 @@ "max_retries": 5 }, "channel_id": "0101010101010101010101010101010101010101010101010101010101010101", - "node_url": "http://localhost:18080" + "node_url": "http://localhost:18080", + "funding_key": "2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26" }, "genesis": [ { diff --git a/lez/sequencer/service/configs/docker/sequencer_config.json b/lez/sequencer/service/configs/docker/sequencer_config.json index 24184ea8..44bebf54 100644 --- a/lez/sequencer/service/configs/docker/sequencer_config.json +++ b/lez/sequencer/service/configs/docker/sequencer_config.json @@ -11,7 +11,8 @@ "max_retries": 5 }, "channel_id": "0101010101010101010101010101010101010101010101010101010101010101", - "node_url": "http://host.docker.internal:18080" + "node_url": "http://host.docker.internal:18080", + "funding_key": "2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26" }, "genesis": [ { diff --git a/test_fixtures/Cargo.toml b/test_fixtures/Cargo.toml index 88526dea..41e82bda 100644 --- a/test_fixtures/Cargo.toml +++ b/test_fixtures/Cargo.toml @@ -25,8 +25,10 @@ bip39.workspace = true bytesize.workspace = true env_logger.workspace = true futures.workspace = true +hex.workspace = true jsonrpsee = { workspace = true, features = ["ws-client"] } log.workspace = true +num-bigint.workspace = true serde.workspace = true serde_json.workspace = true tempfile.workspace = true @@ -34,3 +36,6 @@ testcontainers = { version = "0.27.3", features = ["docker-compose"] } tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } tokio-util.workspace = true url.workspace = true +time.workspace = true + +logos-blockchain-key-management-system-service.workspace = true diff --git a/test_fixtures/src/config.rs b/test_fixtures/src/config.rs index 9a7df9db..8df57fb3 100644 --- a/test_fixtures/src/config.rs +++ b/test_fixtures/src/config.rs @@ -6,6 +6,8 @@ use indexer_service::{ChannelId, ClientConfig, IndexerConfig}; use key_protocol::key_management::{KeyChain, secret_holders::SeedHolder}; use lee::{AccountId, PrivateKey, PublicKey}; use lee_core::Identifier; +use logos_blockchain_key_management_system_service::keys::ZkPublicKey; +use num_bigint::BigUint; use sequencer_core::config::{BedrockConfig, CrossZoneConfig, GenesisAction, SequencerConfig}; use url::Url; use wallet::config::{MultiSequencerClientConfig, SequencerConnectionData, WalletConfig}; @@ -76,29 +78,11 @@ impl std::fmt::Display for UrlProtocol { } pub fn sequencer_config( - partial: SequencerPartialConfig, - home: PathBuf, - bedrock_addr: SocketAddr, - genesis_transactions: Vec, - cross_zone: Option, -) -> Result { - sequencer_config_with_channel( - partial, - home, - bedrock_addr, - bedrock_channel_id(), - genesis_transactions, - cross_zone, - ) -} - -/// Like [`sequencer_config`] but with an explicit Bedrock `channel_id`, so tests -/// can point a sequencer at a fresh/empty channel (e.g. to model a wiped Bedrock). -pub fn sequencer_config_with_channel( partial: SequencerPartialConfig, home: PathBuf, bedrock_addr: SocketAddr, channel_id: ChannelId, + funding_key: ZkPublicKey, genesis_transactions: Vec, cross_zone: Option, ) -> Result { @@ -122,6 +106,7 @@ pub fn sequencer_config_with_channel( channel_id, node_url: addr_to_url(UrlProtocol::Http, bedrock_addr) .context("Failed to convert bedrock addr to URL")?, + funding_key, auth: None, }, cross_zone, @@ -280,3 +265,12 @@ pub fn bedrock_channel_id_b() -> ChannelId { .unwrap_or_else(|_| unreachable!()); ChannelId::from(channel_id) } + +/// Funding key of the Bedrock test node, matching `funding_pk` in `bedrock/node-config.yaml`. +#[must_use] +pub fn bedrock_funding_key() -> ZkPublicKey { + const PUBLIC_KEY_HEX: &str = "2e03b2eff5a45478e7e79668d2a146cf2c5c7925bce927f2b1c67f2ab4fc0d26"; + + let bytes = hex::decode(PUBLIC_KEY_HEX).expect("Fixed funding key must be valid hex"); + ZkPublicKey::from(BigUint::from_bytes_le(&bytes)) +} diff --git a/test_fixtures/src/setup.rs b/test_fixtures/src/setup.rs index 6c60a7e8..5d185a2d 100644 --- a/test_fixtures/src/setup.rs +++ b/test_fixtures/src/setup.rs @@ -131,11 +131,12 @@ impl SequencerSetup { Vec::new() }; - let config = config::sequencer_config_with_channel( + let config = config::sequencer_config( partial, home.to_owned(), bedrock_addr, channel_id, + config::bedrock_funding_key(), genesis_transactions, cross_zone, )