Skip to content

Commit

Permalink
chore: Move all crates under crates/madara dir (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
notlesh authored Jan 3, 2025
1 parent ce9b96f commit 7319679
Show file tree
Hide file tree
Showing 291 changed files with 87 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target
crates/client/sync/test-data/*.json
crates/madara/client/sync/test-data/*.json
infra/Signoz
cairo-artifacts
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Next release

- chore: Move crates under a madara subdir
- chore(nix): resolve flake and direnv compatibility issues
- fix: Gateway path fix
- fix: instrumentation code
Expand Down
150 changes: 76 additions & 74 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,58 +1,60 @@
[workspace]
members = [
"crates/client/db",
"crates/client/exec",
"crates/client/sync",
"crates/client/eth",
"crates/client/rpc",
"crates/client/gateway/client",
"crates/client/gateway/server",
"crates/client/analytics",
"crates/client/telemetry",
"crates/client/devnet",
"crates/client/mempool",
"crates/client/block_import",
"crates/node",
"crates/primitives/block",
"crates/primitives/convert",
"crates/primitives/transactions",
"crates/primitives/class",
"crates/primitives/gateway",
"crates/primitives/receipt",
"crates/primitives/state_update",
"crates/primitives/chain_config",
"crates/primitives/utils",
"crates/proc-macros",
"crates/tests",
"crates/cairo-test-contracts",
"crates/client/block_production",
# madara
"crates/madara/client/db",
"crates/madara/client/exec",
"crates/madara/client/sync",
"crates/madara/client/eth",
"crates/madara/client/rpc",
"crates/madara/client/gateway/client",
"crates/madara/client/gateway/server",
"crates/madara/client/analytics",
"crates/madara/client/telemetry",
"crates/madara/client/devnet",
"crates/madara/client/mempool",
"crates/madara/client/block_import",
"crates/madara/node",
"crates/madara/primitives/block",
"crates/madara/primitives/convert",
"crates/madara/primitives/transactions",
"crates/madara/primitives/class",
"crates/madara/primitives/gateway",
"crates/madara/primitives/receipt",
"crates/madara/primitives/state_update",
"crates/madara/primitives/chain_config",
"crates/madara/primitives/utils",
"crates/madara/proc-macros",
"crates/madara/tests",
"crates/madara/cairo-test-contracts",
"crates/madara/client/block_production",
]
resolver = "2"
# Everything except test-related packages, so that they are not compiled when doing `cargo build`.
default-members = [
"crates/client/db",
"crates/client/exec",
"crates/client/sync",
"crates/client/eth",
"crates/client/gateway/client",
"crates/client/gateway/server",
"crates/client/rpc",
"crates/client/telemetry",
"crates/client/devnet",
"crates/client/mempool",
"crates/client/block_import",
"crates/client/analytics",
"crates/node",
"crates/primitives/block",
"crates/primitives/convert",
"crates/primitives/transactions",
"crates/primitives/class",
"crates/primitives/gateway",
"crates/primitives/receipt",
"crates/primitives/state_update",
"crates/primitives/chain_config",
"crates/primitives/utils",
"crates/proc-macros",
# madara
"crates/madara/client/db",
"crates/madara/client/exec",
"crates/madara/client/sync",
"crates/madara/client/eth",
"crates/madara/client/gateway/client",
"crates/madara/client/gateway/server",
"crates/madara/client/rpc",
"crates/madara/client/telemetry",
"crates/madara/client/devnet",
"crates/madara/client/mempool",
"crates/madara/client/block_import",
"crates/madara/client/analytics",
"crates/madara/node",
"crates/madara/primitives/block",
"crates/madara/primitives/convert",
"crates/madara/primitives/transactions",
"crates/madara/primitives/class",
"crates/madara/primitives/gateway",
"crates/madara/primitives/receipt",
"crates/madara/primitives/state_update",
"crates/madara/primitives/chain_config",
"crates/madara/primitives/utils",
"crates/madara/proc-macros",
]

[workspace.lints.rust]
Expand Down Expand Up @@ -104,37 +106,37 @@ bonsai-trie = { default-features = false, git = "https://github.com/madara-allia
] }

# Madara proc macros
m-proc-macros = { path = "crates/proc-macros", default-features = false }
m-proc-macros = { path = "crates/madara/proc-macros", default-features = false }

# Madara primtitives
mp-block = { path = "crates/primitives/block", default-features = false }
mp-convert = { path = "crates/primitives/convert", default-features = false }
mp-transactions = { path = "crates/primitives/transactions", default-features = false }
mp-class = { path = "crates/primitives/class", default-features = false }
mp-gateway = { path = "crates/primitives/gateway", default-features = false }
mp-receipt = { path = "crates/primitives/receipt", default-features = false }
mp-state-update = { path = "crates/primitives/state_update", default-features = false }
mp-utils = { path = "crates/primitives/utils", default-features = false }
mp-chain-config = { path = "crates/primitives/chain_config", default-features = false }
mp-oracle = { path = "crates/primitives/oracle", default-features = false }
mp-block = { path = "crates/madara/primitives/block", default-features = false }
mp-convert = { path = "crates/madara/primitives/convert", default-features = false }
mp-transactions = { path = "crates/madara/primitives/transactions", default-features = false }
mp-class = { path = "crates/madara/primitives/class", default-features = false }
mp-gateway = { path = "crates/madara/primitives/gateway", default-features = false }
mp-receipt = { path = "crates/madara/primitives/receipt", default-features = false }
mp-state-update = { path = "crates/madara/primitives/state_update", default-features = false }
mp-utils = { path = "crates/madara/primitives/utils", default-features = false }
mp-chain-config = { path = "crates/madara/primitives/chain_config", default-features = false }
mp-oracle = { path = "crates/madara/primitives/oracle", default-features = false }

# Madara client
mc-analytics = { path = "crates/client/analytics" }
mc-telemetry = { path = "crates/client/telemetry" }
mc-db = { path = "crates/client/db" }
mc-exec = { path = "crates/client/exec" }
mc-rpc = { path = "crates/client/rpc" }
mc-gateway-client = { path = "crates/client/gateway/client" }
mc-gateway-server = { path = "crates/client/gateway/server" }
mc-sync = { path = "crates/client/sync" }
mc-eth = { path = "crates/client/eth" }
mc-mempool = { path = "crates/client/mempool" }
mc-block-production = { path = "crates/client/block_production" }
mc-block-import = { path = "crates/client/block_import" }
mc-devnet = { path = "crates/client/devnet" }
mc-analytics = { path = "crates/madara/client/analytics" }
mc-telemetry = { path = "crates/madara/client/telemetry" }
mc-db = { path = "crates/madara/client/db" }
mc-exec = { path = "crates/madara/client/exec" }
mc-rpc = { path = "crates/madara/client/rpc" }
mc-gateway-client = { path = "crates/madara/client/gateway/client" }
mc-gateway-server = { path = "crates/madara/client/gateway/server" }
mc-sync = { path = "crates/madara/client/sync" }
mc-eth = { path = "crates/madara/client/eth" }
mc-mempool = { path = "crates/madara/client/mempool" }
mc-block-production = { path = "crates/madara/client/block_production" }
mc-block-import = { path = "crates/madara/client/block_import" }
mc-devnet = { path = "crates/madara/client/devnet" }

# Madara misc
m-cairo-test-contracts = { path = "crates/cairo-test-contracts" }
m-cairo-test-contracts = { path = "crates/madara/cairo-test-contracts" }

# Starknet dependencies
cairo-vm = "=1.0.1"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() {
let cairo_project_dir = "../../cairo";
let cairo_project_dir = "../../../cairo";
println!("cargo::rerun-if-changed={cairo_project_dir}/src");
println!("cargo::rerun-if-changed={cairo_project_dir}/Scarb.toml");
// Note: scarb build updates the Scarb.lock file, and there is no `--locked` arg to avoid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
//! tests need to be put in the `cairo-artifacts` folder at the root of the project`.
pub const TEST_CONTRACT_SIERRA: &[u8] =
include_bytes!("../../../cairo/target/dev/madara_contracts_TestContract.contract_class.json");
include_bytes!("../../../../cairo/target/dev/madara_contracts_TestContract.contract_class.json");
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ impl StorageDiffs {
// We allow ourselves to lie about the contract_address. This is because we want the UDC and the two ERC20 contracts to have well known addresses on every chain.

/// Universal Deployer Contract.
const UDC_CLASS_DEFINITION: &[u8] = include_bytes!("../../../../cairo-artifacts/madara_contracts_UDC.json");
const UDC_CLASS_DEFINITION: &[u8] = include_bytes!("../../../../../cairo-artifacts/madara_contracts_UDC.json");
const UDC_CONTRACT_ADDRESS: Felt =
Felt::from_hex_unchecked("0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf");

const ERC20_CLASS_DEFINITION: &[u8] =
include_bytes!("../../../../cairo-artifacts/openzeppelin_ERC20Upgradeable.contract_class.json");
include_bytes!("../../../../../cairo-artifacts/openzeppelin_ERC20Upgradeable.contract_class.json");
const ERC20_STRK_CONTRACT_ADDRESS: Felt =
Felt::from_hex_unchecked("0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d");
const ERC20_ETH_CONTRACT_ADDRESS: Felt =
Felt::from_hex_unchecked("0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7");

const ACCOUNT_CLASS_DEFINITION: &[u8] =
include_bytes!("../../../../cairo-artifacts/openzeppelin_AccountUpgradeable.contract_class.json");
include_bytes!("../../../../../cairo-artifacts/openzeppelin_AccountUpgradeable.contract_class.json");

/// High level description of the genesis block.
#[derive(Clone, Debug, Default)]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ mod tests {
#[rstest]
fn test_mainnet_from_yaml() {
// Change the current directory
std::env::set_current_dir("../../../").expect("Failed to change directory");
std::env::set_current_dir("../../../../").expect("Failed to change directory");
let chain_config: ChainConfig =
ChainConfig::from_yaml(Path::new("configs/presets/mainnet.yaml")).expect("failed to get cfg");

Expand All @@ -480,8 +480,9 @@ mod tests {

// Check versioned constants
// Load and parse the JSON file
let json_content = fs::read_to_string("crates/primitives/chain_config/resources/versioned_constants_13_0.json")
.expect("Failed to read JSON file");
let json_content =
fs::read_to_string("crates/madara/primitives/chain_config/resources/versioned_constants_13_0.json")
.expect("Failed to read JSON file");
let json: Value = serde_json::from_str(&json_content).expect("Failed to parse JSON");

// Get the VersionedConstants for version 0.13.0
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7319679

Please sign in to comment.