fix(sequencer): use ED25519_SECRET_KEY_SIZE and retain BoundedError message

This commit is contained in:
erhant 2026-07-14 17:25:17 +03:00
parent dd0c0daaa7
commit fd58bf459d
4 changed files with 16 additions and 11 deletions

View File

@ -16,7 +16,7 @@ use integration_tests::{
indexer_client::IndexerClient,
setup::{setup_bedrock_node, setup_indexer, setup_sequencer_with_bedrock_key},
};
use logos_blockchain_key_management_system_service::keys::Ed25519Key;
use logos_blockchain_key_management_system_service::keys::{ED25519_SECRET_KEY_SIZE, Ed25519Key};
use sequencer_service_protocol::ConfigureChannelRequest;
use sequencer_service_rpc::{RpcClient as _, SequencerClient, SequencerClientBuilder};
use testnet_initial_state::{initial_pub_accounts_private_keys, initial_public_user_accounts};
@ -39,8 +39,8 @@ async fn multi_sequencer_committee_converges() -> Result<()> {
.context("Failed to set up Bedrock node")?;
// Fixed seeds so A can accredit B's public key before B exists.
let key_a = [0xA1_u8; 32];
let key_b = [0xB2_u8; 32];
let key_a = [0xA1_u8; ED25519_SECRET_KEY_SIZE];
let key_b = [0xB2_u8; ED25519_SECRET_KEY_SIZE];
let pub_a = Ed25519Key::from_bytes(&key_a).public_key();
let pub_b = Ed25519Key::from_bytes(&key_b).public_key();

View File

@ -8,7 +8,9 @@ use logos_blockchain_core::mantle::{
channel::{SlotTimeframe, SlotTimeout},
ops::channel::{ChannelId, config::Keys, inscribe::Inscription},
};
pub use logos_blockchain_key_management_system_service::keys::{Ed25519Key, ZkKey};
pub use logos_blockchain_key_management_system_service::keys::{
ED25519_SECRET_KEY_SIZE, Ed25519Key, ZkKey,
};
pub use logos_blockchain_zone_sdk::sequencer::SequencerCheckpoint;
use logos_blockchain_zone_sdk::{
CommonHttpClient,
@ -351,8 +353,8 @@ impl BlockPublisherTrait for ZoneSdkPublisher {
configuration_threshold: u16,
withdraw_threshold: u16,
) -> Result<()> {
let keys = Keys::try_from(keys)
.map_err(|_err| anyhow!("Channel key list must be non-empty and within bounds"))?;
let keys =
Keys::try_from(keys).map_err(|err| anyhow!("Invalid channel key list: {err}"))?;
let (resp_tx, resp_rx) = oneshot::channel();
self.command_tx
.send(Command::ConfigureChannel {

View File

@ -248,13 +248,13 @@ fn parse_channel_key(hex_key: &str) -> Result<Ed25519PublicKey, ErrorObjectOwned
#[cfg(test)]
mod tests {
use sequencer_core::block_publisher::Ed25519Key;
use sequencer_core::block_publisher::{ED25519_SECRET_KEY_SIZE, Ed25519Key};
use super::*;
#[test]
fn parse_channel_key_roundtrips_and_rejects_garbage() {
let key = Ed25519Key::from_bytes(&[7; 32]).public_key();
let key = Ed25519Key::from_bytes(&[7; ED25519_SECRET_KEY_SIZE]).public_key();
let parsed = parse_channel_key(&hex::encode(key.to_bytes())).unwrap();
assert_eq!(parsed.to_bytes(), key.to_bytes());

View File

@ -4,7 +4,10 @@ use anyhow::{Context as _, Result, bail};
use indexer_service::{ChannelId, IndexerHandle};
use lee::{AccountId, PrivateKey, PublicKey};
use log::{debug, warn};
use sequencer_core::block_store::{DbDump, SequencerStore};
use sequencer_core::{
block_publisher::ED25519_SECRET_KEY_SIZE,
block_store::{DbDump, SequencerStore},
};
use sequencer_service::{GenesisAction, SequencerHandle};
use tempfile::TempDir;
use testcontainers::compose::DockerCompose;
@ -186,7 +189,7 @@ pub async fn setup_sequencer_with_bedrock_key(
genesis_transactions: Vec<GenesisAction>,
channel_id: ChannelId,
cross_zone: Option<sequencer_core::config::CrossZoneConfig>,
bedrock_signing_key: [u8; 32],
bedrock_signing_key: [u8; ED25519_SECRET_KEY_SIZE],
) -> Result<(SequencerHandle, TempDir)> {
setup_sequencer_inner(
partial,
@ -205,7 +208,7 @@ async fn setup_sequencer_inner(
init: SequencerInit<'_>,
channel_id: ChannelId,
cross_zone: Option<sequencer_core::config::CrossZoneConfig>,
bedrock_signing_key: Option<[u8; 32]>,
bedrock_signing_key: Option<[u8; ED25519_SECRET_KEY_SIZE]>,
) -> Result<(SequencerHandle, TempDir)> {
let temp_sequencer_dir =
tempfile::tempdir().context("Failed to create temp dir for sequencer home")?;