Skip to content

Commit 58c07c9

Browse files
chore: increase cycles limit for ntxs to 256k (#1836)
1 parent a329b4c commit 58c07c9

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎bin/node/src/commands/mod.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const ENV_NTX_MAX_CYCLES: &str = "MIDEN_NTX_MAX_CYCLES";
5353
const DEFAULT_NTX_TICKER_INTERVAL: Duration = Duration::from_millis(200);
5454
const DEFAULT_NTX_IDLE_TIMEOUT: Duration = Duration::from_secs(5 * 60);
5555
const DEFAULT_NTX_SCRIPT_CACHE_SIZE: NonZeroUsize = NonZeroUsize::new(1000).unwrap();
56-
const DEFAULT_NTX_MAX_CYCLES: u32 = 1 << 16;
56+
const DEFAULT_NTX_MAX_CYCLES: u32 = 1 << 18;
5757

5858
/// Configuration for the Validator key used to sign blocks.
5959
///
@@ -199,7 +199,7 @@ pub struct NtxBuilderConfig {
199199

200200
/// Maximum number of VM execution cycles allowed for a single network transaction.
201201
///
202-
/// Network transactions that exceed this limit will fail. Defaults to 2^16 (65536) cycles.
202+
/// Network transactions that exceed this limit will fail. Defaults to 2^18 (262.144) cycles.
203203
#[arg(
204204
long = "ntx-builder.max-cycles",
205205
env = ENV_NTX_MAX_CYCLES,

‎bin/node/src/tests.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,6 @@ fn bundled_start_parses() {
3838

3939
#[test]
4040
fn bundled_start_with_max_cycles_parses() {
41-
let _ = parse(&["bundled", "start", "--ntx-builder.max-cycles", "131072"]);
41+
let max_cycles = 2_i32.pow(18).to_string();
42+
let _ = parse(&["bundled", "start", "--ntx-builder.max-cycles", &max_cycles]);
4243
}

‎crates/ntx-builder/src/actor/mod.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl AccountActorContext {
112112
idle_timeout: Duration::from_secs(60),
113113
db: db.clone(),
114114
request_tx,
115-
max_cycles: 1 << 16,
115+
max_cycles: 1 << 18,
116116
}
117117
}
118118
}

‎crates/ntx-builder/src/lib.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const DEFAULT_MAX_ACCOUNT_CRASHES: usize = 10;
7171
///
7272
/// This limits the computational cost of network transactions. The protocol maximum is
7373
/// `1 << 29` but network transactions should be much cheaper.
74-
const DEFAULT_MAX_TX_CYCLES: u32 = 1 << 16;
74+
const DEFAULT_MAX_TX_CYCLES: u32 = 1 << 19;
7575

7676
// CONFIGURATION
7777
// =================================================================================================
@@ -128,7 +128,7 @@ pub struct NtxBuilderConfig {
128128
/// Maximum number of VM execution cycles allowed for a single network transaction.
129129
///
130130
/// Network transactions that exceed this limit will fail with an execution error.
131-
/// Defaults to 64k cycles.
131+
/// Defaults to 2^18 cycles.
132132
pub max_cycles: u32,
133133

134134
/// Path to the SQLite database file used for persistent state.

0 commit comments

Comments
 (0)