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

Update starknet-rs to fix offset serde #239

Merged
merged 3 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
72 changes: 36 additions & 36 deletions Cargo.lock

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

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ indexmap = "2.0.0"
starknet_api = { version = "0.5.0-rc1", features = ["testing"] }
starknet-in-rust = { git = "https://github.com/lambdaclass/starknet_in_rust", rev = "a7e2e56", package="starknet_in_rust" }
blockifier = { git = "https://github.com/starkware-libs/blockifier", rev = "v0.3.0-rc0", package = "blockifier" }
starknet-rs-signers = { version = "0.4.0", package="starknet-signers" }
starknet-rs-ff = { version = "0.3.4", package = "starknet-ff" }
starknet-rs-core = { version = "0.6.0", package = "starknet-core" }
starknet-rs-providers = { version = "0.6.0", package = "starknet-providers" }
starknet-rs-accounts = { version = "0.5.0", package = "starknet-accounts" }
starknet-rs-contract = { version = "0.5.0", package = "starknet-contract" }
starknet-rs-crypto = { version = "0.6.0", package = "starknet-crypto" }
starknet-rs-signers = { version = "0.5.0", package="starknet-signers" }
starknet-rs-ff = { version = "0.3.5", package = "starknet-ff" }
starknet-rs-core = { version = "0.7.1", package = "starknet-core" }
starknet-rs-providers = { version = "0.7.0", package = "starknet-providers" }
starknet-rs-accounts = { version = "0.6.0", package = "starknet-accounts" }
starknet-rs-contract = { version = "0.6.0", package = "starknet-contract" }
starknet-rs-crypto = { version = "0.6.1", package = "starknet-crypto" }
cairo-felt = { version = "0.8.5", package = "cairo-felt" }
cairo-lang-starknet = { version = "2.2.0", package = "cairo-lang-starknet" }
url = "2.4"
Expand Down
39 changes: 39 additions & 0 deletions crates/starknet-server/tests/get_transaction_receipt_by_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,45 @@ mod get_transaction_receipt_by_hash_integration_tests {
}
}

#[tokio::test]
async fn declare_v1_accepted_with_numeric_entrypoint_offset() {
let devnet = BackgroundDevnet::spawn().await.unwrap();

let declare_file_content = std::fs::File::open(concat!(
env!("CARGO_MANIFEST_DIR"),
"/test_data/rpc/declare_v1.json"
))
.unwrap();
let mut declare_rpc_body: serde_json::Value =
serde_json::from_reader(declare_file_content).unwrap();

let entry_points = declare_rpc_body["contract_class"]["entry_points_by_type"]["EXTERNAL"]
.as_array_mut()
.unwrap();
for entry_point in entry_points {
// We are assuming hex string format in the loaded artifact;
// Converting it to numeric value to test that case
let offset_hex_string = entry_point["offset"].as_str().unwrap();
entry_point["offset"] =
u32::from_str_radix(&offset_hex_string[2..], 16).unwrap().into();
}

let resp = &devnet
.send_custom_rpc(
"starknet_addDeclareTransaction",
serde_json::json!({ "declare_transaction": declare_rpc_body }),
)
.await;

match resp["error"]["code"].as_u64() {
Some(53) => {
// We got error code corresponding to insufficient balance, which is ok;
// it's important we didn't get failed JSON schema matching with error -32602
}
_ => panic!("Unexpected response: {resp}"),
}
}

#[tokio::test]
async fn get_non_existing_transaction() {
let devnet = BackgroundDevnet::spawn().await.expect("Could not start Devnet");
Expand Down
6 changes: 3 additions & 3 deletions crates/starknet-server/tests/test_simulate_transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ mod estimate_fee_tests {
.nonce(nonce)
.prepared()
.unwrap()
.get_declare_request()
.get_declare_request(false)
.await
.unwrap()
.signature;
Expand Down Expand Up @@ -154,7 +154,7 @@ mod estimate_fee_tests {
.nonce(nonce)
.prepared()
.unwrap()
.get_declare_request()
.get_declare_request(false)
.await
.unwrap()
.signature;
Expand Down Expand Up @@ -353,7 +353,7 @@ mod estimate_fee_tests {
.nonce(nonce)
.prepared()
.unwrap()
.get_invoke_request()
.get_invoke_request(false)
.await
.unwrap();
let signature_hex: Vec<String> = iter_to_hex_felt(&invoke_request.signature);
Expand Down