Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "vendor/cairo"]
path = vendor/cairo
url = https://github.com/starkware-libs/cairo.git
branch = v2.19.0-rc.3
branch = ron/deploy-v2/corelib-rc1
90 changes: 30 additions & 60 deletions Cargo.lock

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

27 changes: 27 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -252,3 +252,30 @@ required-features = [ "testing" ]
[[example]]
name = "easy_api"
required-features = [ "testing" ]

# --- TEMPORARY dev override (deploy_v2) ---
# The `deploy_v2` syscall needs the `DeployV2` Sierra libfunc variant, which is not yet in a
# published cairo-lang-* release. Until one is, build against `ron/deploy-v2/compiler-rc3`: the
# compiler PR (https://github.com/starkware-libs/cairo/pull/10214) applied to this repo's pinned
# 2.19.0-rc.3, so the override adds the libfunc and nothing else. `vendor/cairo` is pinned the same
# way, to `ron/deploy-v2/corelib-rc1` (the submodule's own commit plus `deploy_v2_syscall`). Drop
# both once a release carries the variant.
[patch.crates-io]
cairo-lang-casm = { git = "https://github.com/starkware-libs/cairo", branch = "ron/deploy-v2/compiler-rc3" }
cairo-lang-compiler = { git = "https://github.com/starkware-libs/cairo", branch = "ron/deploy-v2/compiler-rc3" }
cairo-lang-defs = { git = "https://github.com/starkware-libs/cairo", branch = "ron/deploy-v2/compiler-rc3" }
cairo-lang-filesystem = { git = "https://github.com/starkware-libs/cairo", branch = "ron/deploy-v2/compiler-rc3" }
cairo-lang-lowering = { git = "https://github.com/starkware-libs/cairo", branch = "ron/deploy-v2/compiler-rc3" }
cairo-lang-runner = { git = "https://github.com/starkware-libs/cairo", branch = "ron/deploy-v2/compiler-rc3" }
cairo-lang-semantic = { git = "https://github.com/starkware-libs/cairo", branch = "ron/deploy-v2/compiler-rc3" }
cairo-lang-sierra = { git = "https://github.com/starkware-libs/cairo", branch = "ron/deploy-v2/compiler-rc3" }
cairo-lang-sierra-ap-change = { git = "https://github.com/starkware-libs/cairo", branch = "ron/deploy-v2/compiler-rc3" }
cairo-lang-sierra-gas = { git = "https://github.com/starkware-libs/cairo", branch = "ron/deploy-v2/compiler-rc3" }
cairo-lang-sierra-generator = { git = "https://github.com/starkware-libs/cairo", branch = "ron/deploy-v2/compiler-rc3" }
cairo-lang-sierra-to-casm = { git = "https://github.com/starkware-libs/cairo", branch = "ron/deploy-v2/compiler-rc3" }
cairo-lang-sierra-type-size = { git = "https://github.com/starkware-libs/cairo", branch = "ron/deploy-v2/compiler-rc3" }
cairo-lang-starknet = { git = "https://github.com/starkware-libs/cairo", branch = "ron/deploy-v2/compiler-rc3" }
cairo-lang-starknet-classes = { git = "https://github.com/starkware-libs/cairo", branch = "ron/deploy-v2/compiler-rc3" }
cairo-lang-test-plugin = { git = "https://github.com/starkware-libs/cairo", branch = "ron/deploy-v2/compiler-rc3" }
cairo-lang-test-runner = { git = "https://github.com/starkware-libs/cairo", branch = "ron/deploy-v2/compiler-rc3" }
cairo-lang-utils = { git = "https://github.com/starkware-libs/cairo", branch = "ron/deploy-v2/compiler-rc3" }
11 changes: 11 additions & 0 deletions cairo-starknet-syscalls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,17 @@ pub trait StarknetSyscallHandler {
remaining_gas: &mut u64,
) -> SyscallResult<(Felt, Vec<Felt>)>;

/// Deploys a contract, deriving its address with the Blake-escaped derivation instead of
/// Pedersen (the `deploy_v2` syscall). Same request/response as [`Self::deploy`].
fn deploy_v2(
&mut self,
class_hash: Felt,
contract_address_salt: Felt,
calldata: &[Felt],
deploy_from_zero: bool,
remaining_gas: &mut u64,
) -> SyscallResult<(Felt, Vec<Felt>)>;

fn replace_class(&mut self, class_hash: Felt, remaining_gas: &mut u64) -> SyscallResult<()>;

fn library_call(
Expand Down
6 changes: 5 additions & 1 deletion debug_utils/sierra-emu/programs/syscalls.cairo
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use starknet::ClassHash;
use starknet::{
call_contract_syscall, ContractAddress,
deploy_syscall, emit_event_syscall, ExecutionInfo, get_block_hash_syscall,
deploy_syscall, deploy_v2_syscall, emit_event_syscall, ExecutionInfo, get_block_hash_syscall,
keccak_syscall,
library_call_syscall, replace_class_syscall, send_message_to_l1_syscall,
storage_address_try_from_felt252, storage_read_syscall, storage_write_syscall, SyscallResult,
Expand Down Expand Up @@ -29,6 +29,10 @@ fn deploy() -> SyscallResult<(ContractAddress, Span<felt252>)> {
deploy_syscall(ZERO_CLASS_HASH, 0, array![].span(), false)
}

fn deploy_v2() -> SyscallResult<(ContractAddress, Span<felt252>)> {
deploy_v2_syscall(ZERO_CLASS_HASH, 0, array![].span(), false)
}

fn replace_class() -> SyscallResult<()> {
replace_class_syscall(ZERO_CLASS_HASH)
}
Expand Down
1 change: 1 addition & 0 deletions debug_utils/sierra-emu/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ pub fn libfunc_to_name(value: &CoreConcreteLibfunc) -> &'static str {
StarknetConcreteLibfunc::GetExecutionInfo(_) => "get_exec_info_v1",
StarknetConcreteLibfunc::GetExecutionInfoV2(_) => "get_exec_info_v2",
StarknetConcreteLibfunc::Deploy(_) => "deploy",
StarknetConcreteLibfunc::DeployV2(_) => "deploy_v2",
StarknetConcreteLibfunc::Keccak(_) => "keccak",
StarknetConcreteLibfunc::LibraryCall(_) => "library_call",
StarknetConcreteLibfunc::ReplaceClass(_) => "replace_class",
Expand Down
Loading
Loading