diff --git a/bin/benchmark/README.md b/bin/benchmark/README.md index 881e81e57..2e170916d 100644 --- a/bin/benchmark/README.md +++ b/bin/benchmark/README.md @@ -210,11 +210,14 @@ nohup miden-remote-prover \ > logs/remote-prover.log 2>&1 & # The node runs store + block-producer + RPC in a single sequencer process. +# This unused account receives benchmark fees without collecting them. +BATCH_BUILDER_WALLET_ACCOUNT_ID=0xcc0000000000dd010000ee000000ff nohup miden-node sequencer \ --data-directory "$DATA/node" \ --rpc.listen 127.0.0.1:57291 \ --validator.url http://127.0.0.1:50101 \ --ntx-builder.url http://127.0.0.1:50301 \ + --batch.builder.wallet-account-id "$BATCH_BUILDER_WALLET_ACCOUNT_ID" \ --batch.max-txs 1024 \ --block.max-batches 64 \ --block.interval 2s \ diff --git a/bin/node/src/commands/block_producer.rs b/bin/node/src/commands/block_producer.rs index 8993f6765..f75e1acd8 100644 --- a/bin/node/src/commands/block_producer.rs +++ b/bin/node/src/commands/block_producer.rs @@ -10,6 +10,7 @@ use miden_node_block_producer::{ DEFAULT_MAX_TXS_PER_BATCH, }; use miden_node_utils::clap::duration_to_human_readable_string; +use miden_protocol::account::AccountId; use url::Url; // BLOCK PRODUCTION @@ -17,6 +18,9 @@ use url::Url; #[derive(clap::Args, Clone, Debug)] pub struct BlockProducerOptions { + #[command(flatten)] + pub builder: BuilderOptions, + #[command(flatten)] pub batch: BatchOptions, @@ -64,6 +68,7 @@ mod tests { BlockOptions, BlockProducerOptions, BlockProverOptions, + BuilderOptions, MempoolOptions, }; use crate::commands::block_producer::{ @@ -74,6 +79,12 @@ mod tests { fn options(max_batches: usize, max_txs: usize) -> BlockProducerOptions { BlockProducerOptions { + builder: BuilderOptions { + wallet_account_id: miden_protocol::account::AccountId::from_hex( + "0xcc0000000000dd010000ee000000ff", + ) + .unwrap(), + }, batch: BatchOptions { interval: DEFAULT_BATCH_INTERVAL, max_txs: NonZeroUsize::new(max_txs).unwrap(), @@ -126,6 +137,19 @@ mod tests { } } +#[derive(clap::Args, Clone, Debug)] +pub struct BuilderOptions { + /// Wallet account ID that receives the batch builder's fees. + #[arg( + long = "batch.builder.wallet-account-id", + env = "MIDEN_NODE_BATCH_BUILDER_WALLET_ACCOUNT_ID", + value_name = "ACCOUNT_ID", + value_parser = AccountId::from_hex, + help_heading = super::section::BLOCK_PRODUCTION_HELP_HEADING + )] + pub wallet_account_id: AccountId, +} + #[derive(clap::Args, Clone, Debug)] pub struct BatchOptions { /// Maximum interval between batch scheduler checks. diff --git a/compose/node.yml b/compose/node.yml index 19fbff121..b7e326d1e 100644 --- a/compose/node.yml +++ b/compose/node.yml @@ -24,6 +24,8 @@ services: - --validator.url=http://validator-2:50101 - --validator.url=http://validator-3:50101 - --ntx-builder.url=http://ntx-builder:50301 + # This unused account receives development-network fees without collecting them. + - --batch.builder.wallet-account-id=${MIDEN_NODE_BATCH_BUILDER_WALLET_ACCOUNT_ID:-0xcc0000000000dd010000ee000000ff} - --rpc.network-tx-auth-header-value=secret_value environment: MIDEN_NODE_DISABLE_ACCOUNT_ALLOWLIST: "${MIDEN_NODE_DISABLE_ACCOUNT_ALLOWLIST:-true}" diff --git a/docs/external/src/network-operator/sequencer.md b/docs/external/src/network-operator/sequencer.md index ebc1646d5..25683887b 100644 --- a/docs/external/src/network-operator/sequencer.md +++ b/docs/external/src/network-operator/sequencer.md @@ -18,12 +18,15 @@ miden-node sequencer \ --validator.url http://validator-2:50101 \ --validator.url http://validator-3:50101 \ --ntx-builder.url http://ntx-builder:50301 \ + --batch.builder.wallet-account-id \ --rpc.network-tx-auth-header-value ``` Only the public RPC listener should be externally reachable. The validator, NTX builder, and prover URLs are trusted internal services. +The wallet account receives batch-building fees. The sequencer needs only its ID, not its signing key. + The network transaction auth value is a shared secret used to authorize network transaction submissions. It must match the NTX builder's `--rpc.auth-header-value`; otherwise, the sequencer rejects network transactions from the builder. diff --git a/scripts/bench-local.sh b/scripts/bench-local.sh index 26dcb170e..44bac753d 100755 --- a/scripts/bench-local.sh +++ b/scripts/bench-local.sh @@ -37,6 +37,8 @@ USE_REMOTE_PROVER="${USE_REMOTE_PROVER:-0}" CONCURRENCY="${CONCURRENCY:-8}" WAIT_BLOCKS="${WAIT_BLOCKS:-30}" RUN_DIR="${RUN_DIR:-./bench-local-run}" +# This unused account receives development-network fees without collecting them. +BATCH_BUILDER_WALLET_ACCOUNT_ID="${BATCH_BUILDER_WALLET_ACCOUNT_ID:-0xcc0000000000dd010000ee000000ff}" # Insecure, hard-coded local dev validator signing key and its public key (committed at # genesis). Generate a fresh pair with `miden-validator keygen`. VALIDATOR_SIGNING_KEY_HEX="${VALIDATOR_SIGNING_KEY_HEX:-0101010101010101010101010101010101010101010101010101010101010101}" @@ -177,6 +179,7 @@ start_bg node miden-node sequencer \ --rpc.listen "127.0.0.1:$RPC_PORT" \ --validator.url "http://127.0.0.1:$VALIDATOR_PORT" \ --ntx-builder.url "http://127.0.0.1:$NTX_PORT" \ + --batch.builder.wallet-account-id "$BATCH_BUILDER_WALLET_ACCOUNT_ID" \ --batch.max-txs 64 \ --block.max-batches 16 \ --block.interval 2s \ diff --git a/scripts/run-node.sh b/scripts/run-node.sh index ae3c8cab7..bd01ed288 100755 --- a/scripts/run-node.sh +++ b/scripts/run-node.sh @@ -5,6 +5,8 @@ set -euo pipefail SKIP_BOOTSTRAP="${SKIP_BOOTSTRAP:-false}" ENABLE_FULL_NODES="${ENABLE_FULL_NODES:-true}" EXTRA_ARGS="${EXTRA_ARGS:-}" +# This unused account receives development-network fees without collecting them. +BATCH_BUILDER_WALLET_ACCOUNT_ID="${BATCH_BUILDER_WALLET_ACCOUNT_ID:-0xcc0000000000dd010000ee000000ff}" # Shared secret authorizing the ntx-builder to submit network transactions to the sequencer's RPC. # Must match on both the sequencer (--rpc.network-tx-auth-header-value) and the ntx-builder # (--rpc.auth-header-value), otherwise network transactions are rejected with @@ -242,6 +244,7 @@ OTEL_RESOURCE_ATTRIBUTES="$(node_resource_attributes sequencer)" \ --validator.url "http://127.0.0.1:$VALIDATOR_1_PORT" \ --validator.url "http://127.0.0.1:$VALIDATOR_2_PORT" \ --ntx-builder.url "http://127.0.0.1:$NTX_BUILDER_PORT" \ + --batch.builder.wallet-account-id "$BATCH_BUILDER_WALLET_ACCOUNT_ID" \ --internal.listen "0.0.0.0:$SEQUENCER_INTERNAL_PORT" \ $EXTRA_ARGS & PIDS+=($!)