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 38 commits
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
20 changes: 20 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ members = [
"crates/saya/core",
"crates/saya/provider",
"crates/sozo/signers",
"crates/sozo/walnut",
"crates/torii/client",
"crates/torii/server",
"crates/torii/types-test",
Expand Down Expand Up @@ -111,6 +112,7 @@ saya-provider = { path = "crates/saya/provider" }
# sozo
sozo-ops = { path = "crates/sozo/ops" }
sozo-signers = { path = "crates/sozo/signers" }
sozo-walnut = { path = "crates/sozo/walnut" }

anyhow = "1.0.80"
assert_fs = "1.1"
Expand Down Expand Up @@ -207,6 +209,7 @@ tower-http = "0.4.4"
tracing = "0.1.34"
tracing-subscriber = { version = "0.3.16", features = [ "env-filter", "json" ] }
url = { version = "2.4.0", features = [ "serde" ] }
walkdir = "2.5.0"

# server
hyper = "0.14.27"
Expand Down
38 changes: 30 additions & 8 deletions bin/sozo/src/commands/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,24 +149,38 @@ pub async fn grant(
) -> Result<()> {
trace!(?kind, ?world, ?starknet, ?account, ?transaction, "Executing Grant command.");
let world =
utils::world_from_env_metadata(world, account, starknet, &env_metadata, config).await?;
utils::world_from_env_metadata(world, account, &starknet, &env_metadata, config).await?;

match kind {
AuthKind::Writer { models_contracts } => {
trace!(
contracts=?models_contracts,
"Granting Writer permissions."
);
auth::grant_writer(ui, &world, &models_contracts, transaction.into(), default_namespace)
.await
auth::grant_writer(
ui,
&world,
&models_contracts,
transaction.into(),
default_namespace,
&starknet.url(env_metadata.as_ref()).ok(),
)
.await
}
AuthKind::Owner { owners_resources } => {
trace!(
resources=?owners_resources,
"Granting Owner permissions."
);
auth::grant_owner(ui, &world, &owners_resources, transaction.into(), default_namespace)
.await
auth::grant_owner(
ui,
&world,
&owners_resources,
transaction.into(),
default_namespace,
&starknet.url(env_metadata.as_ref()).ok(),
)
.await
}
}
}
Expand All @@ -185,7 +199,7 @@ pub async fn revoke(
) -> Result<()> {
trace!(?kind, ?world, ?starknet, ?account, ?transaction, "Executing Revoke command.");
let world =
utils::world_from_env_metadata(world, account, starknet, &env_metadata, config).await?;
utils::world_from_env_metadata(world, account, &starknet, &env_metadata, config).await?;

match kind {
AuthKind::Writer { models_contracts } => {
Expand All @@ -199,6 +213,7 @@ pub async fn revoke(
&models_contracts,
transaction.into(),
default_namespace,
&starknet.url(env_metadata.as_ref()).ok(),
)
.await
}
Expand All @@ -207,8 +222,15 @@ pub async fn revoke(
resources=?owners_resources,
"Revoking Owner permissions."
);
auth::revoke_owner(ui, &world, &owners_resources, transaction.into(), default_namespace)
.await
auth::revoke_owner(
ui,
&world,
&owners_resources,
transaction.into(),
default_namespace,
&starknet.url(env_metadata.as_ref()).ok(),
)
.await
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion bin/sozo/src/commands/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl ExecuteArgs {
let world = utils::world_from_env_metadata(
self.world,
self.account,
self.starknet,
&self.starknet,
&env_metadata,
config,
)
Expand Down Expand Up @@ -93,6 +93,7 @@ impl ExecuteArgs {
calldata,
&world,
&tx_config,
&self.starknet.url(env_metadata.as_ref()).ok(),
)
.await
})
Expand Down
11 changes: 9 additions & 2 deletions bin/sozo/src/commands/options/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ pub struct TransactionOptions {
)]
#[arg(global = true)]
pub receipt: bool,

#[arg(long)]
#[arg(help = "Display the link to debug the transaction with Walnut.")]
#[arg(global = true)]
pub walnut: bool,
}

impl TransactionOptions {
Expand All @@ -52,10 +57,11 @@ impl TransactionOptions {
(true, false) => Ok(TxnAction::Estimate),
(false, true) => Ok(TxnAction::Simulate),
(false, false) => Ok(TxnAction::Send {
wait: self.wait,
wait: self.wait || self.walnut,
receipt: self.receipt,
max_fee_raw: self.max_fee_raw,
fee_estimate_multiplier: self.fee_estimate_multiplier,
walnut: self.walnut,
}),
}
}
Expand All @@ -71,9 +77,10 @@ impl From<TransactionOptions> for TxnConfig {
);
Self {
fee_estimate_multiplier: value.fee_estimate_multiplier,
wait: value.wait,
wait: value.wait || value.walnut,
receipt: value.receipt,
max_fee_raw: value.max_fee_raw,
walnut: value.walnut,
}
}
}
3 changes: 2 additions & 1 deletion bin/sozo/src/commands/register.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl RegisterArgs {

config.tokio_handle().block_on(async {
let world =
utils::world_from_env_metadata(world, account, starknet, &env_metadata, config)
utils::world_from_env_metadata(world, account, &starknet, &env_metadata, config)
.await?;
let provider = world.account.provider();
let mut world_reader = WorldContractReader::new(world_address, &provider);
Expand All @@ -73,6 +73,7 @@ impl RegisterArgs {
world_reader,
world_address,
config,
&starknet.url(env_metadata.as_ref()).ok(),
)
.await
})
Expand Down
4 changes: 2 additions & 2 deletions bin/sozo/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub fn load_metadata_from_config(config: &Config) -> Result<Option<Environment>,
pub async fn world_from_env_metadata(
world: WorldOptions,
account: AccountOptions,
starknet: StarknetOptions,
starknet: &StarknetOptions,
env_metadata: &Option<Environment>,
config: &Config,
) -> Result<WorldContract<SozoAccount<JsonRpcClient<HttpTransport>>>, Error> {
Expand All @@ -64,7 +64,7 @@ pub async fn world_from_env_metadata(
.account(
provider,
WorldAddressOrName::Address(world_address),
&starknet,
starknet,
env_metadata,
config,
)
Expand Down
Loading