Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/node/src/commands/bundled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ impl BundledCommand {
ntx_builder.tx_prover_url,
ntx_builder.ticker_interval,
checkpoint,
ntx_builder.script_cache_size,
)
.run()
.await
Expand Down
10 changes: 10 additions & 0 deletions bin/node/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use miden_node_block_producer::{
DEFAULT_MAX_BATCHES_PER_BLOCK,
DEFAULT_MAX_TXS_PER_BATCH,
};
use miden_node_ntx_builder::DEFAULT_SCRIPT_CACHE_SIZE;
use url::Url;

pub mod block_producer;
Expand Down Expand Up @@ -35,6 +36,7 @@ const ENV_GENESIS_CONFIG_FILE: &str = "MIDEN_GENESIS_CONFIG_FILE";
const ENV_MAX_TXS_PER_BATCH: &str = "MIDEN_MAX_TXS_PER_BATCH";
const ENV_MAX_BATCHES_PER_BLOCK: &str = "MIDEN_MAX_BATCHES_PER_BLOCK";
const ENV_MEMPOOL_TX_CAPACITY: &str = "MIDEN_NODE_MEMPOOL_TX_CAPACITY";
const ENV_NTX_SCRIPT_CACHE_SIZE: &str = "MIDEN_NTX_DATA_STORE_SCRIPT_CACHE_SIZE";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add this to bin/node/.env like the other env vars.

const ENV_VALIDATOR_INSECURE_SECRET_KEY: &str = "MIDEN_NODE_VALIDATOR_INSECURE_SECRET_KEY";

const DEFAULT_NTX_TICKER_INTERVAL: Duration = Duration::from_millis(200);
Expand Down Expand Up @@ -65,6 +67,14 @@ pub struct NtxBuilderConfig {
value_name = "DURATION"
)]
pub ticker_interval: Duration,

#[arg(
long = "ntx-builder.script-cache-size",
env = ENV_NTX_SCRIPT_CACHE_SIZE,
value_name = "NUM",
default_value_t = DEFAULT_SCRIPT_CACHE_SIZE
)]
pub script_cache_size: NonZeroUsize,
}

/// Configuration for the Block Producer component
Expand Down
5 changes: 3 additions & 2 deletions crates/ntx-builder/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl NetworkTransactionBuilder {
///
/// Each cached script contains the deserialized `NoteScript` object, so the actual memory usage
/// depends on the complexity of the scripts being cached.
const DEFAULT_SCRIPT_CACHE_SIZE: NonZeroUsize = NonZeroUsize::new(1000).unwrap();
pub const DEFAULT_SCRIPT_CACHE_SIZE: NonZeroUsize = NonZeroUsize::new(1000).unwrap();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need to be pub does it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need to be pub does it?

Made changes


/// Creates a new instance of the network transaction builder.
pub fn new(
Expand All @@ -104,8 +104,9 @@ impl NetworkTransactionBuilder {
tx_prover_url: Option<Url>,
ticker_interval: Duration,
bp_checkpoint: Arc<Barrier>,
script_cache_size: NonZeroUsize,
) -> Self {
let script_cache = LruCache::new(Self::DEFAULT_SCRIPT_CACHE_SIZE);
let script_cache = LruCache::new(script_cache_size);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should just update new() and not have with_script_cache_size().

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should just update new() and not have with_script_cache_size().

updated

let coordinator = Coordinator::new(MAX_IN_PROGRESS_TXS);
Self {
store_url,
Expand Down
3 changes: 3 additions & 0 deletions crates/ntx-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ pub use builder::NetworkTransactionBuilder;

const COMPONENT: &str = "miden-ntx-builder";

pub const DEFAULT_SCRIPT_CACHE_SIZE: NonZeroUsize =
NetworkTransactionBuilder::DEFAULT_SCRIPT_CACHE_SIZE;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this do we?


/// Maximum number of network notes a network transaction is allowed to consume.
const MAX_NOTES_PER_TX: NonZeroUsize = NonZeroUsize::new(50).unwrap();

Expand Down
Loading