Skip to content

Commit d6e97ff

Browse files
tarrencevglihm
andauthored
release(prepare): v1.7.2 (#3369)
* Prepare release: v1.7.2 * feat: add finality status from CLI defaulting to AcceptedOnL2 --------- Co-authored-by: glihm <7962849+glihm@users.noreply.github.com> Co-authored-by: glihm <dev@glihm.net>
1 parent 5ee7406 commit d6e97ff

File tree

28 files changed

+609
-76
lines changed

28 files changed

+609
-76
lines changed

Cargo.lock

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ license-file = "LICENSE"
4040
repository = "https://github.com/dojoengine/dojo/"
4141
documentation = "https://book.dojoengine.org"
4242
homepage = "https://dojoengine.org"
43-
version = "1.7.1"
43+
version = "1.7.2"
4444

4545
[profile.performance]
4646
codegen-units = 1
@@ -64,7 +64,7 @@ dojo-metrics = { path = "crates/metrics" }
6464
dojo-bindgen = { path = "crates/dojo/bindgen" }
6565
dojo-core = { path = "crates/dojo/core" }
6666
dojo-test-utils = { path = "crates/dojo/test-utils" }
67-
dojo-types = { path = "crates/dojo/types", version = "1.7.1" }
67+
dojo-types = { path = "crates/dojo/types", version = "1.7.2" }
6868
dojo-world = { path = "crates/dojo/world" }
6969

7070
# sozo

bin/sozo/src/commands/options/transaction.rs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use anyhow::{bail, Result};
22
use clap::Args;
33
use dojo_utils::{FeeConfig, TxnAction, TxnConfig};
4+
use starknet::core::types::TransactionFinalityStatus;
45

56
#[derive(Debug, Clone, Args, Default)]
67
#[command(next_help_heading = "Transaction options")]
@@ -62,6 +63,15 @@ pub struct TransactionOptions {
6263
#[arg(global = true)]
6364
#[arg(default_value = "10")]
6465
pub max_calls: Option<usize>,
66+
67+
#[arg(long)]
68+
#[arg(help = "The finality status to wait for. Since 0.14, the nodes syncing is sometime \
69+
not fast enough to propagate the transaction to the nodes in the \
70+
PRE-CONFIRMED state. The default is ACCEPTED_ON_L2. Available options are: \
71+
PRE-CONFIRMED, ACCEPTED_ON_L2, ACCEPTED_ON_L1.")]
72+
#[arg(global = true)]
73+
#[arg(default_value = "ACCEPTED_ON_L2")]
74+
pub finality_status: Option<String>,
6575
}
6676

6777
impl TransactionOptions {
@@ -89,6 +99,7 @@ impl TransactionOptions {
8999
},
90100
walnut: self.walnut,
91101
max_calls: self.max_calls,
102+
finality_status: parse_finality_status(self.finality_status.clone())?,
92103
}),
93104
}
94105
}
@@ -111,10 +122,33 @@ impl TryFrom<TransactionOptions> for TxnConfig {
111122
l2_gas_price: value.l2_gas_price,
112123
},
113124
max_calls: value.max_calls,
125+
finality_status: parse_finality_status(value.finality_status.clone())?,
114126
})
115127
}
116128
}
117129

