Skip to content

Commit

Permalink
katana: update default predeployed accounts (#2524)
Browse files Browse the repository at this point in the history
ref #2498 #2405 

- update the default predeployed account class implementation to OZ `0.17.0` account [preset](https://github.com/OpenZeppelin/cairo-contracts/blob/v0.17.0/packages/presets/src/account.cairo)
- rename class constants

is it required to change the account implementation because the version we're using doesn't support transaction version > 1 as seen below:

https://github.com/OpenZeppelin/cairo-contracts/blob/6ab91b5cf57d6a7d02f2d5c5abfc7b5712bc8e47/src/account/account.cairo#L75C1-L77C14

technically v3 support is later added in OZ `0.8.1`. so going all the way to `0.17.0` may seem exaggerated, but `0.8.1` is ~8 months old now so better to just use the latest compatible version. tbh i dont exactly know how different `0.17.0` is compared to `0.8.1`.
  • Loading branch information
kariy authored Oct 14, 2024
1 parent ac487cd commit bc5d2f6
Show file tree
Hide file tree
Showing 60 changed files with 365 additions and 4,769 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion bin/sozo/src/commands/options/account/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ mod tests {
.build_test_config("spawn-and-move", Profile::DEV);

let world_addr = felt!("0x74c73d35df54ddc53bcf34aab5e0dbb09c447e99e01f4d69535441253c9571a");
let user_addr = felt!("0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03");
let user_addr = felt!("0x2af9427c5a277474c079a1283c880ee8a6f0f8fbf73ce969c08d88befec1bba");

let policies =
collect_policies(WorldAddressOrName::Address(world_addr), user_addr, &config).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion bin/sozo/tests/test_data/policies.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
"method": "set_facts_registry"
},
{
"target": "0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03",
"target": "0x2af9427c5a277474c079a1283c880ee8a6f0f8fbf73ce969c08d88befec1bba",
"method": "__declare_transaction__"
},
{
Expand Down
2 changes: 1 addition & 1 deletion crates/benches/contracts/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ initializer_class_hash = "0xbeef"
[tool.dojo.env]
# rpc_url = "http://localhost:5050/"
# Default account for katana with seed = 0
account_address = "0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03"
account_address = "0x2af9427c5a277474c079a1283c880ee8a6f0f8fbf73ce969c08d88befec1bba"
private_key = "0x1800000000300000180000000000030000000000003006001800006600"

[tool.dojo.world.namespace]
Expand Down
2 changes: 1 addition & 1 deletion crates/dojo-world/src/metadata_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async fn get_full_dojo_metadata_from_workspace() {
assert!(
env.account_address
.unwrap()
.eq("0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03")
.eq("0x2af9427c5a277474c079a1283c880ee8a6f0f8fbf73ce969c08d88befec1bba")
);

assert!(env.private_key.is_some());
Expand Down
2 changes: 1 addition & 1 deletion crates/katana/cairo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ cairo-lang-starknet = "2.7.0"
cairo-lang-starknet-classes = "2.7.0"
cairo-lang-utils = "2.7.0"
cairo-vm = "1.0.1"
starknet_api = { git = "https://github.com/dojoengine/sequencer", tag = "v0.8.0-rc3.1" }
starknet_api = { git = "https://github.com/dojoengine/sequencer", tag = "v0.8.0-rc3.2" }
2 changes: 1 addition & 1 deletion crates/katana/contracts/.tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
scarb 2.8.3
scarb 2.8.2
14 changes: 14 additions & 0 deletions crates/katana/contracts/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CONTRACT_CLASS_SUFFIX := .contract_class.json
# Directory where the compiled classes will be stored
BUILD_DIR := ./build

## ---- Default Pre-deployed Account

ORIGINAL_CLASS_NAME := katana_account_Account$(CONTRACT_CLASS_SUFFIX)
CLASS_NAME := default_account.json

$(BUILD_DIR): ./account/src/*
scarb build -p katana_account
mv target/dev/$(ORIGINAL_CLASS_NAME) $(BUILD_DIR)/$(CLASS_NAME)

## ----
3 changes: 1 addition & 2 deletions crates/katana/contracts/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ edition = "2023_11"
[workspace.dependencies]
starknet = "2.8.2"
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.17.0" }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.31.0" }
assert_macros = "2.8.2"
snforge_std = "0.30.0"
1 change: 1 addition & 0 deletions crates/katana/contracts/account/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ openzeppelin.workspace = true

[[target.starknet-contract]]
sierra = true
casm = true
File renamed without changes.
1 change: 1 addition & 0 deletions crates/katana/contracts/build/default_account.json

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
Loading

0 comments on commit bc5d2f6

Please sign in to comment.