Skip to content

Commit 42ee390

Browse files
Copilotcptartur
andcommitted
Merge main branch to incorporate latest changes
Co-authored-by: cptartur <52135326+cptartur@users.noreply.github.com>
1 parent ea63e70 commit 42ee390

File tree

40 files changed

+313
-73
lines changed

40 files changed

+313
-73
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,6 @@ jobs:
148148
with:
149149
name: nextest-archive-${{ runner.os }}
150150
- name: nextest partition ${{ matrix.partition }}/3
151-
# TODO(#3937): remove env override once new RPC URL is available in tests.
152-
env:
153-
SNCAST_IGNORE_RPC_0_9_CHECK: "1"
154151
run: cargo nextest run --no-fail-fast --partition 'count:${{ matrix.partition }}/3' --archive-file 'nextest-archive-${{ runner.os }}.tar.zst' e2e
155152

156153
test-forge-e2e-native:
@@ -199,9 +196,6 @@ jobs:
199196
with:
200197
name: nextest-archive-${{ runner.os }}-native
201198
- name: nextest partition ${{ matrix.partition }}/3
202-
# TODO(#3937): remove env override once new RPC URL is available in tests.
203-
env:
204-
SNCAST_IGNORE_RPC_0_9_CHECK: "1"
205199
run: cargo nextest run --no-fail-fast --partition 'count:${{ matrix.partition }}/3' --archive-file 'nextest-archive-${{ runner.os }}-native.tar.zst' e2e
206200

207201
test-plugin-checks:
@@ -297,9 +291,6 @@ jobs:
297291
- uses: asdf-vm/actions/install@05e0d2ed97b598bfce82fd30daf324ae0c4570e6
298292
- uses: ./.github/actions/setup-tools
299293
- name: Run tests
300-
# TODO(#3937): remove env override once new RPC URL is available in tests.
301-
env:
302-
SNCAST_IGNORE_RPC_0_9_CHECK: "1"
303294
run: cargo test --profile ci -p sncast
304295

305296
test-conversions:

.github/workflows/scheduled.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ jobs:
9494
curl -L https://raw.githubusercontent.com/software-mansion/cairo-coverage/main/scripts/install.sh | sh
9595
9696
- run: cargo test --profile ci -p forge --features skip_test_for_only_latest_scarb,skip_test_for_scarb_since_2_11 e2e
97-
# TODO(#3937): remove env override once new RPC URL is available in tests.
98-
env:
99-
SNCAST_IGNORE_RPC_0_9_CHECK: "1"
10097

10198
test-cast:
10299
if: github.event.repository.fork == false
@@ -127,9 +124,6 @@ jobs:
127124
starknet-devnet ${{ steps.get-devnet-version.outputs.version }}
128125
129126
- run: cargo test --profile ci -p sncast
130-
# TODO(#3937): remove env override once new RPC URL is available in tests.
131-
env:
132-
SNCAST_IGNORE_RPC_0_9_CHECK: "1"
133127

134128
get-version:
135129
name: Get current foundry version

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
scarb 2.12.1 2.11.4
2-
starknet-devnet 0.6.0
2+
starknet-devnet 0.7.0

CHANGELOG.md

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

1010
### Forge
1111

