starknet-devnet-rs icon indicating copy to clipboard operation
starknet-devnet-rs copied to clipboard

Replaced_classes of state diff is unpopulated

Open FabijanC opened this issue 1 year ago • 3 comments

Proof of emptiness: https://github.com/0xSpaceShard/starknet-devnet-rs/blob/eadc64a674d38dd172a4a41cf81af464ae7f31f9/crates/starknet-server/src/api/json_rpc/endpoints.rs#L98

This is how it was implemented in devnet-py: https://github.com/0xSpaceShard/starknet-devnet/blob/e477aa1bbe2348ba92af2a69c32d2eef2579d863/starknet_devnet/util.py#L182

This is how it was tested in devnet-py: https://github.com/0xSpaceShard/starknet-devnet/blob/7ea5a3f9a400d59979380c278adda479b6632812/test/test_replace_class.py#L24

This is what the RPC spec says: https://github.com/starkware-libs/starknet-specs/blob/v0.6.0/api/starknet_api_openrpc.json#L1179

FabijanC avatar Nov 16 '23 15:11 FabijanC

What steps are required to change the class hash of a contract

marioiordanov avatar Aug 16 '24 07:08 marioiordanov

@marioiordanov The only way I know of is by calling the class replacement syscall (hopefully it still exists). Check out this example: https://github.com/0xSpaceShard/starknet-hardhat-example/blob/master/scripts/replace.ts. Find the contract sources of replaceable.cairo and replaced.cairo here (they are in Cairo0, so would require rewriting): https://github.com/0xSpaceShard/starknet-hardhat-example/tree/master/contracts

FabijanC avatar Aug 16 '24 07:08 FabijanC

Also in Devnet-py we had a similar test case: https://github.com/0xSpaceShard/starknet-devnet/blob/master/test/test_replace_class.py

FabijanC avatar Aug 16 '24 07:08 FabijanC