Skip to content

Commit d0c7322

Browse files
authored
Update predeployed contracts to OpenZeppelin v0.20.0 (#695)
1 parent 774c0c6 commit d0c7322

File tree

8 files changed

+20
-21
lines changed

8 files changed

+20
-21
lines changed

crates/starknet-devnet-core/contracts/accounts_artifacts/OpenZeppelin/0.20.0/Account.cairo/Account.sierra

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

crates/starknet-devnet-core/contracts/accounts_artifacts/OpenZeppelin/0.8.1/Account.cairo/Account.sierra

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

crates/starknet-devnet-core/contracts/system_artifacts/ERC20_Mintable_OZ_0.20.0.sierra

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

crates/starknet-devnet-core/contracts/system_artifacts/ERC20_Mintable_OZ_0.8.1.sierra

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

crates/starknet-devnet-core/src/constants.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,30 @@ pub const CAIRO_0_ACCOUNT_CONTRACT_HASH: &str =
1616
/// only used in tests; if artifact needed in production, use CAIRO_1_ACCOUNT_CONTRACT_SIERRA
1717
pub const CAIRO_1_ACCOUNT_CONTRACT_SIERRA_PATH: &str = concat!(
1818
env!("CARGO_MANIFEST_DIR"),
19-
"/contracts/accounts_artifacts/OpenZeppelin/0.8.1/Account.cairo/Account.sierra"
19+
"/contracts/accounts_artifacts/OpenZeppelin/0.20.0/Account.cairo/Account.sierra"
2020
);
2121

2222
pub const CAIRO_1_ACCOUNT_CONTRACT_SIERRA: &str = include_str!(concat!(
2323
env!("CARGO_MANIFEST_DIR"),
24-
"/contracts/accounts_artifacts/OpenZeppelin/0.8.1/Account.cairo/Account.sierra"
24+
"/contracts/accounts_artifacts/OpenZeppelin/0.20.0/Account.cairo/Account.sierra"
2525
));
2626

2727
pub const CAIRO_1_ACCOUNT_CONTRACT_SIERRA_HASH: &str =
28-
"0x061dac032f228abef9c6626f995015233097ae253a7f72d68552db02f2971b8f";
28+
"0x044cab2e6a3a7bc516425d06d76c6ffd56ae308864dbc66f8e75028e3784aa29";
2929

3030
pub const CAIRO_1_ERC20_CONTRACT: &str = include_str!(concat!(
3131
env!("CARGO_MANIFEST_DIR"),
32-
"/contracts/system_artifacts/ERC20_Mintable_OZ_0.8.1.sierra"
32+
"/contracts/system_artifacts/ERC20_Mintable_OZ_0.20.0.sierra"
3333
));
3434

35-
/// ERC20 class hash is hardcoded to be the same as OZ class hash ERC20.cairo although it should be
36-
/// different, due to commented key attributes in struct Approval (owner and spender), and add of
37-
/// mintable feature: https://docs.openzeppelin.com/contracts-cairo/0.8.1/presets
35+
/// Unlike in previous Devnet versions, now using the actual hash of the predeployed artifact
3836
pub const CAIRO_1_ERC20_CONTRACT_CLASS_HASH: Felt =
39-
Felt::from_hex_unchecked("0x046ded64ae2dead6448e247234bab192a9c483644395b66f2155f2614e5804b0");
37+
Felt::from_hex_unchecked("0x011374319a6e07b4f2738fa3bfa8cf2181bfb0dbb4d800215baa87b83a57877e");
4038

4139
/// only used in tests; if artifact needed in production, add a new constant that uses include_str!
4240
pub const CAIRO_0_ERC20_CONTRACT_PATH: &str =
4341
concat!(env!("CARGO_MANIFEST_DIR"), "/contracts/system_artifacts/ERC20_Mintable_OZ_0.2.0.json");
4442

45-
pub const CAIRO_0_ERC20_CONTRACT_CLASS_HASH: &str =
46-
"0x6A22BF63C7BC07EFFA39A25DFBD21523D211DB0100A0AFD054D172B81840EAF";
47-
4843
pub const ETH_ERC20_CONTRACT_ADDRESS: Felt =
4944
Felt::from_hex_unchecked("0x49D36570D4E46F48E99674BD3FCC84644DDD6B96F7C741B1562B82F9E004DC7");
5045

tests/integration/common/constants.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ pub const PREDEPLOYED_ACCOUNT_INITIAL_BALANCE: u128 = 1_000_000_000_000_000_000_
2424

2525
// account classes
2626
pub const CAIRO_1_ACCOUNT_CONTRACT_SIERRA_HASH: &str =
27-
"0x061dac032f228abef9c6626f995015233097ae253a7f72d68552db02f2971b8f";
27+
"0x044cab2e6a3a7bc516425d06d76c6ffd56ae308864dbc66f8e75028e3784aa29";
2828
pub const CAIRO_0_ACCOUNT_CONTRACT_HASH: &str =
2929
"0x4d07e40e93398ed3c76981e72dd1fd22557a78ce36c0515f679e27f0bb5bc5f";
3030
pub const CAIRO_1_ACCOUNT_CONTRACT_SIERRA_PATH: &str = concat!(
3131
env!("CARGO_MANIFEST_DIR"),
32-
"/../../crates/starknet-devnet-core/contracts/accounts_artifacts/OpenZeppelin/0.8.1/Account.\
32+
"/../../crates/starknet-devnet-core/contracts/accounts_artifacts/OpenZeppelin/0.20.0/Account.\
3333
cairo/Account.sierra"
3434
);
3535
pub const CAIRO_1_ACCOUNT_CONTRACT_0_8_0_SIERRA_PATH: &str = concat!(
@@ -40,7 +40,7 @@ pub const CAIRO_1_ACCOUNT_CONTRACT_0_8_0_SIERRA_PATH: &str = concat!(
4040

4141
// system contracts
4242
pub const CAIRO_1_ERC20_CONTRACT_CLASS_HASH: Felt =
43-
Felt::from_hex_unchecked("0x046ded64ae2dead6448e247234bab192a9c483644395b66f2155f2614e5804b0");
43+
Felt::from_hex_unchecked("0x011374319a6e07b4f2738fa3bfa8cf2181bfb0dbb4d800215baa87b83a57877e");
4444
pub const ETH_ERC20_CONTRACT_ADDRESS: Felt =
4545
Felt::from_hex_unchecked("0x49D36570D4E46F48E99674BD3FCC84644DDD6B96F7C741B1562B82F9E004DC7");
4646
pub const STRK_ERC20_CONTRACT_ADDRESS: Felt =

tests/integration/test_blocks_generation.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,9 +485,13 @@ async fn blocks_on_interval() {
485485

486486
#[tokio::test]
487487
async fn blocks_on_interval_transactions() {
488-
let devnet = BackgroundDevnet::spawn_with_additional_args(&["--block-generation-on", "2"])
489-
.await
490-
.expect("Could not start Devnet");
488+
let period = 6;
489+
let devnet = BackgroundDevnet::spawn_with_additional_args(&[
490+
"--block-generation-on",
491+
&period.to_string(),
492+
])
493+
.await
494+
.expect("Could not start Devnet");
491495

492496
let tx_count = 3;
493497
let mut tx_hashes = Vec::new();
@@ -497,7 +501,7 @@ async fn blocks_on_interval_transactions() {
497501
}
498502

499503
// wait for one and a half interval
500-
tokio::time::sleep(time::Duration::from_secs(3)).await;
504+
tokio::time::sleep(time::Duration::from_secs(period * 3 / 2)).await;
501505

502506
// first is genesis block, second block is generated after transactions
503507
assert_latest_block_with_tx_hashes(&devnet, 1, tx_hashes).await;

website/docs/api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ To interact with Devnet using the [Starknet API](#starknet-api), use [starknet.j
3434

3535
## Config API
3636

37-
To retrieve the current configuration of Devnet, as specified via [CLI](running/cli.md) and later requests, send a `GET` request to `/config` or `JSON-RPC` request with method name `devnet_getConfig`. Example response is attached below. It can be interpreted as a JSON mapping of CLI input parameters, both specified and default ones, with some irrelevant parameters omitted. So use `starknet-devnet --help` to better understand the meaning of each value, though keep in mind that some of the parameters have slightly modified names.
37+
To retrieve the current configuration of Devnet, as specified via [CLI](running/cli.md) and later requests, send a `GET` request to `/config` or `JSON-RPC` request with method name `devnet_getConfig`. Example response is attached below. It can be interpreted as a JSON mapping of CLI input parameters, both specified and default ones, with some irrelevant parameters omitted. So use `starknet-devnet --help` to better understand the meaning of each value, though keep in mind that some of the parameters have slightly modified names. The exact values may have changed and should not be referenced.
3838

3939
```json
4040
{

0 commit comments

Comments
 (0)