12+
#### Added
13+
14+
- `get_current_vm_step` function to get the current step during test execution. For more see [docs](https://foundry-rs.github.io/starknet-foundry/snforge-library/testing/get_current_vm_step.html)
15+
1216
#### Fixed
1317

1418
- Cheatcodes are now reflected in called contract, when directly using a library call from test code
@@ -25,10 +29,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2529

2630
- `sncast script init` now longer adds `cairo_test` as dependency in `Scarb.toml`
2731
- Replaced the free RPC provider to Zan
32+
- The supported RPC version is now 0.10.0
2833

2934
#### Fixed
3035

3136
- Restored missing `command` missing from some responses when using `--json` output format.
37+
- When deploying account with `--keystore` flag `sncast` now longer ask two times for password
3238

3339
## [0.53.0] - 2025-11-24
3440

Cargo.lock

Lines changed: 28 additions & 18 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
@@ -72,8 +72,8 @@ rayon = "1.10"
7272
regex = "1.11.3"
7373
serde = { version = "1.0.219", features = ["derive"] }
7474
serde_json = "1.0.145"
75-
starknet-rust = { git = "https://github.com/software-mansion-labs/starknet-rs", rev = "0fa6ea1c5ce76e352b6718a0f45adb5f27bc121e" }
76-
starknet-rust-crypto = { git = "https://github.com/software-mansion-labs/starknet-rs", rev = "0fa6ea1c5ce76e352b6718a0f45adb5f27bc121e" }
75+
starknet-rust = "0.18.0"
76+
starknet-rust-crypto = "0.9.0"
7777
tempfile = "3.23.0"
7878
thiserror = "2.0.17"
7979
ctor = "0.6.2"

crates/cheatnet/src/runtime_extensions/forge_config_extension.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use cairo_vm::vm::vm_core::VirtualMachine;
12
use config::RawForgeConfig;
23
use conversions::serde::deserialize::BufferReader;
34
use runtime::{CheatcodeHandlingResult, EnhancedHintError, ExtensionLogic, StarknetRuntime};
@@ -17,6 +18,7 @@ impl<'a> ExtensionLogic for ForgeConfigExtension<'a> {
1718
selector: &str,
1819
mut input_reader: BufferReader<'_>,
1920
_extended_runtime: &mut Self::Runtime,
21+
_vm: &VirtualMachine,
2022
) -> Result<CheatcodeHandlingResult, EnhancedHintError> {
2123
macro_rules! config_cheatcode {
2224
( $prop:ident) => {{

crates/cheatnet/src/runtime_extensions/forge_runtime_extension/mod.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use crate::runtime_extensions::{
1919
};
2020
use crate::trace_data::{CallTrace, CallTraceNode, GasReportData};
2121
use anyhow::{Context, Result, anyhow};
22+
use blockifier::blockifier_versioned_constants::VersionedConstants;
2223
use blockifier::bouncer::vm_resources_to_gas;
2324
use blockifier::context::TransactionContext;
2425
use blockifier::execution::call_info::{
@@ -80,6 +81,7 @@ impl<'a> ExtensionLogic for ForgeExtension<'a> {
8081
selector: &str,
8182
mut input_reader: BufferReader<'_>,
8283
extended_runtime: &mut Self::Runtime,
84+
vm: &VirtualMachine,
8385
) -> Result<CheatcodeHandlingResult, EnhancedHintError> {
8486
if let Some(oracle_selector) = self
8587
.oracle_hint_service
@@ -549,6 +551,33 @@ impl<'a> ExtensionLogic for ForgeExtension<'a> {
549551
.cheat_block_hash(block_number, operation);
550552
Ok(CheatcodeHandlingResult::from_serializable(()))
551553
}
554+
"get_current_vm_step" => {
555+
// Each contract call is executed in separate VM, hence all VM steps
556+
// are calculated as sum of steps from calls + current VM steps.
557+
// Since syscalls are added to VM resources after the execution, we need
558+
// to include them manually here.
559+
let top_call = extended_runtime
560+
.extended_runtime
561+
.extension
562+
.cheatnet_state
563+
.trace_data
564+
.current_call_stack
565+
.top();
566+
let vm_steps_from_inner_calls = calculate_vm_steps_from_calls(&top_call);
567+
let top_call_syscalls = &extended_runtime
568+
.extended_runtime
569+
.extended_runtime
570+
.hint_handler
571+
.base
572+
.syscalls_usage;
573+
let vm_steps_from_syscalls = &VersionedConstants::latest_constants()
574+
.get_additional_os_syscall_resources(top_call_syscalls)
575+
.n_steps;
576+
let total_vm_steps =
577+
vm_steps_from_inner_calls + vm_steps_from_syscalls + vm.get_current_step();
578+
579+
Ok(CheatcodeHandlingResult::from_serializable(total_vm_steps))
580+
}
552581
_ => Ok(CheatcodeHandlingResult::Forwarded),
553582
}
554583
}
@@ -856,3 +885,16 @@ pub fn get_all_used_resources(
856885
l1_handler_payload_lengths,
857886
}
858887
}
888+
889+
fn calculate_vm_steps_from_calls(top_call: &Rc<RefCell<CallTrace>>) -> usize {
890+
top_call
891+
.borrow()
892+
.nested_calls
893+
.iter()
894+
.fold(0, |acc, node| match node {
895+
CallTraceNode::EntryPointCall(call_trace) => {
896+
acc + call_trace.borrow().used_execution_resources.n_steps
897+
}
898+
CallTraceNode::DeployWithoutConstructor => acc,
899+
})
900+
}

crates/data-transformer/tests/integration/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ const NO_CONSTRUCTOR_CLASS_HASH: Felt =
2121
static CLASS: OnceCell<ContractClass> = OnceCell::const_new();
2222

2323
async fn init_class(class_hash: Felt) -> ContractClass {
24-
// TODO: (#3937) New RPC URL is not available yet
2524
let client = JsonRpcClient::new(HttpTransport::new(
26-
Url::parse("http://188.34.188.184:7070/rpc/v0_9").unwrap(),
25+
Url::parse("http://188.34.188.184:7070/rpc/v0_10").unwrap(),
2726
));
2827

2928
client

crates/forge/tests/data/contracts/hello_starknet.cairo

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
trait IHelloStarknet<TContractState> {
33
fn increase_balance(ref self: TContractState, amount: felt252);
44
fn get_balance(self: @TContractState) -> felt252;
5+
fn call_other_contract(
6+
self: @TContractState,
7+
other_contract_address: felt252,
8+
selector: felt252,
9+
calldata: Option<Array<felt252>>,
10+
) -> Span<felt252>;
511
fn do_a_panic(self: @TContractState);
612
fn do_a_panic_with(self: @TContractState, panic_data: Array<felt252>);
713
fn do_a_panic_with_bytearray(self: @TContractState);
@@ -10,6 +16,7 @@ trait IHelloStarknet<TContractState> {
1016
#[starknet::contract]
1117
mod HelloStarknet {
1218
use array::ArrayTrait;
19+
use starknet::{SyscallResultTrait, syscalls};
1320

1421
#[storage]
1522
struct Storage {
@@ -28,6 +35,23 @@ mod HelloStarknet {
2835
self.balance.read()
2936
}
3037

38+
fn call_other_contract(
39+
self: @ContractState,
40+
other_contract_address: felt252,
41+
selector: felt252,
42+
calldata: Option<Array<felt252>>,
43+
) -> Span<felt252> {
44+
syscalls::call_contract_syscall(
45+
other_contract_address.try_into().unwrap(),
46+
selector,
47+
match calldata {
48+
Some(data) => data.span(),
49+
None => array![].span(),
50+
},
51+
)
52+
.unwrap_syscall()
53+
}
54+
3155
// Panics
3256
fn do_a_panic(self: @ContractState) {
3357
let mut arr = ArrayTrait::new();
@@ -43,7 +67,10 @@ mod HelloStarknet {
4367

4468
// Panics with a bytearray
4569
fn do_a_panic_with_bytearray(self: @ContractState) {
46-
assert!(false, "This is a very long\n and multiline message that is certain to fill the buffer");
70+
assert!(
71+
false,
72+
"This is a very long\n and multiline message that is certain to fill the buffer",
73+
);
4774
}
4875
}
4976
}

0 commit comments

Comments
 (0)