Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
kariy committed Aug 20, 2024
1 parent 7a30624 commit 72f2b49
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 123 deletions.
129 changes: 23 additions & 106 deletions Cargo.lock

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

16 changes: 10 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ inherits = "release"
lto = "fat"

[workspace.dependencies]
# cainome = { git = "https://github.com/cartridge-gg/cainome", tag = "v0.3.2", features = [ "abigen-rs" ] }
cainome = { git = "https://github.com/cartridge-gg/cainome", branch = "main", features = [ "abigen-rs" ] }
cainome = { git = "https://github.com/cartridge-gg/cainome", rev = "fb91215", features = [ "abigen-rs" ] }
common = { path = "crates/common" }

# metrics
Expand Down Expand Up @@ -224,10 +223,15 @@ alloy-sol-types = { version = "0.7.6", default-features = false }
criterion = "0.5.1"

# Controller integration
account_sdk = { git = "https://github.com/cartridge-gg/controller", rev = "146048fc" }
slot = { git = "https://github.com/cartridge-gg/slot", rev = "84602647" }
# account_sdk = { path = "../../cartridge/controller/packages/account_sdk" }
# slot = { path = "../../cartridge/slot/slot" }
#
# IMPORTANT:
#
# Maintainer must ensure that the Controller (account_sdk) revision is the same across Dojo,
# and Slot because of the dependency chain and also because account_sdk is not being versioned
# yet atm. Dojo depends on Slot and Slot depends on Controller, the version of Controller (account_sdk)
# must be the same across all stack as their API are being used against each other.
account_sdk = { git = "https://github.com/cartridge-gg/controller", rev = "0b5c318" }
slot = { git = "https://github.com/cartridge-gg/slot", rev = "a95f01e75f20a7902e23859614992e306c06a18b" }

alloy-contract = { version = "0.2", default-features = false }
alloy-json-rpc = { version = "0.2", default-features = false }
Expand Down
11 changes: 3 additions & 8 deletions bin/sozo/src/commands/options/account/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ where

let policies = collect_policies(world_addr_or_name, contract_address, config)?;
// check if the policies have changed
let is_equal = is_equal_to_existing(&policies, rpc_url.clone(), chain_id, session);
let is_equal = is_equal_to_existing(&policies, &session);

if is_equal {
session
Expand All @@ -86,7 +86,7 @@ where
"Policies have changed. Creating new session."
);

let session = slot::session::create(rpc_url, &policies).await?;
let session = slot::session::create(rpc_url.clone(), &policies).await?;
slot::session::store(chain_id, &session)?;
session
}
Expand Down Expand Up @@ -125,12 +125,7 @@ where
}

// Check if the new policies are equal to the ones in the existing session
async fn is_equal_to_existing(
new_policies: &[Policy],
rpc_url: Url,
chain_id: Felt,
session: SessionMetadata,
) -> bool {
fn is_equal_to_existing(new_policies: &[Policy], session: &SessionMetadata) -> bool {
let allowed_methods = new_policies
.iter()
.map(|p| AllowedMethod::new(p.target, get_selector_from_name(&p.method).unwrap()))
Expand Down
2 changes: 1 addition & 1 deletion bin/sozo/src/commands/options/account/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub enum SozoAccountSignError {
#[allow(missing_debug_implementations)]
pub enum SozoAccount<P>
where
P: Provider,
P: Provider + Send + Sync,
{
Standard(SingleOwnerAccount<P, LocalWallet>),

Expand Down
4 changes: 2 additions & 2 deletions crates/katana/core/src/service/messaging/starknet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use katana_primitives::chain::ChainId;
use katana_primitives::receipt::MessageToL1;
use katana_primitives::transaction::L1HandlerTx;
use katana_primitives::utils::transaction::compute_l2_to_l1_message_hash;
use starknet::accounts::{Account, Call, ExecutionEncoding, SingleOwnerAccount};
use starknet::core::types::{BlockId, BlockTag, EmittedEvent, EventFilter, Felt};
use starknet::accounts::{Account, ExecutionEncoding, SingleOwnerAccount};
use starknet::core::types::{BlockId, BlockTag, Call, EmittedEvent, EventFilter, Felt};
use starknet::core::utils::starknet_keccak;
use starknet::macros::{felt, selector};
use starknet::providers::jsonrpc::HttpTransport;
Expand Down

0 comments on commit 72f2b49

Please sign in to comment.