Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add walnut flag to sozo execute and migrate apply commands #2333

Merged
merged 51 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
ebf6761
feat: add sierra to cairo debug information
glihm Aug 22, 2024
f4e2712
Add walnut flag to sozo execute command
barabanovro Aug 22, 2024
550f5bf
Pass rpc url to handle_transaction_result
barabanovro Aug 23, 2024
056d98d
Merge remote-tracking branch 'dojo/main' into feat/walnut-debug-info
glihm Aug 24, 2024
2627286
Add walnut flag to sozo migrate apply command
barabanovro Aug 28, 2024
46d97a9
Move walnut_debug_transaction to walnut crate
barabanovro Aug 28, 2024
143f99a
Cargo fmt
barabanovro Aug 28, 2024
c46b373
Keep only one global walnut flag
barabanovro Aug 29, 2024
a8d9ac4
Add comments
barabanovro Aug 29, 2024
d8eb7e2
Add walnut flag to sozo execute command
barabanovro Aug 22, 2024
a900b4c
Pass rpc url to handle_transaction_result
barabanovro Aug 23, 2024
f8801ab
Add walnut flag to sozo migrate apply command
barabanovro Aug 28, 2024
b47dc41
Move walnut_debug_transaction to walnut crate
barabanovro Aug 28, 2024
2e8b436
Cargo fmt
barabanovro Aug 28, 2024
10739f9
Keep only one global walnut flag
barabanovro Aug 29, 2024
d20d8d1
Add comments
barabanovro Aug 29, 2024
c3ed863
Resolve conflicts
barabanovro Sep 2, 2024
bc78ed2
Merge branch 'sozo-execute-with-walnut' of https://github.com/walnuth…
barabanovro Sep 2, 2024
19bf7d3
Fix lint errors
barabanovro Sep 2, 2024
a26a5d4
Merge branch 'feat/walnut-debug-info' into sozo-execute-with-walnut
barabanovro Sep 3, 2024
336626b
Put the walnut crate under the /sozo dir
barabanovro Sep 4, 2024
c830c94
Add constants with API and app URLs
barabanovro Sep 4, 2024
d394aa0
Warn where we fail silently
barabanovro Sep 4, 2024
0c3fa95
Remove unnecessary comments
barabanovro Sep 4, 2024
c0933cc
Check Walnut API key before migration
barabanovro Sep 4, 2024
302b2a0
Add doc comments
barabanovro Sep 4, 2024
9d3147f
Disable walnut flag in auto_authorize
barabanovro Sep 6, 2024
ac47e81
chore; use debug for pending tx log (#2383)
Larkooo Sep 3, 2024
3ac3149
refactor(katana-rpc): `getEvents` include pending block (#2375)
kariy Sep 4, 2024
a320d56
refactor(katana): move predeployedAccounts under DevApi and remove Ka…
glihm Sep 4, 2024
b610620
remove world and indexers table in favour of contracts
lambda-0x Aug 20, 2024
b26c41a
opt(torii): batch query execution in sync_range
lambda-0x Aug 30, 2024
33cb543
refactor(torii): make select block cancel safe
lambda-0x Sep 2, 2024
d8c1b43
opt(torii): use hashmap instead of vector of event processors
lambda-0x Sep 2, 2024
2228fa1
opt(torii): fetch receipts along with blocks instead of fetching them…
lambda-0x Sep 3, 2024
98e2c61
opt(torii): avoid re-processing of transactions in certain case
lambda-0x Sep 3, 2024
92a7f04
wip
kariy Sep 6, 2024
134e0f7
Merge branch 'main' into sozo-execute-with-walnut
kariy Sep 6, 2024
15c5b3a
Add walnut flag to sozo execute command
kariy Sep 6, 2024
8155208
chore(dojo-world): enable manifest feature on `migration` feature
kariy Sep 6, 2024
ced0d63
fmt
kariy Sep 7, 2024
7e4e1e3
refactor: move walnut config into WalnutDebugger
glihm Sep 7, 2024
4953700
fix: ensure only WalnutDebugger is exposed
glihm Sep 7, 2024
e4d9705
fix: restore default dojo_dev.toml
glihm Sep 7, 2024
97b281a
dont print in library code
kariy Sep 8, 2024
122f717
use concrete error types in walnut/verification
kariy Sep 8, 2024
4eabc97
use concrete types again
kariy Sep 8, 2024
13c9dd6
remove unecessary util function
kariy Sep 8, 2024
db61e0e
use json method instead
kariy Sep 8, 2024
f3c966a
fix: fix test
glihm Sep 8, 2024
f780cc9
Merge remote-tracking branch 'dojo/main' into sozo-execute-with-walnut
glihm Sep 8, 2024
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 Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions bin/sozo/src/commands/options/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ pub struct TransactionOptions {
)]
#[arg(global = true)]
pub receipt: bool,

#[arg(long)]
#[arg(
help = "If --wait is set, the link to debug the transaction with Walnut is displayed on stdout. Otherwise, it is a no-op."
)]
#[arg(global = true)]
pub walnut: bool,
}