130+
/// Parses the finality status from a string.
131+
/// If no status is provided, the default is ACCEPTED_ON_L2.
132+
/// # Arguments
133+
///
134+
/// * `status` - The finality status to parse.
135+
///
136+
/// # Returns
137+
///
138+
/// The parsed finality status.
139+
fn parse_finality_status(status: Option<String>) -> Result<TransactionFinalityStatus> {
140+
if let Some(status) = status {
141+
match status.to_uppercase().as_str() {
142+
"PRE_CONFIRMED" => Ok(TransactionFinalityStatus::PreConfirmed),
143+
"ACCEPTED_ON_L2" => Ok(TransactionFinalityStatus::AcceptedOnL2),
144+
"ACCEPTED_ON_L1" => Ok(TransactionFinalityStatus::AcceptedOnL1),
145+
_ => bail!("Invalid finality status: {}", status),
146+
}
147+
} else {
148+
Ok(TransactionFinalityStatus::AcceptedOnL2)
149+
}
150+
}
151+
118152
#[cfg(test)]
119153
mod tests {
120154
use anyhow::Result;
@@ -134,6 +168,7 @@ mod tests {
134168
l2_gas_price: Some(1_000),
135169
walnut: false,
136170
max_calls: Some(10),
171+
finality_status: Some("PRE_CONFIRMED".to_string()),
137172
};
138173

139174
let config: TxnConfig = opts.try_into()?;
@@ -150,6 +185,32 @@ mod tests {
150185
assert_eq!(config.fee_config.l2_gas, Some(10_000));
151186
assert_eq!(config.fee_config.l2_gas_price, Some(1_000));
152187

188+
assert_eq!(config.finality_status, TransactionFinalityStatus::PreConfirmed);
189+
190+
Ok(())
191+
}
192+
193+
#[test]
194+
fn test_parse_finality_status() -> Result<()> {
195+
matches!(
196+
parse_finality_status(Some("PRE_CONFIRMED".to_string())),
197+
Ok(TransactionFinalityStatus::PreConfirmed)
198+
);
199+
200+
matches!(
201+
parse_finality_status(Some("ACCEPTED_ON_L2".to_string())),
202+
Ok(TransactionFinalityStatus::AcceptedOnL2)
203+
);
204+
205+
matches!(
206+
parse_finality_status(Some("ACCEPTED_ON_L1".to_string())),
207+
Ok(TransactionFinalityStatus::AcceptedOnL1)
208+
);
209+
210+
matches!(parse_finality_status(None), Ok(TransactionFinalityStatus::AcceptedOnL2));
211+
212+
assert!(parse_finality_status(Some("INVALID".to_string())).is_err());
213+
153214
Ok(())
154215
}
155216
}

crates/dojo/core-tests/Scarb.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version = 1
33

44
[[package]]
55
name = "dojo"
6-
version = "1.7.1"
6+
version = "1.7.2"
77
dependencies = [
88
"dojo_cairo_macros",
99
]
@@ -14,7 +14,7 @@ version = "1.7.1"
1414

1515
[[package]]
1616
name = "dojo_core_test"
17-
version = "1.7.1"
17+
version = "1.7.2"
1818
dependencies = [
1919
"dojo",
2020
"dojo_cairo_macros",
@@ -24,7 +24,7 @@ dependencies = [
2424

2525
[[package]]
2626
name = "dojo_snf_test"
27-
version = "1.7.1"
27+
version = "1.7.2"
2828
dependencies = [
2929
"dojo",
3030
"snforge_std",

crates/dojo/core-tests/Scarb.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "dojo_core_test"
33
description = "Testing library for Dojo using Starknet foundry."
44

5-
version = "1.7.1"
5+
version = "1.7.2"
66
edition = "2024_07"
77
cairo-version = "2.12"
88

crates/dojo/core/Scarb.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version = 1
33

44
[[package]]
55
name = "dojo"
6-
version = "1.7.1"
6+
version = "1.7.2"
77
dependencies = [
88
"dojo_cairo_macros",
99
]

crates/dojo/core/Scarb.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cairo-version = "2.12"
33
edition = "2024_07"
44
description = "The Dojo Core library for autonomous worlds."
55
name = "dojo"
6-
version = "1.7.1"
6+
version = "1.7.2"
77
license = "MIT"
88
repository = "https://github.com/dojoengine/dojo"
99
documentation = "https://book.dojoengine.org"

crates/dojo/core/src/world/world_contract.cairo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub mod world {
5454

5555
pub const WORLD: felt252 = 0;
5656
pub const DOJO_INIT_SELECTOR: felt252 = selector!("dojo_init");
57-
pub const WORLD_VERSION: felt252 = '1.7.1';
57+
pub const WORLD_VERSION: felt252 = '1.7.2';
5858

5959
#[event]
6060
#[derive(Drop, starknet::Event)]

crates/dojo/dojo-cairo-test/Scarb.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version = 1
33

44
[[package]]
55
name = "dojo"
6-
version = "1.7.1"
6+
version = "1.7.2"
77
dependencies = [
88
"dojo_cairo_macros",
99
]
@@ -14,7 +14,7 @@ version = "1.7.1"
1414

1515
[[package]]
1616
name = "dojo_cairo_test"
17-
version = "1.7.1"
17+
version = "1.7.2"
1818
dependencies = [
1919
"dojo",
2020
]

0 commit comments

Comments
 (0)