-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:kkrt-labs/kakarot-rpc into dev/remo…
…ve-from-dump-state
- Loading branch information
Showing
24 changed files
with
142 additions
and
63 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,33 @@ | ||
use rstest::*; | ||
use starknet::core::types::{BlockId, BlockTag}; | ||
#[cfg(test)] | ||
mod tests { | ||
|
||
use crate::client::api::KakarotStarknetApi; | ||
use crate::contracts::account::{Account, KakarotAccount}; | ||
use crate::test_utils::deploy_helpers::{get_contract, get_contract_deployed_bytecode, KakarotTestEnvironmentContext}; | ||
use crate::test_utils::fixtures::kakarot_test_env_ctx; | ||
use kakarot_rpc_core::client::api::KakarotStarknetApi; | ||
use kakarot_test_utils::deploy_helpers::{ | ||
get_contract, get_contract_deployed_bytecode, KakarotTestEnvironmentContext, | ||
}; | ||
use kakarot_test_utils::fixtures::kakarot_test_env_ctx; | ||
use rstest::*; | ||
use starknet::core::types::{BlockId, BlockTag}; | ||
|
||
#[rstest] | ||
#[tokio::test(flavor = "multi_thread")] | ||
async fn test_bytecode(kakarot_test_env_ctx: KakarotTestEnvironmentContext) { | ||
// Given | ||
let contract_name = "Counter"; | ||
let counter_starknet_address = kakarot_test_env_ctx.evm_contract(contract_name).addresses.starknet_address; | ||
let counter_contract = get_contract(contract_name); | ||
let expected_bytecode = get_contract_deployed_bytecode(counter_contract); | ||
use crate::contracts::account::{Account, KakarotAccount}; | ||
|
||
let starknet_block_id = BlockId::Tag(BlockTag::Latest); | ||
let starknet_provider = kakarot_test_env_ctx.client().starknet_provider(); | ||
let counter_contract_account = KakarotAccount::new(counter_starknet_address, starknet_provider.as_ref()); | ||
#[rstest] | ||
#[tokio::test(flavor = "multi_thread")] | ||
async fn test_bytecode(kakarot_test_env_ctx: KakarotTestEnvironmentContext) { | ||
// Given | ||
let contract_name = "Counter"; | ||
let counter_starknet_address = kakarot_test_env_ctx.evm_contract(contract_name).addresses.starknet_address; | ||
let counter_contract = get_contract(contract_name); | ||
let expected_bytecode = get_contract_deployed_bytecode(counter_contract); | ||
|
||
// When | ||
let actual_bytecode = counter_contract_account.bytecode(&starknet_block_id).await.unwrap(); | ||
let starknet_block_id = BlockId::Tag(BlockTag::Latest); | ||
let starknet_provider = kakarot_test_env_ctx.client().starknet_provider(); | ||
let counter_contract_account = KakarotAccount::new(counter_starknet_address, starknet_provider.as_ref()); | ||
|
||
// Then | ||
assert_eq!(expected_bytecode.to_vec(), actual_bytecode.to_vec()); | ||
// When | ||
let actual_bytecode = counter_contract_account.bytecode(&starknet_block_id).await.unwrap(); | ||
|
||
// Then | ||
assert_eq!(expected_bytecode.to_vec(), actual_bytecode.to_vec()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,3 @@ pub mod client; | |
pub mod contracts; | ||
pub mod mock; | ||
pub mod models; | ||
pub mod test_utils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
[package] | ||
name = "kakarot-test-utils" | ||
version.workspace = true | ||
edition.workspace = true | ||
authors.workspace = true | ||
description.workspace = true | ||
homepage.workspace = true | ||
repository.workspace = true | ||
readme.workspace = true | ||
license.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
kakarot-rpc-core={ path = "../core" } | ||
|
||
dojo-test-utils = { workspace = true } | ||
katana-core = { workspace = true } | ||
reth-primitives = { workspace = true } | ||
starknet = { workspace = true } | ||
starknet-crypto = { workspace = true } | ||
url = { workspace = true } | ||
|
||
lazy_static = { workspace = true } | ||
tokio = { workspace = true } | ||
|
||
bytes = "1" | ||
dotenv = { workspace = true } | ||
ethers = { workspace = true } | ||
ethers-solc = { workspace = true } | ||
foundry-config = { git = "https://github.com/foundry-rs/foundry", branch = "master" } | ||
rstest = { workspace = true } | ||
git2 = { workspace = true, optional = true } | ||
|
||
futures = "0.3.26" | ||
serde = { workspace = true } | ||
serde_json = { workspace = true, features = ["preserve_order"] } | ||
serde_with = { workspace = true } | ||
|
||
[features] | ||
dump = ["git2"] | ||
|
||
[[bin]] | ||
name = "dump-katana" | ||
path = "src/bin/dump-katana.rs" | ||
required-features = ["dump"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
crates/core/src/test_utils/fixtures.rs → crates/test-utils/src/fixtures.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Submodule kakarot
updated
27 files
Submodule madara
updated
24 files