impl TransactionOptions {
Expand All @@ -56,6 +63,7 @@ impl TransactionOptions {
receipt: self.receipt,
max_fee_raw: self.max_fee_raw,
fee_estimate_multiplier: self.fee_estimate_multiplier,
walnut: self.walnut,
}),
}
}
Expand All @@ -74,6 +82,7 @@ impl From<TransactionOptions> for TxnConfig {
wait: value.wait,
receipt: value.receipt,
max_fee_raw: value.max_fee_raw,
walnut: value.walnut,
}
}
}
2 changes: 2 additions & 0 deletions crates/dojo-world/src/migration/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ pub struct TxnConfig {
pub wait: bool,
pub receipt: bool,
pub max_fee_raw: Option<Felt>,
pub walnut: bool,
}

#[derive(Debug, Copy, Clone)]
Expand All @@ -112,6 +113,7 @@ pub enum TxnAction {
/// The multiplier for how much the actual transaction max fee should be relative to the
/// estimated fee. If `None` is provided, the multiplier is set to `1.1`.
fee_estimate_multiplier: Option<f64>,
walnut: bool,
},
Estimate,
Simulate,
Expand Down
1 change: 1 addition & 0 deletions crates/sozo/ops/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ tokio.workspace = true
toml.workspace = true
tracing.workspace = true
url.workspace = true
urlencoding = "2.1.3"

dojo-test-utils = { workspace = true, features = [ "build-examples" ], optional = true }
katana-runner = { workspace = true, optional = true }
Expand Down
5 changes: 3 additions & 2 deletions crates/sozo/ops/src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ pub async fn deploy(
};

match txn_action {
TxnAction::Send { wait, receipt, max_fee_raw, fee_estimate_multiplier } => {
TxnAction::Send { wait, receipt, max_fee_raw, fee_estimate_multiplier, walnut } => {
let max_fee = if let Some(max_fee_raw) = max_fee_raw {
MaxFeeType::Manual { max_fee: max_fee_raw }
} else {
Expand Down Expand Up @@ -278,7 +278,8 @@ pub async fn deploy(
};

let account_deployment = account_deployment.max_fee(max_fee.max_fee());
let txn_config = TxnConfig { fee_estimate_multiplier, wait, receipt, max_fee_raw };
let txn_config =
TxnConfig { fee_estimate_multiplier, wait, receipt, max_fee_raw, walnut };
do_account_deploy(
max_fee,
txn_config,
Expand Down
4 changes: 4 additions & 0 deletions crates/sozo/ops/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ where
res,
txn_config.wait,
txn_config.receipt,
txn_config.walnut,
)
.await?;
}
Expand Down Expand Up @@ -182,6 +183,7 @@ where
res,
txn_config.wait,
txn_config.receipt,
txn_config.walnut,
)
.await?;

Expand Down Expand Up @@ -224,6 +226,7 @@ where
res,
txn_config.wait,
txn_config.receipt,
txn_config.walnut,
)
.await?;
}
Expand Down Expand Up @@ -262,6 +265,7 @@ where
res,
txn_config.wait,
txn_config.receipt,
txn_config.walnut,
)
.await?;

Expand Down
1 change: 1 addition & 0 deletions crates/sozo/ops/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ where
res,
txn_config.wait,
txn_config.receipt,
txn_config.walnut,
)
.await
}
1 change: 1 addition & 0 deletions crates/sozo/ops/src/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ where
res,
txn_config.wait,
txn_config.receipt,
txn_config.walnut,
)
.await?;

Expand Down
15 changes: 15 additions & 0 deletions crates/sozo/ops/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use scarb_ui::Ui;
use starknet::accounts::ConnectedAccount;
use starknet::core::types::{BlockId, BlockTag, ExecutionResult, Felt, InvokeTransactionResult};
use starknet::providers::Provider;
use urlencoding::encode;

use crate::migration::ui::MigrationUi;

Expand Down Expand Up @@ -78,12 +79,14 @@ pub async fn get_contract_address_from_reader<P: Provider + Sync + Send>(
/// * `transaction_result` - Result of the transaction to handle.
/// * `wait_for_tx` - Wait for the transaction to be mined.
/// * `show_receipt` - If the receipt of the transaction should be displayed on stdout.
/// * `debug_with_walnut` - If the link to debug the transaction with Walnut should be displayed on stdout.
pub async fn handle_transaction_result<P>(
ui: &Ui,
provider: P,
transaction_result: InvokeTransactionResult,
wait_for_tx: bool,
show_receipt: bool,
debug_with_walnut: bool,
) -> Result<()>
where
P: Provider + Send,
Expand All @@ -106,6 +109,18 @@ where
ui.print(format!("Reason:\n{}", reason));
}
};

// TODO: Find a way to pass the rpc url here
let rpc_url = "https://api.cartridge.gg/x/somedeployment/katana";
let encoded_rpc_url = encode(rpc_url);

if debug_with_walnut {
ui.print_sub(format!(
"Debug transaction with Walnut: https://app.walnut.dev/transactions?rpcUrl={}&txHash={}",
encoded_rpc_url,
transaction_result.transaction_hash
));
}
}
}

Expand Down