Skip to content

Commit dce55cf

Browse files
franciszekjobddoktorskikkawulacptartur
authored
Support RPC 0.8.0 (#3064)
<!-- Reference any GitHub issues resolved by this PR --> Towards #2490 ## Introduced changes <!-- A brief description of the changes --> Bump RPC to 0.8.0: - Introduce `--l1-gas`, `--l1-gas-price`, `--l2-gas`, `--l2-gas-price`, `--l1-data`, `--l1-data-gas` flags - Remove `--max-gas`, `--max-gas-unit-price` flags - Update RPC errors ## Checklist <!-- Make sure all of these are complete --> - [x] Linked relevant issue - [x] Updated relevant documentation - [x] Added relevant tests - [x] Performed self-review of the code - [x] Added changes to `CHANGELOG.md` --------- Co-authored-by: ddoktorski <[email protected]> Co-authored-by: kkawula <[email protected]> Co-authored-by: Artur Michałek <[email protected]>
1 parent b431e2c commit dce55cf

File tree

97 files changed

+1738
-1200
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+1738
-1200
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: CI
22

33
env:
4+
# TODO(#3087): Update SHA once devnet release is available
45
DEVNET_REV: ef789b700770fa27a2fc057b3d1c610771be27d9
56

67
on:
@@ -201,7 +202,8 @@ jobs:
201202
runs-on: ${{ matrix.os }}
202203
strategy:
203204
matrix:
204-
os: [ ubuntu-latest, windows-latest ]
205+
# TODO(#3083): Restore running sncast tests on Windows
206+
os: [ ubuntu-latest ]
205207
steps:
206208
- uses: actions/checkout@v4
207209
- uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ jobs:
199199
- name: Smoke test
200200
shell: bash
201201
env:
202-
RPC_URL: "http://188.34.188.184:7070/rpc/v0_7"
202+
RPC_URL: "http://188.34.188.184:7070/rpc/v0_8"
203203
run: |
204204
BINARY_PATH="${{ env.BINARY_PATH }}"
205205
BINARY_PATH="${BINARY_PATH%.tar.gz}"

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Cast
11+
12+
#### Added
13+
14+
- `--l1-gas`, `--l1-gas-price`, `--l2-gas`, `--l2-gas-price`, `--l1-data-gas`, `--l1-data-gas-price` flags
15+
- methods for fee settings creation, in `FeeSettingsTrait`: `max_fee()`, `resource_bounds()` and `estimate()` (in `sncast_std`)
16+
- `ContractExecutionError` and `ContractExecutionErrorInner` structs (in `sncast_std`)
17+
- `ContractErrorData` (in `sncast_std`)
18+
19+
#### Changed
20+
21+
- Updated argent class hash used in account creation to v0.4.0
22+
- wrapped error for `ContractError` is now of type `ContractErrorData` (in `sncast_std`)
23+
- field `execution_error` in `TransactionExecutionErrorData` is now of type `ContractExecutionError` (in `sncast_std`)
24+
- Using Braavos accounts is temporarily disabled because they don't yet work with the RPC version supported by `sncast`
25+
26+
#### Removed
27+
28+
- `--max-gas` and `--max-gas-unit-price` flags
29+
- `max_gas`, `max_gas_unit_price` fields in `FeeSettings` (in `sncast_std`)
30+
1031
## [0.39.0] - 2025-03-19
1132

1233
### Forge

Cargo.lock

Lines changed: 45 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ rayon = "1.10"
6262
regex = "1.11.1"
6363
serde = { version = "1.0.219", features = ["derive"] }
6464
serde_json = "1.0.140"
65-
starknet = { git = "https://github.com/xJonathanLEI/starknet-rs", rev = "660a732" }
66-
starknet-crypto = { git = "https://github.com/xJonathanLEI/starknet-rs", rev = "660a732" }
65+
starknet = { git = "https://github.com/xJonathanLEI/starknet-rs", rev = "1af6c26" }
66+
starknet-crypto = { git = "https://github.com/xJonathanLEI/starknet-rs", rev = "1af6c26" }
6767
tempfile = "3.18.0"
6868
thiserror = "2.0.12"
6969
ctor = "0.4.1"

crates/conversions/src/serde/serialize/serialize_impl.rs

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use super::{BufferWriter, CairoSerialize};
22
use crate::{IntoConv, byte_array::ByteArray};
33
use blockifier::execution::entry_point::{CallEntryPoint, CallType};
4-
use starknet::core::types::{ContractErrorData, TransactionExecutionErrorData};
4+
use starknet::core::types::{
5+
ContractErrorData, ContractExecutionError, TransactionExecutionErrorData,
6+
};
57
use starknet_api::core::EthAddress;
68
use starknet_api::core::{ClassHash, ContractAddress, EntryPointSelector, Nonce};
79
use starknet_api::transaction::fields::Calldata;
@@ -27,14 +29,34 @@ impl CairoSerialize for CallEntryPoint {
2729

2830
impl CairoSerialize for ContractErrorData {
2931
fn serialize(&self, output: &mut BufferWriter) {
30-
ByteArray::from(self.revert_error.as_str()).serialize(output);
32+
self.revert_error.serialize(output);
33+
}
34+
}
35+
36+
// TODO(#3129)
37+
impl CairoSerialize for ContractExecutionError {
38+
fn serialize(&self, output: &mut BufferWriter) {
39+
match &self {
40+
// We need to add 0 and 1 because of enum variants serialization
41+
ContractExecutionError::Nested(inner) => {
42+
0.serialize(output);
43+
inner.class_hash.serialize(output);
44+
inner.contract_address.serialize(output);
45+
inner.selector.serialize(output);
46+
inner.error.serialize(output);
47+
}
48+
ContractExecutionError::Message(msg) => {
49+
1.serialize(output);
50+
ByteArray::from(msg.as_str()).serialize(output);
51+
}
52+
}
3153
}
3254
}
3355

3456
impl CairoSerialize for TransactionExecutionErrorData {
3557
fn serialize(&self, output: &mut BufferWriter) {
3658
self.transaction_index.serialize(output);
37-
ByteArray::from(self.execution_error.as_str()).serialize(output);
59+
self.execution_error.serialize(output);
3860
}
3961
}
4062

crates/data-transformer/tests/integration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static CLASS: OnceCell<ContractClass> = OnceCell::const_new();
2121

2222
async fn init_class() -> ContractClass {
2323
let client = JsonRpcClient::new(HttpTransport::new(
24-
Url::parse("http://188.34.188.184:7070/rpc/v0_7").unwrap(),
24+
Url::parse("http://188.34.188.184:7070/rpc/v0_8").unwrap(),
2525
));
2626

2727
client

crates/forge/tests/data/forking/.snfoundry_cache/http___188_34_188_184_7070_rpc_v0_7_54060_v0_38_3.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

crates/shared/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@ snapbox.workspace = true
1616
indicatif.workspace = true
1717
clap.workspace = true
1818
clap_complete.workspace = true
19+
20+
[features]
21+
testing = []

0 commit comments

Comments
 (0)