From 9df857ad8097c165e47700382cd8aac534dac293 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Tue, 27 Aug 2024 07:33:36 -0400 Subject: [PATCH 01/28] initial commit for bumping cairo --- .tool-versions | 2 +- contracts/Scarb.lock | 84 ++++++++++++++++++- contracts/Scarb.toml | 6 +- .../src/emergency/sequencer_uptime_feed.cairo | 3 +- contracts/src/libraries/access_control.cairo | 3 +- contracts/src/multisig.cairo | 11 +-- contracts/src/ocr2/aggregator.cairo | 17 ++-- contracts/src/ocr2/aggregator_proxy.cairo | 3 +- .../src/ocr2/mocks/mock_aggregator.cairo | 3 +- contracts/src/token/link_token.cairo | 20 ++++- 10 files changed, 127 insertions(+), 25 deletions(-) diff --git a/.tool-versions b/.tool-versions index b00c44d37..9879cd1bc 100644 --- a/.tool-versions +++ b/.tool-versions @@ -9,7 +9,7 @@ mockery 2.22.1 golangci-lint 1.55.0 actionlint 1.6.12 shellcheck 0.8.0 -scarb 2.6.5 +scarb 2.7.1 postgres 15.1 # Kubernetes diff --git a/contracts/Scarb.lock b/contracts/Scarb.lock index 88a112553..192642c62 100644 --- a/contracts/Scarb.lock +++ b/contracts/Scarb.lock @@ -10,5 +10,85 @@ dependencies = [ [[package]] name = "openzeppelin" -version = "0.10.0" -source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.10.0#d77082732daab2690ba50742ea41080eb23299d3" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" +dependencies = [ + "openzeppelin_access", + "openzeppelin_account", + "openzeppelin_governance", + "openzeppelin_introspection", + "openzeppelin_presets", + "openzeppelin_security", + "openzeppelin_token", + "openzeppelin_upgrades", + "openzeppelin_utils", +] + +[[package]] +name = "openzeppelin_access" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" +dependencies = [ + "openzeppelin_introspection", + "openzeppelin_utils", +] + +[[package]] +name = "openzeppelin_account" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" +dependencies = [ + "openzeppelin_introspection", + "openzeppelin_utils", +] + +[[package]] +name = "openzeppelin_governance" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" +dependencies = [ + "openzeppelin_access", + "openzeppelin_introspection", +] + +[[package]] +name = "openzeppelin_introspection" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" + +[[package]] +name = "openzeppelin_presets" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" +dependencies = [ + "openzeppelin_access", + "openzeppelin_account", + "openzeppelin_introspection", + "openzeppelin_token", + "openzeppelin_upgrades", +] + +[[package]] +name = "openzeppelin_security" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" + +[[package]] +name = "openzeppelin_token" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" +dependencies = [ + "openzeppelin_account", + "openzeppelin_governance", + "openzeppelin_introspection", +] + +[[package]] +name = "openzeppelin_upgrades" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" + +[[package]] +name = "openzeppelin_utils" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" diff --git a/contracts/Scarb.toml b/contracts/Scarb.toml index 69c519dfd..2923f9551 100644 --- a/contracts/Scarb.toml +++ b/contracts/Scarb.toml @@ -1,7 +1,7 @@ [package] name = "chainlink" version = "0.1.0" -cairo-version = "2.6.3" +cairo-version = "2.7.1" description = "Chainlink contracts for Starknet" homepage = "https://github.com/smartcontractkit/chainlink-starknet" @@ -12,8 +12,8 @@ sierra = "cairo-compile . -r" # Uncomment if you want to use dependencies # Note: currently testing doesn't work with dependencies [dependencies] -starknet = ">=2.6.3" -openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.10.0" } +starknet = ">=2.7.1" +openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.15.1" } [lib] diff --git a/contracts/src/emergency/sequencer_uptime_feed.cairo b/contracts/src/emergency/sequencer_uptime_feed.cairo index fad5ad8f7..68e2a5761 100644 --- a/contracts/src/emergency/sequencer_uptime_feed.cairo +++ b/contracts/src/emergency/sequencer_uptime_feed.cairo @@ -20,6 +20,7 @@ mod SequencerUptimeFeed { use starknet::storage_write_syscall; use starknet::storage_address_from_base_and_offset; use starknet::class_hash::ClassHash; + use starknet::storage::Map; use box::BoxTrait; use traits::Into; @@ -58,7 +59,7 @@ mod SequencerUptimeFeed { // l1 sender is an starknet validator ethereum address _l1_sender: EthAddress, // maps round id to round transmission - _round_transmissions: LegacyMap, + _round_transmissions: Map, _latest_round_id: u128, } diff --git a/contracts/src/libraries/access_control.cairo b/contracts/src/libraries/access_control.cairo index b0a910d55..e971e4067 100644 --- a/contracts/src/libraries/access_control.cairo +++ b/contracts/src/libraries/access_control.cairo @@ -14,6 +14,7 @@ trait IAccessController { mod AccessControlComponent { use starknet::ContractAddress; use starknet::class_hash::ClassHash; + use starknet::storage::Map; use zeroable::Zeroable; use openzeppelin::access::ownable::OwnableComponent; @@ -23,7 +24,7 @@ mod AccessControlComponent { #[storage] struct Storage { _check_enabled: bool, - _access_list: LegacyMap, + _access_list: Map, } #[event] diff --git a/contracts/src/multisig.cairo b/contracts/src/multisig.cairo index b1422df45..553ea3f46 100644 --- a/contracts/src/multisig.cairo +++ b/contracts/src/multisig.cairo @@ -90,6 +90,7 @@ mod Multisig { use starknet::storage_read_syscall; use starknet::storage_write_syscall; use starknet::class_hash::ClassHash; + use starknet::storage::Map; use chainlink::libraries::type_and_version::ITypeAndVersion; use chainlink::libraries::upgradeable::{Upgradeable, IUpgradeable}; @@ -154,14 +155,14 @@ mod Multisig { #[storage] struct Storage { _threshold: usize, - _signers: LegacyMap, - _is_signer: LegacyMap, + _signers: Map, + _is_signer: Map, _signers_len: usize, _tx_valid_since: u128, _next_nonce: u128, - _transactions: LegacyMap, - _transaction_calldata: LegacyMap<(u128, usize), felt252>, - _is_confirmed: LegacyMap<(u128, ContractAddress), bool>, + _transactions: Map, + _transaction_calldata: Map<(u128, usize), felt252>, + _is_confirmed: Map<(u128, ContractAddress), bool>, } #[constructor] diff --git a/contracts/src/ocr2/aggregator.cairo b/contracts/src/ocr2/aggregator.cairo index d494c81e8..2ff501888 100644 --- a/contracts/src/ocr2/aggregator.cairo +++ b/contracts/src/ocr2/aggregator.cairo @@ -196,6 +196,7 @@ mod Aggregator { use starknet::storage_write_syscall; use starknet::storage_address_from_base_and_offset; use starknet::class_hash::ClassHash; + use starknet::storage::Map; use openzeppelin::access::ownable::OwnableComponent; use openzeppelin::token::erc20::interface::{IERC20, IERC20Dispatcher, IERC20DispatcherTrait}; @@ -306,20 +307,20 @@ mod Aggregator { _latest_config_digest: felt252, // _oracles: Array, // NOTE: array can't be used in storage _oracles_len: usize, - _transmitters: LegacyMap, // - _signers: LegacyMap, // - _signers_list: LegacyMap, - _transmitters_list: LegacyMap, - _reward_from_aggregator_round_id: LegacyMap, // - _transmissions: LegacyMap, + _transmitters: Map, // + _signers: Map, // + _signers_list: Map, + _transmitters_list: Map, + _reward_from_aggregator_round_id: Map, // + _transmissions: Map, // link token _link_token: ContractAddress, // billing _billing_access_controller: ContractAddress, _billing: BillingConfig, // payee management - _payees: LegacyMap, // - _proposed_payees: LegacyMap< + _payees: Map, // + _proposed_payees: Map< ContractAddress, ContractAddress > // } diff --git a/contracts/src/ocr2/aggregator_proxy.cairo b/contracts/src/ocr2/aggregator_proxy.cairo index 9859c9ccd..3b781aae0 100644 --- a/contracts/src/ocr2/aggregator_proxy.cairo +++ b/contracts/src/ocr2/aggregator_proxy.cairo @@ -46,6 +46,7 @@ mod AggregatorProxy { use starknet::storage_write_syscall; use starknet::storage_address_from_base_and_offset; use starknet::class_hash::ClassHash; + use starknet::storage::Map; use openzeppelin::access::ownable::OwnableComponent; @@ -88,7 +89,7 @@ mod AggregatorProxy { access_control: AccessControlComponent::Storage, _current_phase: Phase, _proposed_aggregator: ContractAddress, - _phases: LegacyMap + _phases: Map } #[event] diff --git a/contracts/src/ocr2/mocks/mock_aggregator.cairo b/contracts/src/ocr2/mocks/mock_aggregator.cairo index eceb7d3c8..310fbc206 100644 --- a/contracts/src/ocr2/mocks/mock_aggregator.cairo +++ b/contracts/src/ocr2/mocks/mock_aggregator.cairo @@ -13,6 +13,7 @@ trait IMockAggregator { mod MockAggregator { use array::ArrayTrait; use starknet::contract_address_const; + use starknet::storage::Map; use traits::Into; use chainlink::ocr2::aggregator::IAggregator; @@ -25,7 +26,7 @@ mod MockAggregator { #[storage] struct Storage { - _transmissions: LegacyMap, + _transmissions: Map, _latest_aggregator_round_id: u128, _decimals: u8 } diff --git a/contracts/src/token/link_token.cairo b/contracts/src/token/link_token.cairo index 24bdb2271..c945c02e9 100644 --- a/contracts/src/token/link_token.cairo +++ b/contracts/src/token/link_token.cairo @@ -69,15 +69,31 @@ mod LinkToken { impl MintableToken of IMintableToken { fn permissioned_mint(ref self: ContractState, account: ContractAddress, amount: u256) { only_minter(@self); - self.erc20._mint(account, amount); + self.erc20.mint(account, amount); } fn permissioned_burn(ref self: ContractState, account: ContractAddress, amount: u256) { only_minter(@self); - self.erc20._burn(account, amount); + self.erc20.burn(account, amount); } } + impl HooksImpl of ERC20Component::ERC20HooksTrait { + fn before_update( + ref self: ERC20Component::ComponentState::, + from: ContractAddress, + recipient: ContractAddress, + amount: u256 + ) {} + + fn after_update( + ref self: ERC20Component::ComponentState::, + from: ContractAddress, + recipient: ContractAddress, + amount: u256 + ) {} + } + #[constructor] fn constructor(ref self: ContractState, minter: ContractAddress, owner: ContractAddress) { From 65c9afd6f9ac71123f9c2620b01ecc3f240c8361 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Tue, 27 Aug 2024 08:11:04 -0400 Subject: [PATCH 02/28] update build process --- .github/actions/install-cairo/action.yml | 4 +- .../contracts/aggregator_consumer/Scarb.lock | 84 ++++++++++++++++++- .../contracts/aggregator_consumer/Scarb.toml | 4 +- .../aggregator_consumer/scripts/Scarb.toml | 7 +- integration-tests/testconfig/default.toml | 26 +++--- ops/charts/devnet/templates/deployment.yaml | 2 +- ops/devnet/environment.go | 2 +- ops/scripts/devnet-hardhat.sh | 4 +- scripts/devnet.sh | 4 +- 9 files changed, 111 insertions(+), 26 deletions(-) diff --git a/.github/actions/install-cairo/action.yml b/.github/actions/install-cairo/action.yml index d3f1524d6..098f1bdc2 100644 --- a/.github/actions/install-cairo/action.yml +++ b/.github/actions/install-cairo/action.yml @@ -4,11 +4,11 @@ description: A composite action that installs cairo and scarb binaries inputs: cairo_version: description: Cairo release version - default: "v2.6.4" + default: "v2.7.1" required: false scarb_version: description: Scarb release version - default: "v2.6.5" + default: "v2.7.1" required: false runs: diff --git a/examples/contracts/aggregator_consumer/Scarb.lock b/examples/contracts/aggregator_consumer/Scarb.lock index 586d04a23..5e31f265b 100644 --- a/examples/contracts/aggregator_consumer/Scarb.lock +++ b/examples/contracts/aggregator_consumer/Scarb.lock @@ -18,8 +18,88 @@ dependencies = [ [[package]] name = "openzeppelin" -version = "0.10.0" -source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.10.0#d77082732daab2690ba50742ea41080eb23299d3" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" +dependencies = [ + "openzeppelin_access", + "openzeppelin_account", + "openzeppelin_governance", + "openzeppelin_introspection", + "openzeppelin_presets", + "openzeppelin_security", + "openzeppelin_token", + "openzeppelin_upgrades", + "openzeppelin_utils", +] + +[[package]] +name = "openzeppelin_access" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" +dependencies = [ + "openzeppelin_introspection", + "openzeppelin_utils", +] + +[[package]] +name = "openzeppelin_account" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" +dependencies = [ + "openzeppelin_introspection", + "openzeppelin_utils", +] + +[[package]] +name = "openzeppelin_governance" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" +dependencies = [ + "openzeppelin_access", + "openzeppelin_introspection", +] + +[[package]] +name = "openzeppelin_introspection" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" + +[[package]] +name = "openzeppelin_presets" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" +dependencies = [ + "openzeppelin_access", + "openzeppelin_account", + "openzeppelin_introspection", + "openzeppelin_token", + "openzeppelin_upgrades", +] + +[[package]] +name = "openzeppelin_security" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" + +[[package]] +name = "openzeppelin_token" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" +dependencies = [ + "openzeppelin_account", + "openzeppelin_governance", + "openzeppelin_introspection", +] + +[[package]] +name = "openzeppelin_upgrades" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" + +[[package]] +name = "openzeppelin_utils" +version = "0.15.1" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" [[package]] name = "snforge_std" diff --git a/examples/contracts/aggregator_consumer/Scarb.toml b/examples/contracts/aggregator_consumer/Scarb.toml index e7868b138..13bd148e2 100644 --- a/examples/contracts/aggregator_consumer/Scarb.toml +++ b/examples/contracts/aggregator_consumer/Scarb.toml @@ -6,14 +6,14 @@ [package] name = "aggregator_consumer" version = "0.1.0" -cairo-version = "2.6.3" +cairo-version = "2.7.1" # See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html [dependencies] snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.21.0" } chainlink = { path = "../../../contracts" } -starknet = ">=2.6.3" +starknet = ">=2.7.1" [lib] diff --git a/examples/contracts/aggregator_consumer/scripts/Scarb.toml b/examples/contracts/aggregator_consumer/scripts/Scarb.toml index bf06f1d83..d29b2d515 100644 --- a/examples/contracts/aggregator_consumer/scripts/Scarb.toml +++ b/examples/contracts/aggregator_consumer/scripts/Scarb.toml @@ -1,7 +1,7 @@ [package] name = "src" version = "0.1.0" -cairo-version = "2.6.3" +cairo-version = "2.7.1" # See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html @@ -9,7 +9,7 @@ cairo-version = "2.6.3" sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.21.0" } chainlink = { path = "../../../../contracts" } aggregator_consumer = { path = "../" } -starknet = ">=2.6.3" +starknet = ">=2.7.1" [lib] casm = true @@ -19,6 +19,5 @@ casm = true build-external-contracts = [ "chainlink::emergency::sequencer_uptime_feed::SequencerUptimeFeed", "chainlink::ocr2::mocks::mock_aggregator::MockAggregator", - "aggregator_consumer::ocr2::consumer::AggregatorConsumer" + "aggregator_consumer::ocr2::consumer::AggregatorConsumer", ] - diff --git a/integration-tests/testconfig/default.toml b/integration-tests/testconfig/default.toml index 9302ca824..1734db1b8 100644 --- a/integration-tests/testconfig/default.toml +++ b/integration-tests/testconfig/default.toml @@ -1,24 +1,30 @@ # This is the default configuration so OCR2 tests can run without issues [ChainlinkImage] -image="public.ecr.aws/chainlink/chainlink" -version="2.9.0" +image = "public.ecr.aws/chainlink/chainlink" +version = "2.9.0" [Logging] -test_log_collect=false +test_log_collect = false [Logging.LogStream] -log_targets=["file"] -log_producer_timeout="10s" -log_producer_retry_limit=10 +log_targets = ["file"] +log_producer_timeout = "10s" +log_producer_retry_limit = 10 [Network] -selected_networks=["SIMULATED"] # Not needed for Starknet but mandatory from CTF (do not change) +selected_networks = [ + "SIMULATED", +] # Not needed for Starknet but mandatory from CTF (do not change) [Network.RpcHttpUrls] -simulated = ["http://127.0.0.1"] # Not needed for Starknet but mandatory from CTF (do not change) +simulated = [ + "http://127.0.0.1", +] # Not needed for Starknet but mandatory from CTF (do not change) [Network.RpcWsUrls] -simulated = ["wss://127.0.0.1"] # Not needed for Starknet but mandatory from CTF (do not change) +simulated = [ + "wss://127.0.0.1", +] # Not needed for Starknet but mandatory from CTF (do not change) [Common] internal_docker_repo = "public.ecr.aws/chainlink" @@ -26,7 +32,7 @@ inside_k8 = false network = "localnet" user = "satoshi" stateful_db = false -devnet_image = "shardlabs/starknet-devnet-rs:a147b4cd72f9ce9d1fa665d871231370db0f51c7" +devnet_image = "shardlabs/starknet-devnet-rs:438da575b2a514c44d8a70ca6169f9dd7e585b2c" postgres_version = "15.7" [OCR2] diff --git a/ops/charts/devnet/templates/deployment.yaml b/ops/charts/devnet/templates/deployment.yaml index f3c841bb6..5b372249d 100644 --- a/ops/charts/devnet/templates/deployment.yaml +++ b/ops/charts/devnet/templates/deployment.yaml @@ -29,7 +29,7 @@ spec: {{- if eq .Values.real_node true }} image: "{{ .Values.repository | default "eqlabs/pathfinder"}}:{{ .Values.tag | default "v0.1.8-alpha"}}" {{- else }} - image: "{{ .Values.repository | default "shardlabs/starknet-devnet-rs"}}:{{ .Values.tag | default "a147b4cd72f9ce9d1fa665d871231370db0f51c7"}}" + image: "{{ .Values.repository | default "shardlabs/starknet-devnet-rs"}}:{{ .Values.tag | default "438da575b2a514c44d8a70ca6169f9dd7e585b2c"}}" args: ["--port", {{ .Values.service.internalPort | quote}}, "--seed", {{ .Values.seed | quote}}, "--account-class", "cairo1", "--gas-price", "1", "--data-gas-price", "1"] {{- end }} imagePullPolicy: IfNotPresent diff --git a/ops/devnet/environment.go b/ops/devnet/environment.go index 6948a91e2..b801d7e4d 100644 --- a/ops/devnet/environment.go +++ b/ops/devnet/environment.go @@ -73,7 +73,7 @@ func defaultProps() map[string]any { "starknet-dev": map[string]any{ "image": map[string]any{ "image": "shardlabs/starknet-devnet-rs", - "version": "a147b4cd72f9ce9d1fa665d871231370db0f51c7", + "version": "438da575b2a514c44d8a70ca6169f9dd7e585b2c", }, "resources": map[string]any{ "requests": map[string]any{ diff --git a/ops/scripts/devnet-hardhat.sh b/ops/scripts/devnet-hardhat.sh index c56d67880..c9a0a677a 100755 --- a/ops/scripts/devnet-hardhat.sh +++ b/ops/scripts/devnet-hardhat.sh @@ -13,10 +13,10 @@ bash "$(dirname -- "$0")/devnet-hardhat-down.sh" echo "Checking CPU structure..." if [[ $cpu_struct == *"arm"* ]]; then echo "Starting arm devnet container..." - container_version="${CONTAINER_VERSION:-a147b4cd72f9ce9d1fa665d871231370db0f51c7}-arm" + container_version="${CONTAINER_VERSION:-438da575b2a514c44d8a70ca6169f9dd7e585b2c}-arm" else echo "Starting i386 devnet container..." - container_version="${CONTAINER_VERSION:-a147b4cd72f9ce9d1fa665d871231370db0f51c7}" + container_version="${CONTAINER_VERSION:-438da575b2a514c44d8a70ca6169f9dd7e585b2c}" fi echo "Starting starknet-devnet" diff --git a/scripts/devnet.sh b/scripts/devnet.sh index 70fb3a3a2..921484b04 100755 --- a/scripts/devnet.sh +++ b/scripts/devnet.sh @@ -13,10 +13,10 @@ echo "Checking CPU structure..." if [[ $cpu_struct == *"arm"* ]] then echo "Starting arm devnet container..." - container_version="a147b4cd72f9ce9d1fa665d871231370db0f51c7-arm" + container_version="438da575b2a514c44d8a70ca6169f9dd7e585b2c-arm" else echo "Starting i386 devnet container..." - container_version="a147b4cd72f9ce9d1fa665d871231370db0f51c7" + container_version="438da575b2a514c44d8a70ca6169f9dd7e585b2c" fi echo "Starting starknet-devnet" From 6d273b8f93e1a3aad3d7e9d355acb6d1ef5dcde8 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Thu, 29 Aug 2024 14:40:29 -0400 Subject: [PATCH 03/28] fix cairo tests --- contracts/Scarb.toml | 1 + contracts/src/tests/test_link_token.cairo | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/contracts/Scarb.toml b/contracts/Scarb.toml index 2923f9551..cf9de44e4 100644 --- a/contracts/Scarb.toml +++ b/contracts/Scarb.toml @@ -14,6 +14,7 @@ sierra = "cairo-compile . -r" [dependencies] starknet = ">=2.7.1" openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.15.1" } +cairo_test = "2.7.1" [lib] diff --git a/contracts/src/tests/test_link_token.cairo b/contracts/src/tests/test_link_token.cairo index 0c0fde3ed..a8b7ffc78 100644 --- a/contracts/src/tests/test_link_token.cairo +++ b/contracts/src/tests/test_link_token.cairo @@ -98,7 +98,7 @@ fn test_permissioned_mint_from_nonminter() { } #[test] -#[should_panic(expected: ('u256_sub Overflow',))] +#[should_panic(expected: ('ERC20: insufficient balance',))] fn test_permissioned_burn_from_minter() { let zero = 0; let sender = setup(); From b72a9837b1157e72fade24a61a1007c279789052 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Wed, 4 Sep 2024 10:15:56 -0400 Subject: [PATCH 04/28] merge develop (starknet-foundry introduction) --- .../install-starknet-foundry/action.yml | 3 +- .github/workflows/contracts.yml | 3 + .gitignore | 1 + .tool-versions | 1 + .vscode/settings.json | 2 +- contracts/Scarb.lock | 68 +++++ contracts/Scarb.toml | 9 +- contracts/src/libraries/mocks.cairo | 1 + .../mocks/mock_multisig_target.cairo | 16 + .../src/tests/test_access_controller.cairo | 18 +- contracts/src/tests/test_aggregator.cairo | 83 +++-- .../src/tests/test_aggregator_proxy.cairo | 44 +-- contracts/src/tests/test_erc677.cairo | 29 +- contracts/src/tests/test_link_token.cairo | 14 +- .../src/tests/test_mock_aggregator.cairo | 6 +- contracts/src/tests/test_multisig.cairo | 283 ++++++++++-------- contracts/src/tests/test_ownable.cairo | 8 +- .../tests/test_sequencer_uptime_feed.cairo | 26 +- contracts/src/tests/test_upgradeable.cairo | 24 +- .../contracts/aggregator_consumer/Scarb.lock | 66 +++- .../contracts/aggregator_consumer/Scarb.toml | 9 +- .../aggregator_consumer/scripts/Scarb.toml | 4 +- .../tests/test_consumer.cairo | 23 +- .../test_price_consumer_with_sequencer.cairo | 38 ++- integration-tests/go.mod | 5 +- integration-tests/go.sum | 4 +- monitoring/go.mod | 6 +- monitoring/go.sum | 6 +- ops/go.mod | 3 - relayer/go.mod | 6 +- relayer/go.sum | 6 +- 31 files changed, 548 insertions(+), 267 deletions(-) create mode 100644 contracts/src/libraries/mocks/mock_multisig_target.cairo diff --git a/.github/actions/install-starknet-foundry/action.yml b/.github/actions/install-starknet-foundry/action.yml index 02b9b59dc..8e4360edf 100644 --- a/.github/actions/install-starknet-foundry/action.yml +++ b/.github/actions/install-starknet-foundry/action.yml @@ -4,7 +4,7 @@ description: A composite action that installs the snforge and sncast binaries inputs: starknet_foundry_version: description: Starknet Foundry release version - default: "0.21.0" + default: "0.27.0" required: false runs: @@ -16,4 +16,3 @@ runs: run: | curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh snfoundryup -v ${{ inputs.starknet_foundry_version }} - diff --git a/.github/workflows/contracts.yml b/.github/workflows/contracts.yml index 58e06e4bc..d10fdfdc7 100644 --- a/.github/workflows/contracts.yml +++ b/.github/workflows/contracts.yml @@ -41,5 +41,8 @@ jobs: - name: Install Cairo uses: ./.github/actions/install-cairo + - name: Install Starknet Foundry + uses: ./.github/actions/install-starknet-foundry + - name: Test run: nix develop -c make test-cairo-contracts diff --git a/.gitignore b/.gitignore index 1ec5b7415..bf22810e3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.snfoundry_cache .direnv artifacts/ vendor/ diff --git a/.tool-versions b/.tool-versions index 9879cd1bc..2b2a6e5b6 100644 --- a/.tool-versions +++ b/.tool-versions @@ -11,6 +11,7 @@ actionlint 1.6.12 shellcheck 0.8.0 scarb 2.7.1 postgres 15.1 +starknet-foundry 0.28.0 # Kubernetes k3d 5.4.4 diff --git a/.vscode/settings.json b/.vscode/settings.json index bb4c99574..3f77e7328 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,7 +2,7 @@ "editor.formatOnSave": true, "editor.formatOnSaveTimeout": 1500, "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "files.insertFinalNewline": true } diff --git a/contracts/Scarb.lock b/contracts/Scarb.lock index 192642c62..686309dcf 100644 --- a/contracts/Scarb.lock +++ b/contracts/Scarb.lock @@ -1,11 +1,66 @@ # Code generated by scarb DO NOT EDIT. version = 1 +[[package]] +name = "alexandria_bytes" +version = "0.1.0" +source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +dependencies = [ + "alexandria_data_structures", + "alexandria_math", +] + +[[package]] +name = "alexandria_data_structures" +version = "0.2.0" +source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +dependencies = [ + "alexandria_encoding", +] + +[[package]] +name = "alexandria_encoding" +version = "0.1.0" +source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +dependencies = [ + "alexandria_bytes", + "alexandria_math", + "alexandria_numeric", +] + +[[package]] +name = "alexandria_math" +version = "0.2.0" +source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +dependencies = [ + "alexandria_data_structures", +] + +[[package]] +name = "alexandria_numeric" +version = "0.1.0" +source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +dependencies = [ + "alexandria_math", + "alexandria_searching", +] + +[[package]] +name = "alexandria_searching" +version = "0.1.0" +source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +dependencies = [ + "alexandria_data_structures", +] + [[package]] name = "chainlink" version = "0.1.0" dependencies = [ + "alexandria_bytes", + "alexandria_encoding", "openzeppelin", + "snforge_std", ] [[package]] @@ -92,3 +147,16 @@ source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f name = "openzeppelin_utils" version = "0.15.1" source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" + +[[package]] +name = "snforge_scarb_plugin" +version = "0.1.0" +source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.28.0#4dfe39d96690ed6b3d56971512700de3f58288ea" + +[[package]] +name = "snforge_std" +version = "0.28.0" +source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.28.0#4dfe39d96690ed6b3d56971512700de3f58288ea" +dependencies = [ + "snforge_scarb_plugin", +] diff --git a/contracts/Scarb.toml b/contracts/Scarb.toml index cf9de44e4..90373988a 100644 --- a/contracts/Scarb.toml +++ b/contracts/Scarb.toml @@ -7,14 +7,19 @@ homepage = "https://github.com/smartcontractkit/chainlink-starknet" [scripts] sierra = "cairo-compile . -r" +test = "snforge test" # Add your own custom commands and run them with scarb run # Uncomment if you want to use dependencies # Note: currently testing doesn't work with dependencies [dependencies] -starknet = ">=2.7.1" +starknet = "2.7.1" openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.15.1" } -cairo_test = "2.7.1" +alexandria_bytes = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "e1b080577aaa6889116fc8be5dde72b2fd21e397" } +alexandria_encoding = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "e1b080577aaa6889116fc8be5dde72b2fd21e397" } + +[dev-dependencies] +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } [lib] diff --git a/contracts/src/libraries/mocks.cairo b/contracts/src/libraries/mocks.cairo index 9a58bab7d..a6e8a7395 100644 --- a/contracts/src/libraries/mocks.cairo +++ b/contracts/src/libraries/mocks.cairo @@ -1,2 +1,3 @@ mod mock_upgradeable; mod mock_non_upgradeable; +mod mock_multisig_target; diff --git a/contracts/src/libraries/mocks/mock_multisig_target.cairo b/contracts/src/libraries/mocks/mock_multisig_target.cairo new file mode 100644 index 000000000..686fa976d --- /dev/null +++ b/contracts/src/libraries/mocks/mock_multisig_target.cairo @@ -0,0 +1,16 @@ +#[starknet::contract] +mod MockMultisigTarget { + use array::ArrayTrait; + + #[storage] + struct Storage {} + + #[abi(per_item)] + #[generate_trait] + impl HelperImpl of HelperTrait { + #[external(v0)] + fn increment(ref self: ContractState, val1: felt252, val2: felt252) -> Array { + array![val1 + 1, val2 + 1] + } + } +} diff --git a/contracts/src/tests/test_access_controller.cairo b/contracts/src/tests/test_access_controller.cairo index 17d570978..f2466f132 100644 --- a/contracts/src/tests/test_access_controller.cairo +++ b/contracts/src/tests/test_access_controller.cairo @@ -19,13 +19,19 @@ use chainlink::libraries::access_control::{ IAccessController, IAccessControllerDispatcher, IAccessControllerDispatcherTrait }; +use snforge_std::{ + declare, ContractClassTrait, start_cheat_caller_address_global, + stop_cheat_caller_address_global, DeclareResultTrait +}; + + fn STATE() -> AccessController::ContractState { AccessController::contract_state_for_testing() } fn setup() -> ContractAddress { let account: ContractAddress = contract_address_const::<777>(); - set_caller_address(account); + start_cheat_caller_address_global(account); account } @@ -44,10 +50,10 @@ fn test_access_control() { // Deploy access controller let calldata = array![owner.into(), // owner ]; - let (accessControllerAddr, _) = deploy_syscall( - AccessController::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false - ) - .unwrap(); + + let contract = declare("AccessController").unwrap().contract_class(); + + let (accessControllerAddr, _) = contract.deploy(@calldata).unwrap(); should_implement_access_control(accessControllerAddr, owner); } @@ -62,7 +68,7 @@ fn should_implement_access_control(contract_addr: ContractAddress, owner: Contra let contract = IAccessControllerDispatcher { contract_address: contract_addr }; let acc2: ContractAddress = contract_address_const::<2222987765>(); - set_contract_address(owner); // required to call contract as owner + start_cheat_caller_address_global(owner); // access check is enabled by default assert(!contract.has_access(acc2, array![]), 'should not have access'); diff --git a/contracts/src/tests/test_aggregator.cairo b/contracts/src/tests/test_aggregator.cairo index e2c3d81c3..6225a9564 100644 --- a/contracts/src/tests/test_aggregator.cairo +++ b/contracts/src/tests/test_aggregator.cairo @@ -12,6 +12,7 @@ use traits::Into; use traits::TryInto; use option::OptionTrait; use core::result::ResultTrait; +use core::panic_with_felt252; use chainlink::ocr2::aggregator::pow; use chainlink::ocr2::aggregator::Aggregator; @@ -25,6 +26,11 @@ use chainlink::token::link_token::LinkToken; use chainlink::tests::test_ownable::should_implement_ownable; use chainlink::tests::test_access_controller::should_implement_access_control; +use snforge_std::{ + declare, ContractClassTrait, start_cheat_caller_address_global, + stop_cheat_caller_address_global, DeclareResultTrait +}; + #[test] fn test_pow_2_0() { assert(pow(2, 0) == 0x1, 'expected 0x1'); @@ -78,15 +84,18 @@ fn setup() -> ( let acc1: ContractAddress = contract_address_const::<777>(); let acc2: ContractAddress = contract_address_const::<888>(); // set acc1 as default caller - set_caller_address(acc1); + start_cheat_caller_address_global(acc1); // deploy billing access controller let calldata = array![acc1.into(), // owner = acc1; ]; - let (billingAccessControllerAddr, _) = deploy_syscall( - AccessController::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false - ) + + let (billingAccessControllerAddr, _) = declare("AccessController") + .unwrap() + .contract_class() + .deploy(@calldata) .unwrap(); + let billingAccessController = IAccessControllerDispatcher { contract_address: billingAccessControllerAddr }; @@ -95,10 +104,13 @@ fn setup() -> ( let calldata = array![acc1.into(), // minter = acc1; acc1.into(), // owner = acc1; ]; - let (linkTokenAddr, _) = deploy_syscall( - LinkToken::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false - ) + + let (linkTokenAddr, _) = declare("LinkToken") + .unwrap() + .contract_class() + .deploy(@calldata) .unwrap(); + let linkToken = ILinkTokenDispatcher { contract_address: linkTokenAddr }; // return accounts, billing access controller, link token @@ -118,9 +130,11 @@ fn test_ownable() { 8, // decimals 123, // description ]; - let (aggregatorAddr, _) = deploy_syscall( - Aggregator::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false - ) + + let (aggregatorAddr, _) = declare("Aggregator") + .unwrap() + .contract_class() + .deploy(@calldata) .unwrap(); should_implement_ownable(aggregatorAddr, account); @@ -139,15 +153,21 @@ fn test_access_control() { 8, // decimals 123, // description ]; - let (aggregatorAddr, _) = deploy_syscall( - Aggregator::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false - ) + + let (aggregatorAddr, _) = declare("Aggregator") + .unwrap() + .contract_class() + .deploy(@calldata) .unwrap(); + // let (aggregatorAddr, _) = deploy_syscall( + // Aggregator::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false + // ) + // .unwrap(); + should_implement_access_control(aggregatorAddr, account); } - #[test] #[should_panic(expected: ('Caller is not the owner',))] fn test_upgrade_non_owner() { @@ -169,7 +189,7 @@ fn test_set_billing_access_controller_not_owner() { ); // set billing access controller should revert if caller is not owner - set_caller_address(acc2); + start_cheat_caller_address_global(acc2); BillingImpl::set_billing_access_controller(ref state, billingAccessController.contract_address); } @@ -196,7 +216,7 @@ fn test_set_billing_config_no_access() { gas_base: 1, gas_per_signature: 1, }; - set_caller_address(acc2); + start_cheat_caller_address_global(acc2); BillingImpl::set_billing(ref state, config); } @@ -237,7 +257,7 @@ fn test_set_billing_config_as_acc_with_access() { let (owner, acc2, billingAccessController, _) = setup(); let mut state = STATE(); // grant acc2 access on access controller - set_contract_address(owner); + start_cheat_caller_address_global(owner); billingAccessController.add_access(acc2); Aggregator::constructor( @@ -258,7 +278,7 @@ fn test_set_billing_config_as_acc_with_access() { gas_base: 1, gas_per_signature: 1, }; - set_caller_address(acc2); + start_cheat_caller_address_global(acc2); BillingImpl::set_billing(ref state, config); // check billing config @@ -281,9 +301,8 @@ fn test_set_payees_caller_not_owner() { ); let payees = array![PayeeConfig { transmitter: acc2, payee: acc2, },]; - // set payee should revert if caller is not owner - set_caller_address(acc2); + start_cheat_caller_address_global(acc2); PayeeManagementImpl::set_payees(ref state, payees); } @@ -296,8 +315,7 @@ fn test_set_single_payee() { ); let payees = array![PayeeConfig { transmitter: acc2, payee: acc2, },]; - - set_caller_address(owner); + start_cheat_caller_address_global(owner); PayeeManagementImpl::set_payees(ref state, payees); } @@ -313,8 +331,7 @@ fn test_set_multiple_payees() { PayeeConfig { transmitter: acc2, payee: acc2, }, PayeeConfig { transmitter: owner, payee: owner, }, ]; - - set_caller_address(owner); + start_cheat_caller_address_global(owner); PayeeManagementImpl::set_payees(ref state, payees); } @@ -330,7 +347,7 @@ fn test_transfer_payeeship_caller_not_payee() { let transmitter = contract_address_const::<123>(); let payees = array![PayeeConfig { transmitter: transmitter, payee: acc2, },]; - set_caller_address(owner); + start_cheat_caller_address_global(owner); PayeeManagementImpl::set_payees(ref state, payees); PayeeManagementImpl::transfer_payeeship(ref state, transmitter, owner); } @@ -347,9 +364,9 @@ fn test_transfer_payeeship_to_self() { let transmitter = contract_address_const::<123>(); let payees = array![PayeeConfig { transmitter: transmitter, payee: acc2, },]; - set_caller_address(owner); + start_cheat_caller_address_global(owner); PayeeManagementImpl::set_payees(ref state, payees); - set_caller_address(acc2); + start_cheat_caller_address_global(acc2); PayeeManagementImpl::transfer_payeeship(ref state, transmitter, acc2); } @@ -365,9 +382,9 @@ fn test_accept_payeeship_caller_not_proposed_payee() { let transmitter = contract_address_const::<123>(); let payees = array![PayeeConfig { transmitter: transmitter, payee: acc2, },]; - set_caller_address(owner); + start_cheat_caller_address_global(owner); PayeeManagementImpl::set_payees(ref state, payees); - set_caller_address(acc2); + start_cheat_caller_address_global(acc2); PayeeManagementImpl::transfer_payeeship(ref state, transmitter, owner); PayeeManagementImpl::accept_payeeship(ref state, transmitter); } @@ -383,11 +400,11 @@ fn test_transfer_and_accept_payeeship() { let transmitter = contract_address_const::<123>(); let payees = array![PayeeConfig { transmitter: transmitter, payee: acc2, },]; - set_caller_address(owner); + start_cheat_caller_address_global(owner); PayeeManagementImpl::set_payees(ref state, payees); - set_caller_address(acc2); + start_cheat_caller_address_global(acc2); PayeeManagementImpl::transfer_payeeship(ref state, transmitter, owner); - set_caller_address(owner); + start_cheat_caller_address_global(owner); PayeeManagementImpl::accept_payeeship(ref state, transmitter); } // --- Payments and Withdrawals Tests --- @@ -408,7 +425,7 @@ fn test_owed_payment_no_rounds() { let transmitter = contract_address_const::<123>(); let mut payees = array![PayeeConfig { transmitter: transmitter, payee: acc2, },]; - set_caller_address(owner); + start_cheat_caller_address_global(owner); PayeeManagementImpl::set_payees(ref state, payees); let owed = BillingImpl::owed_payment(@state, transmitter); diff --git a/contracts/src/tests/test_aggregator_proxy.cairo b/contracts/src/tests/test_aggregator_proxy.cairo index ef33d0f66..54c8f920d 100644 --- a/contracts/src/tests/test_aggregator_proxy.cairo +++ b/contracts/src/tests/test_aggregator_proxy.cairo @@ -24,6 +24,12 @@ use chainlink::utils::split_felt; use chainlink::tests::test_ownable::should_implement_ownable; use chainlink::tests::test_access_controller::should_implement_access_control; +use snforge_std::{ + declare, ContractClassTrait, start_cheat_caller_address_global, + stop_cheat_caller_address_global, DeclareResultTrait +}; + + fn STATE() -> AggregatorProxy::ContractState { AggregatorProxy::contract_state_for_testing() } @@ -37,15 +43,17 @@ fn setup() -> ( ) { // Set account as default caller let account: ContractAddress = contract_address_const::<1>(); - set_caller_address(account); + + start_cheat_caller_address_global(account); // Deploy mock aggregator 1 let mut calldata = ArrayTrait::new(); calldata.append(8); // decimals = 8 - let (mockAggregatorAddr1, _) = deploy_syscall( - MockAggregator::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false - ) - .unwrap(); + + let contract = declare("MockAggregator").unwrap().contract_class(); + + let (mockAggregatorAddr1, _) = contract.deploy(@calldata).unwrap(); + let mockAggregator1 = IMockAggregatorDispatcher { contract_address: mockAggregatorAddr1 }; // Deploy mock aggregator 2 @@ -53,10 +61,9 @@ fn setup() -> ( // so we need to change the decimals parameter to avoid an address conflict with mock aggregator 1 let mut calldata2 = ArrayTrait::new(); calldata2.append(10); // decimals = 10 - let (mockAggregatorAddr2, _) = deploy_syscall( - MockAggregator::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata2.span(), false - ) - .unwrap(); + + let (mockAggregatorAddr2, _) = contract.deploy(@calldata).unwrap(); + let mockAggregator2 = IMockAggregatorDispatcher { contract_address: mockAggregatorAddr2 }; // Return account, mock aggregator address and mock aggregator contract @@ -69,9 +76,10 @@ fn test_ownable() { // Deploy aggregator proxy let calldata = array![account.into(), // owner = account mockAggregatorAddr.into(),]; - let (aggregatorProxyAddr, _) = deploy_syscall( - AggregatorProxy::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false - ) + let (aggregatorProxyAddr, _) = declare("AggregatorProxy") + .unwrap() + .contract_class() + .deploy(@calldata) .unwrap(); should_implement_ownable(aggregatorProxyAddr, account); @@ -83,9 +91,11 @@ fn test_access_control() { // Deploy aggregator proxy let calldata = array![account.into(), // owner = account mockAggregatorAddr.into(),]; - let (aggregatorProxyAddr, _) = deploy_syscall( - AggregatorProxy::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false - ) + + let (aggregatorProxyAddr, _) = declare("AggregatorProxy") + .unwrap() + .contract_class() + .deploy(@calldata) .unwrap(); should_implement_access_control(aggregatorProxyAddr, account); @@ -133,7 +143,7 @@ fn test_query_latest_round_data_without_access() { // insert round into mock aggregator mockAggregator.set_latest_round_data(10, 1, 9, 8); // set caller to non-owner address with no read access - set_caller_address(contract_address_const::<2>()); + start_cheat_caller_address_global(contract_address_const::<2>()); // query latest round AggregatorProxyImpl::latest_round_data(@state); } @@ -149,7 +159,7 @@ fn test_query_latest_answer_without_access() { // insert round into mock aggregator mockAggregator.set_latest_round_data(10, 1, 9, 8); // set caller to non-owner address with no read access - set_caller_address(contract_address_const::<2>()); + start_cheat_caller_address_global(contract_address_const::<2>()); // query latest round AggregatorProxyImpl::latest_answer(@state); } diff --git a/contracts/src/tests/test_erc677.cairo b/contracts/src/tests/test_erc677.cairo index 99b9c8fbf..b96af180e 100644 --- a/contracts/src/tests/test_erc677.cairo +++ b/contracts/src/tests/test_erc677.cairo @@ -16,6 +16,11 @@ use chainlink::token::mock::invalid_erc667_receiver::InvalidReceiver; use chainlink::libraries::token::erc677::ERC677Component; use chainlink::libraries::token::erc677::ERC677Component::ERC677Impl; +use snforge_std::{ + declare, ContractClassTrait, start_cheat_caller_address_global, + stop_cheat_caller_address_global, DeclareResultTrait +}; + #[starknet::interface] trait MockInvalidReceiver { fn set_supports(ref self: TContractState, value: bool); @@ -30,16 +35,19 @@ use chainlink::token::mock::valid_erc667_receiver::{ fn setup() -> ContractAddress { let account: ContractAddress = contract_address_const::<1>(); // Set account as default caller - set_caller_address(account); + start_cheat_caller_address_global(account); account } fn setup_valid_receiver() -> (ContractAddress, MockValidReceiverDispatcher) { let calldata = ArrayTrait::new(); - let (address, _) = deploy_syscall( - ValidReceiver::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false - ) + + let (address, _) = declare("ValidReceiver") + .unwrap() + .contract_class() + .deploy(@calldata) .unwrap(); + let contract = MockValidReceiverDispatcher { contract_address: address }; (address, contract) } @@ -47,10 +55,13 @@ fn setup_valid_receiver() -> (ContractAddress, MockValidReceiverDispatcher) { fn setup_invalid_receiver() -> (ContractAddress, MockInvalidReceiverDispatcher) { let calldata = ArrayTrait::new(); - let (address, _) = deploy_syscall( - InvalidReceiver::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false - ) + + let (address, _) = declare("InvalidReceiver") + .unwrap() + .contract_class() + .deploy(@calldata) .unwrap(); + let contract = MockInvalidReceiverDispatcher { contract_address: address }; (address, contract) } @@ -83,7 +94,7 @@ fn test_valid_transfer_and_call() { } #[test] -#[should_panic(expected: ('ENTRYPOINT_NOT_FOUND',))] +#[should_panic] fn test_invalid_receiver_supports_interface_true() { setup(); let (receiver_address, receiver) = setup_invalid_receiver(); @@ -103,7 +114,7 @@ fn test_invalid_receiver_supports_interface_false() { #[test] -#[should_panic(expected: ('CONTRACT_NOT_DEPLOYED',))] +#[should_panic] fn test_nonexistent_receiver() { setup(); diff --git a/contracts/src/tests/test_link_token.cairo b/contracts/src/tests/test_link_token.cairo index a8b7ffc78..0caec4cf3 100644 --- a/contracts/src/tests/test_link_token.cairo +++ b/contracts/src/tests/test_link_token.cairo @@ -17,6 +17,12 @@ use chainlink::token::link_token::LinkToken::{MintableToken, UpgradeableImpl}; use openzeppelin::token::erc20::ERC20Component::{ERC20Impl, ERC20MetadataImpl}; use chainlink::tests::test_ownable::should_implement_ownable; +use snforge_std::{ + declare, ContractClassTrait, start_cheat_caller_address_global, + stop_cheat_caller_address_global, DeclareResultTrait +}; + + // only tests link token specific functionality // erc20 and erc677 functionality is already tested elsewhere @@ -27,7 +33,7 @@ fn STATE() -> LinkToken::ContractState { fn setup() -> ContractAddress { let account: ContractAddress = contract_address_const::<1>(); // Set account as default caller - set_caller_address(account); + start_cheat_caller_address_global(account); account } @@ -38,10 +44,8 @@ fn test_ownable() { let mut calldata = ArrayTrait::new(); calldata.append(class_hash_const::<123>().into()); // minter calldata.append(account.into()); // owner - let (linkAddr, _) = deploy_syscall( - LinkToken::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false - ) - .unwrap(); + + let (linkAddr, _) = declare("LinkToken").unwrap().contract_class().deploy(@calldata).unwrap(); should_implement_ownable(linkAddr, account); } diff --git a/contracts/src/tests/test_mock_aggregator.cairo b/contracts/src/tests/test_mock_aggregator.cairo index e95b7b87e..af3387415 100644 --- a/contracts/src/tests/test_mock_aggregator.cairo +++ b/contracts/src/tests/test_mock_aggregator.cairo @@ -4,6 +4,10 @@ use chainlink::ocr2::mocks::mock_aggregator::MockAggregator; use starknet::contract_address_const; use chainlink::ocr2::aggregator::Round; +use snforge_std::{ + declare, ContractClassTrait, start_cheat_caller_address_global, stop_cheat_caller_address_global +}; + fn STATE() -> MockAggregator::ContractState { MockAggregator::contract_state_for_testing() } @@ -11,7 +15,7 @@ fn STATE() -> MockAggregator::ContractState { fn setup() -> ContractAddress { let account: ContractAddress = contract_address_const::<777>(); // Set account as default caller - set_caller_address(account); + start_cheat_caller_address_global(account); account } diff --git a/contracts/src/tests/test_multisig.cairo b/contracts/src/tests/test_multisig.cairo index becfe4d7d..05444da9c 100644 --- a/contracts/src/tests/test_multisig.cairo +++ b/contracts/src/tests/test_multisig.cairo @@ -17,23 +17,10 @@ use chainlink::multisig::Multisig; use chainlink::multisig::Multisig::{MultisigImpl, UpgradeableImpl}; use chainlink::multisig::{IMultisigDispatcher}; -#[starknet::contract] -mod MultisigTest { - use array::ArrayTrait; - - #[storage] - struct Storage {} - - #[abi(per_item)] - #[generate_trait] - impl HelperImpl of HelperTrait { - #[external(v0)] - fn increment(ref self: ContractState, val1: felt252, val2: felt252) -> Array { - array![val1 + 1, val2 + 1] - } - } -} - +use snforge_std::{ + declare, ContractClassTrait, start_cheat_caller_address_global, + stop_cheat_caller_address_global, cheat_caller_address, CheatSpan, DeclareResultTrait +}; fn STATE() -> Multisig::ContractState { Multisig::contract_state_for_testing() @@ -123,7 +110,7 @@ fn test_submit_transaction() { let signers = array![signer]; Multisig::constructor(ref state, :signers, threshold: 1); - set_caller_address(signer); + start_cheat_caller_address_global(signer); let to = contract_address_const::<42>(); let function_selector = 10; MultisigImpl::submit_transaction( @@ -147,7 +134,7 @@ fn test_submit_transaction_not_signer() { let signers = array![signer]; Multisig::constructor(ref state, :signers, threshold: 1); - set_caller_address(contract_address_const::<3>()); + start_cheat_caller_address_global(contract_address_const::<3>()); MultisigImpl::submit_transaction( ref state, to: contract_address_const::<42>(), @@ -164,7 +151,7 @@ fn test_confirm_transaction() { let signers = array![signer1, signer2]; Multisig::constructor(ref state, :signers, threshold: 2); - set_caller_address(signer1); + start_cheat_caller_address_global(signer1); MultisigImpl::submit_transaction( ref state, to: contract_address_const::<42>(), @@ -189,15 +176,14 @@ fn test_confirm_transaction_not_signer() { let not_signer = contract_address_const::<2>(); let signers = array![signer]; Multisig::constructor(ref state, :signers, threshold: 1); - set_caller_address(signer); + start_cheat_caller_address_global(signer); MultisigImpl::submit_transaction( ref state, to: contract_address_const::<42>(), function_selector: 10, calldata: sample_calldata(), ); - - set_caller_address(not_signer); + start_cheat_caller_address_global(not_signer); MultisigImpl::confirm_transaction(ref state, nonce: 0); } @@ -208,7 +194,7 @@ fn test_revoke_confirmation() { let signer2 = contract_address_const::<2>(); let signers = array![signer1, signer2]; Multisig::constructor(ref state, :signers, threshold: 2); - set_caller_address(signer1); + start_cheat_caller_address_global(signer1); MultisigImpl::submit_transaction( ref state, to: contract_address_const::<42>(), @@ -237,7 +223,7 @@ fn test_revoke_confirmation_not_signer() { let not_signer = contract_address_const::<2>(); let mut signers = array![signer]; Multisig::constructor(ref state, :signers, threshold: 2); - set_caller_address(signer); + start_cheat_caller_address_global(signer); MultisigImpl::submit_transaction( ref state, to: contract_address_const::<42>(), @@ -245,8 +231,7 @@ fn test_revoke_confirmation_not_signer() { calldata: sample_calldata(), ); MultisigImpl::confirm_transaction(ref state, nonce: 0); - - set_caller_address(not_signer); + start_cheat_caller_address_global(not_signer); MultisigImpl::revoke_confirmation(ref state, nonce: 0); } @@ -257,8 +242,9 @@ fn test_execute_confirmation_below_threshold() { let signer1 = contract_address_const::<1>(); let signer2 = contract_address_const::<2>(); let signers = array![signer1, signer2]; + Multisig::constructor(ref state, :signers, threshold: 2); - set_caller_address(signer1); + start_cheat_caller_address_global(signer1); MultisigImpl::submit_transaction( ref state, to: contract_address_const::<42>(), @@ -274,8 +260,7 @@ fn test_execute_confirmation_below_threshold() { fn test_upgrade_not_multisig() { let mut state = STATE(); let account = contract_address_const::<777>(); - set_caller_address(account); - + start_cheat_caller_address_global(account); UpgradeableImpl::upgrade(ref state, class_hash_const::<1>()) } @@ -286,11 +271,16 @@ fn test_execute() { let signer2 = contract_address_const::<2>(); let signers = array![signer1, signer2]; Multisig::constructor(ref state, :signers, threshold: 2); - let (test_address, _) = deploy_syscall( - MultisigTest::TEST_CLASS_HASH.try_into().unwrap(), 0, ArrayTrait::new().span(), false - ) + + let calldata = ArrayTrait::new(); + + let (test_address, _) = declare("MockMultisigTarget") + .unwrap() + .contract_class() + .deploy(@calldata) .unwrap(); - set_caller_address(signer1); + + start_cheat_caller_address_global(signer1); let increment_calldata = array![42, 100]; MultisigImpl::submit_transaction( ref state, @@ -300,7 +290,7 @@ fn test_execute() { calldata: increment_calldata, ); MultisigImpl::confirm_transaction(ref state, nonce: 0); - set_caller_address(signer2); + start_cheat_caller_address_global(signer2); MultisigImpl::confirm_transaction(ref state, nonce: 0); let response = MultisigImpl::execute_transaction(ref state, nonce: 0); @@ -318,7 +308,7 @@ fn test_execute_not_signer() { let signer2 = contract_address_const::<2>(); let signers = array![signer1, signer2]; Multisig::constructor(ref state, :signers, threshold: 2); - set_caller_address(signer1); + start_cheat_caller_address_global(signer1); MultisigImpl::submit_transaction( ref state, to: contract_address_const::<42>(), @@ -326,96 +316,117 @@ fn test_execute_not_signer() { calldata: sample_calldata(), ); MultisigImpl::confirm_transaction(ref state, nonce: 0); - set_caller_address(signer2); + start_cheat_caller_address_global(signer2); MultisigImpl::confirm_transaction(ref state, nonce: 0); - - set_caller_address(contract_address_const::<3>()); + start_cheat_caller_address_global(contract_address_const::<3>()); MultisigImpl::execute_transaction(ref state, nonce: 0); } #[test] #[should_panic(expected: ('transaction invalid',))] fn test_execute_after_set_signers() { - let mut state = STATE(); - let contract_address = contract_address_const::<100>(); - set_contract_address(contract_address); let signer1 = contract_address_const::<1>(); let signer2 = contract_address_const::<2>(); let signer3 = contract_address_const::<3>(); let signers = array![signer1, signer2]; - Multisig::constructor(ref state, :signers, threshold: 2); - set_caller_address(signer1); - MultisigImpl::submit_transaction( - ref state, - to: contract_address_const::<42>(), - function_selector: 10, - calldata: sample_calldata(), - ); - MultisigImpl::confirm_transaction(ref state, nonce: 0); - set_caller_address(signer2); - MultisigImpl::confirm_transaction(ref state, nonce: 0); - set_caller_address(contract_address); - let new_signers = array![signer2, signer3]; - MultisigImpl::set_signers(ref state, new_signers); + let init_threshold: usize = 2; - set_caller_address(signer2); - MultisigImpl::execute_transaction(ref state, nonce: 0); + let mut deploy_calldata = ArrayTrait::new(); + Serde::serialize(@signers, ref deploy_calldata); + Serde::serialize(@init_threshold, ref deploy_calldata); + + let (multisig_address, _) = declare("Multisig") + .unwrap() + .contract_class() + .deploy(@deploy_calldata) + .unwrap(); + + let multisig = IMultisigDispatcher { contract_address: multisig_address }; + + start_cheat_caller_address_global(signer1); + multisig + .submit_transaction( + to: contract_address_const::<42>(), function_selector: 10, calldata: sample_calldata(), + ); + multisig.confirm_transaction(nonce: 0); + start_cheat_caller_address_global(signer2); + multisig.confirm_transaction(nonce: 0); + start_cheat_caller_address_global(multisig_address); + let new_signers = array![signer2, signer3]; + multisig.set_signers(new_signers); + start_cheat_caller_address_global(signer2); + multisig.execute_transaction(nonce: 0); } #[test] #[should_panic(expected: ('transaction invalid',))] fn test_execute_after_set_signers_and_threshold() { - let mut state = STATE(); - let contract_address = contract_address_const::<100>(); - set_contract_address(contract_address); let signer1 = contract_address_const::<1>(); let signer2 = contract_address_const::<2>(); let signer3 = contract_address_const::<3>(); let signers = array![signer1, signer2]; - Multisig::constructor(ref state, :signers, threshold: 2); - set_caller_address(signer1); - MultisigImpl::submit_transaction( - ref state, - to: contract_address_const::<42>(), - function_selector: 10, - calldata: sample_calldata(), - ); - MultisigImpl::confirm_transaction(ref state, nonce: 0); - set_caller_address(signer2); - MultisigImpl::confirm_transaction(ref state, nonce: 0); - set_caller_address(contract_address); - let new_signers = array![signer2, signer3]; - MultisigImpl::set_signers_and_threshold(ref state, new_signers, 1); + let init_threshold: usize = 2; - set_caller_address(signer2); - MultisigImpl::execute_transaction(ref state, nonce: 0); + let mut deploy_calldata = ArrayTrait::new(); + Serde::serialize(@signers, ref deploy_calldata); + Serde::serialize(@init_threshold, ref deploy_calldata); + + let (multisig_address, _) = declare("Multisig") + .unwrap() + .contract_class() + .deploy(@deploy_calldata) + .unwrap(); + + let multisig = IMultisigDispatcher { contract_address: multisig_address }; + + // Multisig::constructor(ref state, :signers, threshold: 2); + start_cheat_caller_address_global(signer1); + multisig + .submit_transaction( + to: contract_address_const::<42>(), function_selector: 10, calldata: sample_calldata(), + ); + multisig.confirm_transaction(nonce: 0); + start_cheat_caller_address_global(signer2); + multisig.confirm_transaction(nonce: 0); + start_cheat_caller_address_global(multisig_address); + let new_signers = array![signer2, signer3]; + multisig.set_signers_and_threshold(new_signers, 1); + start_cheat_caller_address_global(signer2); + multisig.execute_transaction(nonce: 0); } #[test] #[should_panic(expected: ('transaction invalid',))] fn test_execute_after_set_threshold() { - let mut state = STATE(); - let contract_address = contract_address_const::<100>(); - set_contract_address(contract_address); let signer1 = contract_address_const::<1>(); let signer2 = contract_address_const::<2>(); let signers = array![signer1, signer2]; - Multisig::constructor(ref state, :signers, threshold: 2); - set_caller_address(signer1); - MultisigImpl::submit_transaction( - ref state, - to: contract_address_const::<42>(), - function_selector: 10, - calldata: sample_calldata(), - ); - MultisigImpl::confirm_transaction(ref state, nonce: 0); - set_caller_address(signer2); - MultisigImpl::confirm_transaction(ref state, nonce: 0); - set_caller_address(contract_address); - MultisigImpl::set_threshold(ref state, 1); + let init_threshold: usize = 2; - set_caller_address(signer1); - MultisigImpl::execute_transaction(ref state, nonce: 0); + let mut deploy_calldata = ArrayTrait::new(); + Serde::serialize(@signers, ref deploy_calldata); + Serde::serialize(@init_threshold, ref deploy_calldata); + + let (multisig_address, _) = declare("Multisig") + .unwrap() + .contract_class() + .deploy(@deploy_calldata) + .unwrap(); + + let multisig = IMultisigDispatcher { contract_address: multisig_address }; + + start_cheat_caller_address_global(signer1); + multisig + .submit_transaction( + to: contract_address_const::<42>(), function_selector: 10, calldata: sample_calldata(), + ); + multisig.confirm_transaction(nonce: 0); + start_cheat_caller_address_global(signer2); + multisig.confirm_transaction(nonce: 0); + start_cheat_caller_address_global(multisig_address); + multisig.set_threshold(1); + start_cheat_caller_address_global(signer1); + multisig.execute_transaction(nonce: 0); } // test set_threshold (non-recursive) @@ -431,14 +442,16 @@ fn test_set_threshold() { let mut deploy_calldata = ArrayTrait::new(); Serde::serialize(@signers, ref deploy_calldata); Serde::serialize(@init_threshold, ref deploy_calldata); - let (multisig_address, _) = deploy_syscall( - Multisig::TEST_CLASS_HASH.try_into().unwrap(), 0, deploy_calldata.span(), false - ) + + let (multisig_address, _) = declare("Multisig") + .unwrap() + .contract_class() + .deploy(@deploy_calldata) .unwrap(); let multisig = IMultisigDispatcher { contract_address: multisig_address }; assert(multisig.get_threshold() == init_threshold, 'invalid init threshold'); - set_contract_address(multisig_address); + start_cheat_caller_address_global(multisig_address); multisig.set_threshold(new_threshold); assert(multisig.get_threshold() == new_threshold, 'threshold was not updated'); } @@ -457,9 +470,11 @@ fn test_recursive_set_threshold() { let mut deploy_calldata = ArrayTrait::new(); Serde::serialize(@signers, ref deploy_calldata); Serde::serialize(@init_threshold, ref deploy_calldata); - let (multisig_address, _) = deploy_syscall( - Multisig::TEST_CLASS_HASH.try_into().unwrap(), 0, deploy_calldata.span(), false - ) + + let (multisig_address, _) = declare("Multisig") + .unwrap() + .contract_class() + .deploy(@deploy_calldata) .unwrap(); // Gets a dispatcher (so we can call methods on the deployed contract) @@ -472,19 +487,21 @@ fn test_recursive_set_threshold() { // contract. let mut set_threshold_calldata = ArrayTrait::new(); Serde::serialize(@new_threshold, ref set_threshold_calldata); - set_contract_address(s1); + start_cheat_caller_address_global(s1); multisig .submit_transaction(multisig_address, selector!("set_threshold"), set_threshold_calldata); // Signer 1 confirms the transaction - set_contract_address(s1); + start_cheat_caller_address_global(s1); multisig.confirm_transaction(0); // Signer 2 confirms the transaction - set_contract_address(s2); + start_cheat_caller_address_global(s2); multisig.confirm_transaction(0); // Once we have enough confirmations, we execute the transaction - set_contract_address(s1); + // cheat only once because we want the multisig to execute the recursive tx + cheat_caller_address(multisig_address, s1, CheatSpan::TargetCalls(1)); + multisig.execute_transaction(0); // Now we check that the threshold was actually updated @@ -503,9 +520,11 @@ fn test_set_signers() { let mut deploy_calldata = ArrayTrait::new(); Serde::serialize(@init_signers, ref deploy_calldata); Serde::serialize(@threshold, ref deploy_calldata); - let (multisig_address, _) = deploy_syscall( - Multisig::TEST_CLASS_HASH.try_into().unwrap(), 0, deploy_calldata.span(), false - ) + + let (multisig_address, _) = declare("Multisig") + .unwrap() + .contract_class() + .deploy(@deploy_calldata) .unwrap(); let multisig = IMultisigDispatcher { contract_address: multisig_address }; @@ -516,7 +535,7 @@ fn test_set_signers() { assert(*returned_signers.at(1) == s2, 'should match signer 2'); assert(multisig.get_threshold() == 2, 'wrong init threshold'); - set_contract_address(multisig_address); + start_cheat_caller_address_global(multisig_address); multisig.set_signers(new_signers); let updated_signers = multisig.get_signers(); @@ -539,9 +558,11 @@ fn test_recursive_set_signers() { let mut deploy_calldata = ArrayTrait::new(); Serde::serialize(@init_signers, ref deploy_calldata); Serde::serialize(@init_threshold, ref deploy_calldata); - let (multisig_address, _) = deploy_syscall( - Multisig::TEST_CLASS_HASH.try_into().unwrap(), 0, deploy_calldata.span(), false - ) + + let (multisig_address, _) = declare("Multisig") + .unwrap() + .contract_class() + .deploy(@deploy_calldata) .unwrap(); // Gets a dispatcher (so we can call methods on the deployed contract) @@ -559,19 +580,19 @@ fn test_recursive_set_signers() { // contract. let mut set_signers_calldata = ArrayTrait::new(); Serde::serialize(@new_signers, ref set_signers_calldata); - set_contract_address(s1); + start_cheat_caller_address_global(s1); multisig.submit_transaction(multisig_address, selector!("set_signers"), set_signers_calldata); // Signer 1 confirms the transaction - set_contract_address(s1); + start_cheat_caller_address_global(s1); multisig.confirm_transaction(0); // Signer 2 confirms the transaction - set_contract_address(s2); + start_cheat_caller_address_global(s2); multisig.confirm_transaction(0); // Once we have enough confirmations, we execute the transaction - set_contract_address(s1); + cheat_caller_address(multisig_address, s1, CheatSpan::TargetCalls(1)); multisig.execute_transaction(0); // Now we check that the signers were actually updated @@ -595,9 +616,11 @@ fn test_set_signers_and_threshold() { let mut deploy_calldata = ArrayTrait::new(); Serde::serialize(@init_signers, ref deploy_calldata); Serde::serialize(@init_threshold, ref deploy_calldata); - let (multisig_address, _) = deploy_syscall( - Multisig::TEST_CLASS_HASH.try_into().unwrap(), 0, deploy_calldata.span(), false - ) + + let (multisig_address, _) = declare("Multisig") + .unwrap() + .contract_class() + .deploy(@deploy_calldata) .unwrap(); let multisig = IMultisigDispatcher { contract_address: multisig_address }; @@ -609,7 +632,7 @@ fn test_set_signers_and_threshold() { assert(*returned_signers.at(2) == s3, 'should match signer 3'); assert(multisig.get_threshold() == init_threshold, 'wrong init threshold'); - set_contract_address(multisig_address); + start_cheat_caller_address_global(multisig_address); multisig.set_signers_and_threshold(new_signers, new_threshold); let updated_signers = multisig.get_signers(); @@ -635,9 +658,11 @@ fn test_recursive_set_signers_and_threshold() { let mut deploy_calldata = ArrayTrait::new(); Serde::serialize(@init_signers, ref deploy_calldata); Serde::serialize(@init_threshold, ref deploy_calldata); - let (multisig_address, _) = deploy_syscall( - Multisig::TEST_CLASS_HASH.try_into().unwrap(), 0, deploy_calldata.span(), false - ) + + let (multisig_address, _) = declare("Multisig") + .unwrap() + .contract_class() + .deploy(@deploy_calldata) .unwrap(); // Gets a dispatcher (so we can call methods on the deployed contract) @@ -657,7 +682,7 @@ fn test_recursive_set_signers_and_threshold() { let mut set_signers_and_threshold_calldata = ArrayTrait::new(); Serde::serialize(@new_signers, ref set_signers_and_threshold_calldata); Serde::serialize(@new_threshold, ref set_signers_and_threshold_calldata); - set_contract_address(s1); + start_cheat_caller_address_global(s1); multisig .submit_transaction( multisig_address, @@ -666,19 +691,19 @@ fn test_recursive_set_signers_and_threshold() { ); // Signer 1 confirms the transaction - set_contract_address(s1); + start_cheat_caller_address_global(s1); multisig.confirm_transaction(0); // Signer 2 confirms the transaction - set_contract_address(s2); + start_cheat_caller_address_global(s2); multisig.confirm_transaction(0); // Signer 3 confirms the transaction - set_contract_address(s3); + start_cheat_caller_address_global(s3); multisig.confirm_transaction(0); // Once we have enough confirmations, we execute the transaction - set_contract_address(s1); + cheat_caller_address(multisig_address, s1, CheatSpan::TargetCalls(1)); multisig.execute_transaction(0); // Now we check that the signers were actually updated diff --git a/contracts/src/tests/test_ownable.cairo b/contracts/src/tests/test_ownable.cairo index 40e86c1c5..d898bbb73 100644 --- a/contracts/src/tests/test_ownable.cairo +++ b/contracts/src/tests/test_ownable.cairo @@ -8,6 +8,10 @@ use openzeppelin::access::ownable::interface::{ IOwnableTwoStep, IOwnableTwoStepDispatcher, IOwnableTwoStepDispatcherTrait }; +use snforge_std::{ + declare, ContractClassTrait, start_cheat_caller_address_global, stop_cheat_caller_address_global +}; + // // General ownable contract tests // @@ -20,13 +24,13 @@ fn should_implement_ownable(contract_addr: ContractAddress, owner: ContractAddre assert(owner == contract.owner(), 'owner does not match'); // transfer ownership - check owner unchanged and proposed owner set correctly - set_contract_address(owner); // required to call contract as owner + start_cheat_caller_address_global(owner); contract.transfer_ownership(acc2); assert(owner == contract.owner(), 'owner should remain unchanged'); assert(acc2 == contract.pending_owner(), 'acc2 should be proposed owner'); // accept ownership - check owner changed and proposed owner set to zero - set_contract_address(acc2); // required to call function as acc2 + start_cheat_caller_address_global(acc2); contract.accept_ownership(); assert(contract.owner() == acc2, 'failed to change ownership'); assert(contract.pending_owner().is_zero(), 'proposed owner should be zero'); diff --git a/contracts/src/tests/test_sequencer_uptime_feed.cairo b/contracts/src/tests/test_sequencer_uptime_feed.cairo index 51dabbd25..89696062a 100644 --- a/contracts/src/tests/test_sequencer_uptime_feed.cairo +++ b/contracts/src/tests/test_sequencer_uptime_feed.cairo @@ -29,6 +29,12 @@ use chainlink::emergency::sequencer_uptime_feed::{ ISequencerUptimeFeed, ISequencerUptimeFeedDispatcher, ISequencerUptimeFeedDispatcherTrait }; +use snforge_std::{ + declare, ContractClassTrait, start_cheat_caller_address_global, + stop_cheat_caller_address_global, DeclareResultTrait +}; + + fn PROXY() -> AggregatorProxy::ContractState { AggregatorProxy::contract_state_for_testing() } @@ -39,16 +45,20 @@ fn STATE() -> SequencerUptimeFeed::ContractState { fn setup() -> (ContractAddress, ContractAddress, ISequencerUptimeFeedDispatcher) { let account: ContractAddress = contract_address_const::<777>(); - set_caller_address(account); + + start_cheat_caller_address_global(account); // Deploy seqeuencer uptime feed let calldata = array![0, // initial status account.into() // owner ]; - let (sequencerFeedAddr, _) = deploy_syscall( - SequencerUptimeFeed::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false - ) + + let (sequencerFeedAddr, _) = declare("SequencerUptimeFeed") + .unwrap() + .contract_class() + .deploy(@calldata) .unwrap(); + let sequencerUptimeFeed = ISequencerUptimeFeedDispatcher { contract_address: sequencerFeedAddr }; @@ -69,16 +79,17 @@ fn test_access_control() { } #[test] -#[should_panic()] +#[should_panic] fn test_set_l1_sender_not_owner() { let (_, _, sequencerUptimeFeed) = setup(); + start_cheat_caller_address_global(contract_address_const::<111>()); sequencerUptimeFeed.set_l1_sender(EthAddress { address: 789 }); } #[test] fn test_set_l1_sender() { let (owner, _, sequencerUptimeFeed) = setup(); - set_contract_address(owner); + start_cheat_caller_address_global(owner); sequencerUptimeFeed.set_l1_sender(EthAddress { address: 789 }); assert(sequencerUptimeFeed.l1_sender().address == 789, 'l1_sender should be set to 789'); } @@ -104,8 +115,7 @@ fn test_latest_answer_no_access() { #[test] fn test_aggregator_proxy_response() { let (owner, sequencerFeedAddr, _) = setup(); - - set_contract_address(owner); + start_cheat_caller_address_global(owner); let contract = IAccessControllerDispatcher { contract_address: sequencerFeedAddr }; contract.add_access(owner); diff --git a/contracts/src/tests/test_upgradeable.cairo b/contracts/src/tests/test_upgradeable.cairo index 4d4213573..151f7ad17 100644 --- a/contracts/src/tests/test_upgradeable.cairo +++ b/contracts/src/tests/test_upgradeable.cairo @@ -16,9 +16,15 @@ use chainlink::libraries::mocks::mock_non_upgradeable::{ IMockNonUpgradeableDispatcherImpl }; +use snforge_std::{ + declare, ContractClassTrait, start_cheat_caller_address_global, + stop_cheat_caller_address_global, DeclareResultTrait +}; + + fn setup() -> ContractAddress { let account: ContractAddress = contract_address_const::<777>(); - set_caller_address(account); + start_cheat_caller_address_global(account); account } @@ -27,14 +33,22 @@ fn test_upgrade_and_call() { let _ = setup(); let calldata = array![]; - let (contractAddr, _) = deploy_syscall( - MockUpgradeable::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false - ) + + let (contractAddr, _) = declare("MockUpgradeable") + .unwrap() + .contract_class() + .deploy(@calldata) .unwrap(); + let mockUpgradeable = IMockUpgradeableDispatcher { contract_address: contractAddr }; assert(mockUpgradeable.foo() == true, 'should call foo'); - mockUpgradeable.upgrade(MockNonUpgradeable::TEST_CLASS_HASH.try_into().unwrap()); + // error: Type "snforge_std::cheatcodes::contract_class::DeclareResult" has no member + // "contract_class" + + let contract = declare("MockNonUpgradeable").unwrap().contract_class(); + + mockUpgradeable.upgrade(*(contract.class_hash)); // now, contract should be different let mockNonUpgradeable = IMockNonUpgradeableDispatcher { contract_address: contractAddr }; diff --git a/examples/contracts/aggregator_consumer/Scarb.lock b/examples/contracts/aggregator_consumer/Scarb.lock index 5e31f265b..36b34015d 100644 --- a/examples/contracts/aggregator_consumer/Scarb.lock +++ b/examples/contracts/aggregator_consumer/Scarb.lock @@ -9,10 +9,64 @@ dependencies = [ "snforge_std", ] +[[package]] +name = "alexandria_bytes" +version = "0.1.0" +source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +dependencies = [ + "alexandria_data_structures", + "alexandria_math", +] + +[[package]] +name = "alexandria_data_structures" +version = "0.2.0" +source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +dependencies = [ + "alexandria_encoding", +] + +[[package]] +name = "alexandria_encoding" +version = "0.1.0" +source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +dependencies = [ + "alexandria_bytes", + "alexandria_math", + "alexandria_numeric", +] + +[[package]] +name = "alexandria_math" +version = "0.2.0" +source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +dependencies = [ + "alexandria_data_structures", +] + +[[package]] +name = "alexandria_numeric" +version = "0.1.0" +source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +dependencies = [ + "alexandria_math", + "alexandria_searching", +] + +[[package]] +name = "alexandria_searching" +version = "0.1.0" +source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +dependencies = [ + "alexandria_data_structures", +] + [[package]] name = "chainlink" version = "0.1.0" dependencies = [ + "alexandria_bytes", + "alexandria_encoding", "openzeppelin", ] @@ -101,7 +155,15 @@ name = "openzeppelin_utils" version = "0.15.1" source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" +[[package]] +name = "snforge_scarb_plugin" +version = "0.1.0" +source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.28.0#4dfe39d96690ed6b3d56971512700de3f58288ea" + [[package]] name = "snforge_std" -version = "0.21.0" -source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.21.0#2996b8c1dd66b2715fc67e69578089f278a46790" +version = "0.28.0" +source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.28.0#4dfe39d96690ed6b3d56971512700de3f58288ea" +dependencies = [ + "snforge_scarb_plugin", +] diff --git a/examples/contracts/aggregator_consumer/Scarb.toml b/examples/contracts/aggregator_consumer/Scarb.toml index 13bd148e2..89039f7d0 100644 --- a/examples/contracts/aggregator_consumer/Scarb.toml +++ b/examples/contracts/aggregator_consumer/Scarb.toml @@ -8,12 +8,17 @@ name = "aggregator_consumer" version = "0.1.0" cairo-version = "2.7.1" +[scripts] +test = "snforge test" + # See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html [dependencies] -snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.21.0" } chainlink = { path = "../../../contracts" } -starknet = ">=2.7.1" +starknet = "2.7.1" + +[dev-dependencies] +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } [lib] diff --git a/examples/contracts/aggregator_consumer/scripts/Scarb.toml b/examples/contracts/aggregator_consumer/scripts/Scarb.toml index d29b2d515..d31f8eb34 100644 --- a/examples/contracts/aggregator_consumer/scripts/Scarb.toml +++ b/examples/contracts/aggregator_consumer/scripts/Scarb.toml @@ -6,10 +6,10 @@ cairo-version = "2.7.1" # See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html [dependencies] -sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.21.0" } +sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } chainlink = { path = "../../../../contracts" } aggregator_consumer = { path = "../" } -starknet = ">=2.7.1" +starknet = "2.7.1" [lib] casm = true diff --git a/examples/contracts/aggregator_consumer/tests/test_consumer.cairo b/examples/contracts/aggregator_consumer/tests/test_consumer.cairo index 31d86386c..40fc7a584 100644 --- a/examples/contracts/aggregator_consumer/tests/test_consumer.cairo +++ b/examples/contracts/aggregator_consumer/tests/test_consumer.cairo @@ -1,4 +1,4 @@ -use snforge_std::{declare, ContractClassTrait}; +use starknet::ContractAddress; use chainlink::ocr2::mocks::mock_aggregator::IMockAggregatorDispatcherTrait; use chainlink::ocr2::mocks::mock_aggregator::IMockAggregatorDispatcher; @@ -8,18 +8,29 @@ use chainlink::ocr2::aggregator_proxy::IAggregatorDispatcher; use aggregator_consumer::ocr2::consumer::IAggregatorConsumerDispatcherTrait; use aggregator_consumer::ocr2::consumer::IAggregatorConsumerDispatcher; -use starknet::ContractAddress; +use snforge_std::{declare, ContractClassTrait, DeclareResultTrait}; + fn deploy_mock_aggregator(decimals: u8) -> ContractAddress { let mut calldata = ArrayTrait::new(); calldata.append(decimals.into()); - return declare("MockAggregator").deploy(@calldata).unwrap(); + + let contract = declare("MockAggregator").unwrap().contract_class(); + + let (contract_address, _) = contract.deploy(@calldata).unwrap(); + + contract_address } fn deploy_consumer(aggregator_address: ContractAddress) -> ContractAddress { let mut calldata = ArrayTrait::new(); calldata.append(aggregator_address.into()); - return declare("AggregatorConsumer").deploy(@calldata).unwrap(); + + let contract = declare("AggregatorConsumer").unwrap().contract_class(); + + let (contract_address, _) = contract.deploy(@calldata).unwrap(); + + contract_address } #[test] @@ -79,7 +90,9 @@ fn test_set_and_read_answer() { let consumer_dispatcher = IAggregatorConsumerDispatcher { contract_address: consumer_address }; // Let's make sure the AggregatorConsumer was initialized correctly - assert(consumer_dispatcher.read_ocr_address() == mock_aggregator_address, 'Invalid OCR address'); + assert( + consumer_dispatcher.read_ocr_address() == mock_aggregator_address, 'Invalid OCR address' + ); assert(consumer_dispatcher.read_answer() == 0, 'Invalid initial answer'); // No round data has been initialized, so reading the latest round should return no data diff --git a/examples/contracts/aggregator_consumer/tests/test_price_consumer_with_sequencer.cairo b/examples/contracts/aggregator_consumer/tests/test_price_consumer_with_sequencer.cairo index 9582c8030..4e0fd6381 100644 --- a/examples/contracts/aggregator_consumer/tests/test_price_consumer_with_sequencer.cairo +++ b/examples/contracts/aggregator_consumer/tests/test_price_consumer_with_sequencer.cairo @@ -1,5 +1,3 @@ -use snforge_std::{declare, ContractClassTrait, start_prank, stop_prank, CheatTarget}; - use chainlink::emergency::sequencer_uptime_feed::ISequencerUptimeFeedDispatcherTrait; use chainlink::emergency::sequencer_uptime_feed::ISequencerUptimeFeedDispatcher; use chainlink::libraries::access_control::IAccessControllerDispatcherTrait; @@ -14,17 +12,32 @@ use starknet::contract_address_const; use starknet::get_caller_address; use starknet::ContractAddress; +use snforge_std::{ + declare, ContractClassTrait, start_cheat_caller_address_global, + stop_cheat_caller_address_global, DeclareResultTrait +}; + fn deploy_mock_aggregator(decimals: u8) -> ContractAddress { let mut calldata = ArrayTrait::new(); calldata.append(decimals.into()); - return declare("MockAggregator").deploy(@calldata).unwrap(); + let (contract_address, _) = declare("MockAggregator") + .unwrap() + .contract_class() + .deploy(@calldata) + .unwrap(); + contract_address } fn deploy_uptime_feed(initial_status: u128, owner_address: ContractAddress) -> ContractAddress { let mut calldata = ArrayTrait::new(); calldata.append(initial_status.into()); calldata.append(owner_address.into()); - return declare("SequencerUptimeFeed").deploy(@calldata).unwrap(); + let (contract_address, _) = declare("SequencerUptimeFeed") + .unwrap() + .contract_class() + .deploy(@calldata) + .unwrap(); + contract_address } fn deploy_price_consumer( @@ -33,7 +46,12 @@ fn deploy_price_consumer( let mut calldata = ArrayTrait::new(); calldata.append(uptime_feed_address.into()); calldata.append(aggregator_address.into()); - return declare("AggregatorPriceConsumer").deploy(@calldata).unwrap(); + let (contract_address, _) = declare("AggregatorPriceConsumer") + .unwrap() + .contract_class() + .deploy(@calldata) + .unwrap(); + contract_address } #[test] @@ -52,7 +70,8 @@ fn test_get_latest_price() { // Adds the price consumer contract to the sequencer uptime feed access control list // which allows the price consumer to call the get_latest_price function - start_prank(CheatTarget::All, owner); + start_cheat_caller_address_global(owner); + // start_prank(CheatTarget::All, owner); IAccessControllerDispatcher { contract_address: uptime_feed_address } .add_access(price_consumer_address); @@ -62,7 +81,8 @@ fn test_get_latest_price() { // a new round is initialized using its initial status as the round's answer, so the // latest price should be the initial status that was passed into the sequencer uptime // feed's constructor. - start_prank(CheatTarget::All, price_consumer_address); + start_cheat_caller_address_global(price_consumer_address); + // start_prank(CheatTarget::All, price_consumer_address); let latest_price = IAggregatorPriceConsumerDispatcher { contract_address: price_consumer_address } @@ -70,7 +90,7 @@ fn test_get_latest_price() { assert(latest_price == init_status, 'latest price is incorrect'); // Now let's update the round - stop_prank(CheatTarget::All); + stop_cheat_caller_address_global(); let answer = 1; let block_num = 12345; let observation_timestamp = 100000; @@ -79,7 +99,7 @@ fn test_get_latest_price() { .set_latest_round_data(answer, block_num, observation_timestamp, transmission_timestamp); // This should now return the updated answer - start_prank(CheatTarget::All, price_consumer_address); + start_cheat_caller_address_global(price_consumer_address); let updated_latest_price = IAggregatorPriceConsumerDispatcher { contract_address: price_consumer_address } diff --git a/integration-tests/go.mod b/integration-tests/go.mod index ed6d7b13b..d4911b59b 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -228,7 +228,7 @@ require ( github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/go-msgpack v0.5.5 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/go-plugin v1.6.0 // indirect + github.com/hashicorp/go-plugin v1.6.2-0.20240829161738-06afb6d7ae99 // indirect github.com/hashicorp/go-retryablehttp v0.7.5 // indirect github.com/hashicorp/go-rootcerts v1.0.2 // indirect github.com/hashicorp/go-sockaddr v1.0.2 // indirect @@ -474,9 +474,6 @@ require ( replace ( github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - // until merged upstream: https://github.com/hashicorp/go-plugin/pull/257 - github.com/hashicorp/go-plugin => github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 - // until merged upstream: https://github.com/mwitkow/grpc-proxy/pull/69 github.com/mwitkow/grpc-proxy => github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 4a71ac8e5..6fb5a7a70 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -854,6 +854,8 @@ github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHh github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-plugin v1.6.2-0.20240829161738-06afb6d7ae99 h1:OSQYEsRT3tRttZkk6zyC3aAaliwd7Loi/KgXgXxGtwA= +github.com/hashicorp/go-plugin v1.6.2-0.20240829161738-06afb6d7ae99/go.mod h1:CkgLQ5CZqNmdL9U9JzM532t8ZiYQ35+pj3b1FD37R0Q= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M= github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8= @@ -1412,8 +1414,6 @@ github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240708135824-bf github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240708135824-bf9122a8cee6/go.mod h1:+lAHs46edxC7o1bURJBQ81rR/ej6PYCGU8l8dOgNRnM= github.com/smartcontractkit/chainlink/v2 v2.10.0-beta0.0.20240708135824-bf9122a8cee6 h1:MHk1MDz1J0EzCH27UG9E+fT2tjddMSaoAXWxiOB2aBg= github.com/smartcontractkit/chainlink/v2 v2.10.0-beta0.0.20240708135824-bf9122a8cee6/go.mod h1:UJKJcHY0iLvmZyUU2tyPVqUmfzmgSVDVtgjwCX8cE5M= -github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss= -github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f/go.mod h1:MvMXoufZAtqExNexqi4cjrNYE9MefKddKylxjS+//n0= github.com/smartcontractkit/libocr v0.0.0-20240702141926-063ceef8c42e h1:9ypZ/8aW8Vm497i1gXHcT96oNLiu88jbg9QdX+IUE3E= diff --git a/monitoring/go.mod b/monitoring/go.mod index 9a152b2fa..b9bc07846 100644 --- a/monitoring/go.mod +++ b/monitoring/go.mod @@ -59,7 +59,7 @@ require ( github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/hashicorp/go-hclog v1.5.0 // indirect - github.com/hashicorp/go-plugin v1.6.0 // indirect + github.com/hashicorp/go-plugin v1.6.2-0.20240829161738-06afb6d7ae99 // indirect github.com/hashicorp/yamux v0.1.1 // indirect github.com/holiman/uint256 v1.2.4 // indirect github.com/invopop/jsonschema v0.12.0 // indirect @@ -72,7 +72,6 @@ require ( github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect - github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect @@ -126,9 +125,6 @@ require ( replace ( github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - // until merged upstream: https://github.com/hashicorp/go-plugin/pull/257 - github.com/hashicorp/go-plugin => github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 - // until merged upstream: https://github.com/mwitkow/grpc-proxy/pull/69 github.com/mwitkow/grpc-proxy => github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f diff --git a/monitoring/go.sum b/monitoring/go.sum index 4e7354312..ab4314b94 100644 --- a/monitoring/go.sum +++ b/monitoring/go.sum @@ -289,6 +289,8 @@ github.com/hashicorp/consul/sdk v0.16.0 h1:SE9m0W6DEfgIVCJX7xU+iv/hUl4m/nxqMTnCd github.com/hashicorp/consul/sdk v0.16.0/go.mod h1:7pxqqhqoaPqnBnzXD1StKed62LqJeClzVsUEy85Zr0A= github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-plugin v1.6.2-0.20240829161738-06afb6d7ae99 h1:OSQYEsRT3tRttZkk6zyC3aAaliwd7Loi/KgXgXxGtwA= +github.com/hashicorp/go-plugin v1.6.2-0.20240829161738-06afb6d7ae99/go.mod h1:CkgLQ5CZqNmdL9U9JzM532t8ZiYQ35+pj3b1FD37R0Q= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -385,8 +387,6 @@ github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQth github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8= github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= -github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= @@ -476,8 +476,6 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartcontractkit/chainlink-common v0.1.7-0.20240625074419-c278d083facf h1:d9AS/K8RSVG64USb20N/U7RaPOsYPcmuLGJq7iE+caM= github.com/smartcontractkit/chainlink-common v0.1.7-0.20240625074419-c278d083facf/go.mod h1:L32xvCpk84Nglit64OhySPMP1tM3TTBK7Tw0qZl7Sd4= -github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss= -github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f/go.mod h1:MvMXoufZAtqExNexqi4cjrNYE9MefKddKylxjS+//n0= github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c h1:lIyMbTaF2H0Q71vkwZHX/Ew4KF2BxiKhqEXwF8rn+KI= diff --git a/ops/go.mod b/ops/go.mod index e72fa7436..e53b99e37 100644 --- a/ops/go.mod +++ b/ops/go.mod @@ -139,9 +139,6 @@ require ( replace ( github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - // until merged upstream: https://github.com/hashicorp/go-plugin/pull/257 - github.com/hashicorp/go-plugin => github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 - // until merged upstream: https://github.com/mwitkow/grpc-proxy/pull/69 github.com/mwitkow/grpc-proxy => github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f diff --git a/relayer/go.mod b/relayer/go.mod index ea7b13a10..1e60d6bb5 100644 --- a/relayer/go.mod +++ b/relayer/go.mod @@ -8,7 +8,7 @@ require ( github.com/NethermindEth/juno v0.3.1 github.com/NethermindEth/starknet.go v0.7.1-0.20240401080518-34a506f3cfdb github.com/ethereum/go-ethereum v1.13.8 - github.com/hashicorp/go-plugin v1.6.0 + github.com/hashicorp/go-plugin v1.6.2-0.20240829161738-06afb6d7ae99 github.com/pelletier/go-toml/v2 v2.1.1 github.com/smartcontractkit/chainlink-common v0.1.7-0.20240625074419-c278d083facf github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c @@ -71,7 +71,6 @@ require ( github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect - github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/mr-tron/base58 v1.2.0 // indirect @@ -127,9 +126,6 @@ require ( replace ( github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 - // until merged upstream: https://github.com/hashicorp/go-plugin/pull/257 - github.com/hashicorp/go-plugin => github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 - // until merged upstream: https://github.com/mwitkow/grpc-proxy/pull/69 github.com/mwitkow/grpc-proxy => github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f diff --git a/relayer/go.sum b/relayer/go.sum index 896be704d..3255af922 100644 --- a/relayer/go.sum +++ b/relayer/go.sum @@ -273,6 +273,8 @@ github.com/hashicorp/consul/sdk v0.16.0 h1:SE9m0W6DEfgIVCJX7xU+iv/hUl4m/nxqMTnCd github.com/hashicorp/consul/sdk v0.16.0/go.mod h1:7pxqqhqoaPqnBnzXD1StKed62LqJeClzVsUEy85Zr0A= github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-plugin v1.6.2-0.20240829161738-06afb6d7ae99 h1:OSQYEsRT3tRttZkk6zyC3aAaliwd7Loi/KgXgXxGtwA= +github.com/hashicorp/go-plugin v1.6.2-0.20240829161738-06afb6d7ae99/go.mod h1:CkgLQ5CZqNmdL9U9JzM532t8ZiYQ35+pj3b1FD37R0Q= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= @@ -365,8 +367,6 @@ github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0/go.mod h1:QUyp042oQth github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i4n7wVopoX3x7Bv8= github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= -github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= @@ -447,8 +447,6 @@ github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFR github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/smartcontractkit/chainlink-common v0.1.7-0.20240625074419-c278d083facf h1:d9AS/K8RSVG64USb20N/U7RaPOsYPcmuLGJq7iE+caM= github.com/smartcontractkit/chainlink-common v0.1.7-0.20240625074419-c278d083facf/go.mod h1:L32xvCpk84Nglit64OhySPMP1tM3TTBK7Tw0qZl7Sd4= -github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss= -github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f/go.mod h1:MvMXoufZAtqExNexqi4cjrNYE9MefKddKylxjS+//n0= github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c h1:lIyMbTaF2H0Q71vkwZHX/Ew4KF2BxiKhqEXwF8rn+KI= From 845a6ff7b25ab3735d4b164b81a39fb839c44dd0 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Wed, 4 Sep 2024 11:41:01 -0400 Subject: [PATCH 05/28] use scarb fmt instead of cairo-format --- Makefile | 8 ++++---- .../scripts/src/mock_aggregator/set_latest_round.cairo | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 7cdd24af0..6fcb15f13 100644 --- a/Makefile +++ b/Makefile @@ -152,13 +152,13 @@ generate: mockery gomods .PHONY: format-cairo format-cairo: - cairo-format -i ./contracts/src/**/*.cairo - cairo-format -i ./examples/**/*.cairo + cd contracts && scarb fmt + cd examples/contracts/aggregator_consumer && scarb fmt .PHONY: format-cairo-check format-cairo-check: - cairo-format -c ./contracts/src/**/*.cairo - cairo-format -c ./examples/**/*.cairo + cd contracts && scarb fmt -c + cd examples/contracts/aggregator_consumer && scarb fmt -c .PHONY: format-ts format-ts: diff --git a/examples/contracts/aggregator_consumer/scripts/src/mock_aggregator/set_latest_round.cairo b/examples/contracts/aggregator_consumer/scripts/src/mock_aggregator/set_latest_round.cairo index d5a2a0150..8b853bd43 100644 --- a/examples/contracts/aggregator_consumer/scripts/src/mock_aggregator/set_latest_round.cairo +++ b/examples/contracts/aggregator_consumer/scripts/src/mock_aggregator/set_latest_round.cairo @@ -9,7 +9,7 @@ fn main() { .try_into() .unwrap(); - // Feel free to modify these + // Feel free to modify these let answer = 1; let block_num = 12345; let observation_timestamp = 1711716556; From 7f1e69763f7a2695ca140b84abc039f489188854 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Wed, 4 Sep 2024 11:49:47 -0400 Subject: [PATCH 06/28] update starknet-foundry ci/cd --- .github/actions/install-starknet-foundry/action.yml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/install-starknet-foundry/action.yml b/.github/actions/install-starknet-foundry/action.yml index 8e4360edf..c446229f6 100644 --- a/.github/actions/install-starknet-foundry/action.yml +++ b/.github/actions/install-starknet-foundry/action.yml @@ -4,7 +4,7 @@ description: A composite action that installs the snforge and sncast binaries inputs: starknet_foundry_version: description: Starknet Foundry release version - default: "0.27.0" + default: "0.28.0" required: false runs: diff --git a/Makefile b/Makefile index 6fcb15f13..ab561bac4 100644 --- a/Makefile +++ b/Makefile @@ -233,7 +233,7 @@ test-integration-soak-ci: .PHONY: test-examples test-examples: cd ./examples/contracts/aggregator_consumer && \ - snforge test + scarb test .PHONY: test-integration-gauntlet # TODO: fix example From 0d2546a6596a1501d9633f2b581256a8e5ea6ccb Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 11:32:07 -0400 Subject: [PATCH 07/28] bump scarb --- .tool-versions | 2 +- contracts/Scarb.toml | 4 ++-- examples/contracts/aggregator_consumer/Scarb.toml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.tool-versions b/.tool-versions index 2b2a6e5b6..f85babe49 100644 --- a/.tool-versions +++ b/.tool-versions @@ -9,7 +9,7 @@ mockery 2.22.1 golangci-lint 1.55.0 actionlint 1.6.12 shellcheck 0.8.0 -scarb 2.7.1 +scarb 2.8.2 postgres 15.1 starknet-foundry 0.28.0 diff --git a/contracts/Scarb.toml b/contracts/Scarb.toml index 90373988a..3cb489551 100644 --- a/contracts/Scarb.toml +++ b/contracts/Scarb.toml @@ -1,7 +1,7 @@ [package] name = "chainlink" version = "0.1.0" -cairo-version = "2.7.1" +cairo-version = "2.8.2" description = "Chainlink contracts for Starknet" homepage = "https://github.com/smartcontractkit/chainlink-starknet" @@ -13,7 +13,7 @@ test = "snforge test" # Uncomment if you want to use dependencies # Note: currently testing doesn't work with dependencies [dependencies] -starknet = "2.7.1" +starknet = "2.8.2" openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.15.1" } alexandria_bytes = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "e1b080577aaa6889116fc8be5dde72b2fd21e397" } alexandria_encoding = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "e1b080577aaa6889116fc8be5dde72b2fd21e397" } diff --git a/examples/contracts/aggregator_consumer/Scarb.toml b/examples/contracts/aggregator_consumer/Scarb.toml index b014b47e6..c1dfe621e 100644 --- a/examples/contracts/aggregator_consumer/Scarb.toml +++ b/examples/contracts/aggregator_consumer/Scarb.toml @@ -6,7 +6,7 @@ [package] name = "aggregator_consumer" version = "0.1.0" -cairo-version = "2.7.1" +cairo-version = "2.8.2" [scripts] test = "snforge test" @@ -18,7 +18,7 @@ test = "snforge test" [dependencies] chainlink = { path = "../../../contracts" } -starknet = "2.7.1" +starknet = "2.8.2" [dev-dependencies] snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } From 9e1d327a229107d6faeba3541cf7a885e481f474 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 11:35:15 -0400 Subject: [PATCH 08/28] try snforge directly --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ab561bac4..94f576867 100644 --- a/Makefile +++ b/Makefile @@ -233,7 +233,7 @@ test-integration-soak-ci: .PHONY: test-examples test-examples: cd ./examples/contracts/aggregator_consumer && \ - scarb test + snforge test .PHONY: test-integration-gauntlet # TODO: fix example @@ -271,7 +271,7 @@ build-cairo-contracts: .PHONY: test-cairo-contracts test-cairo-contracts: - cd contracts && scarb test + cd contracts && snforge test # TODO: this script needs to be replaced with a predefined K8s enviroment .PHONY: env-devnet-hardhat From d2c9f03b05b47e45d04e9c4503a5c09465afa23a Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 12:15:30 -0400 Subject: [PATCH 09/28] lets go? --- .tool-versions | 2 +- contracts/Scarb.lock | 12 +--- contracts/Scarb.toml | 2 +- .../src/tests/test_access_controller.cairo | 5 +- contracts/src/tests/test_aggregator.cairo | 22 ++----- .../src/tests/test_aggregator_proxy.cairo | 17 ++--- contracts/src/tests/test_erc677.cairo | 15 +---- contracts/src/tests/test_link_token.cairo | 5 +- contracts/src/tests/test_multisig.cairo | 64 ++++--------------- .../tests/test_sequencer_uptime_feed.cairo | 9 +-- contracts/src/tests/test_upgradeable.cairo | 13 ++-- .../contracts/aggregator_consumer/Scarb.toml | 2 +- .../consumer/deploy_aggregator_consumer.cairo | 3 +- .../deploy_mock_aggregator.cairo | 3 +- .../tests/test_consumer.cairo | 6 +- .../test_price_consumer_with_sequencer.cairo | 16 +---- 16 files changed, 46 insertions(+), 150 deletions(-) diff --git a/.tool-versions b/.tool-versions index f85babe49..3c09e539a 100644 --- a/.tool-versions +++ b/.tool-versions @@ -11,7 +11,7 @@ actionlint 1.6.12 shellcheck 0.8.0 scarb 2.8.2 postgres 15.1 -starknet-foundry 0.28.0 +starknet-foundry 0.27.0 # Kubernetes k3d 5.4.4 diff --git a/contracts/Scarb.lock b/contracts/Scarb.lock index 686309dcf..4f7feb312 100644 --- a/contracts/Scarb.lock +++ b/contracts/Scarb.lock @@ -148,15 +148,7 @@ name = "openzeppelin_utils" version = "0.15.1" source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" -[[package]] -name = "snforge_scarb_plugin" -version = "0.1.0" -source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.28.0#4dfe39d96690ed6b3d56971512700de3f58288ea" - [[package]] name = "snforge_std" -version = "0.28.0" -source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.28.0#4dfe39d96690ed6b3d56971512700de3f58288ea" -dependencies = [ - "snforge_scarb_plugin", -] +version = "0.27.0" +source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.27.0#2d99b7c00678ef0363881ee0273550c44a9263de" diff --git a/contracts/Scarb.toml b/contracts/Scarb.toml index 3cb489551..7fc6440dd 100644 --- a/contracts/Scarb.toml +++ b/contracts/Scarb.toml @@ -19,7 +19,7 @@ alexandria_bytes = { git = "https://github.com/keep-starknet-strange/alexandria. alexandria_encoding = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "e1b080577aaa6889116fc8be5dde72b2fd21e397" } [dev-dependencies] -snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" } [lib] diff --git a/contracts/src/tests/test_access_controller.cairo b/contracts/src/tests/test_access_controller.cairo index f2466f132..6746e1cf1 100644 --- a/contracts/src/tests/test_access_controller.cairo +++ b/contracts/src/tests/test_access_controller.cairo @@ -20,8 +20,7 @@ use chainlink::libraries::access_control::{ }; use snforge_std::{ - declare, ContractClassTrait, start_cheat_caller_address_global, - stop_cheat_caller_address_global, DeclareResultTrait + declare, ContractClassTrait, start_cheat_caller_address_global, stop_cheat_caller_address_global }; @@ -51,7 +50,7 @@ fn test_access_control() { let calldata = array![owner.into(), // owner ]; - let contract = declare("AccessController").unwrap().contract_class(); + let contract = declare("AccessController").unwrap(); let (accessControllerAddr, _) = contract.deploy(@calldata).unwrap(); diff --git a/contracts/src/tests/test_aggregator.cairo b/contracts/src/tests/test_aggregator.cairo index 6225a9564..518483304 100644 --- a/contracts/src/tests/test_aggregator.cairo +++ b/contracts/src/tests/test_aggregator.cairo @@ -27,8 +27,7 @@ use chainlink::tests::test_ownable::should_implement_ownable; use chainlink::tests::test_access_controller::should_implement_access_control; use snforge_std::{ - declare, ContractClassTrait, start_cheat_caller_address_global, - stop_cheat_caller_address_global, DeclareResultTrait + declare, ContractClassTrait, start_cheat_caller_address_global, stop_cheat_caller_address_global }; #[test] @@ -92,7 +91,6 @@ fn setup() -> ( let (billingAccessControllerAddr, _) = declare("AccessController") .unwrap() - .contract_class() .deploy(@calldata) .unwrap(); @@ -105,11 +103,7 @@ fn setup() -> ( acc1.into(), // owner = acc1; ]; - let (linkTokenAddr, _) = declare("LinkToken") - .unwrap() - .contract_class() - .deploy(@calldata) - .unwrap(); + let (linkTokenAddr, _) = declare("LinkToken").unwrap().deploy(@calldata).unwrap(); let linkToken = ILinkTokenDispatcher { contract_address: linkTokenAddr }; @@ -131,11 +125,7 @@ fn test_ownable() { 123, // description ]; - let (aggregatorAddr, _) = declare("Aggregator") - .unwrap() - .contract_class() - .deploy(@calldata) - .unwrap(); + let (aggregatorAddr, _) = declare("Aggregator").unwrap().deploy(@calldata).unwrap(); should_implement_ownable(aggregatorAddr, account); } @@ -154,11 +144,7 @@ fn test_access_control() { 123, // description ]; - let (aggregatorAddr, _) = declare("Aggregator") - .unwrap() - .contract_class() - .deploy(@calldata) - .unwrap(); + let (aggregatorAddr, _) = declare("Aggregator").unwrap().deploy(@calldata).unwrap(); // let (aggregatorAddr, _) = deploy_syscall( // Aggregator::TEST_CLASS_HASH.try_into().unwrap(), 0, calldata.span(), false diff --git a/contracts/src/tests/test_aggregator_proxy.cairo b/contracts/src/tests/test_aggregator_proxy.cairo index 3a586dc44..d4d610e00 100644 --- a/contracts/src/tests/test_aggregator_proxy.cairo +++ b/contracts/src/tests/test_aggregator_proxy.cairo @@ -25,8 +25,7 @@ use chainlink::tests::test_ownable::should_implement_ownable; use chainlink::tests::test_access_controller::should_implement_access_control; use snforge_std::{ - declare, ContractClassTrait, start_cheat_caller_address_global, - stop_cheat_caller_address_global, DeclareResultTrait + declare, ContractClassTrait, start_cheat_caller_address_global, stop_cheat_caller_address_global }; @@ -50,7 +49,7 @@ fn setup() -> ( let mut calldata = ArrayTrait::new(); calldata.append(8); // decimals = 8 - let contract = declare("MockAggregator").unwrap().contract_class(); + let contract = declare("MockAggregator").unwrap(); let (mockAggregatorAddr1, _) = contract.deploy(@calldata).unwrap(); @@ -77,11 +76,7 @@ fn test_ownable() { // Deploy aggregator proxy let calldata = array![account.into(), // owner = account mockAggregatorAddr.into(),]; - let (aggregatorProxyAddr, _) = declare("AggregatorProxy") - .unwrap() - .contract_class() - .deploy(@calldata) - .unwrap(); + let (aggregatorProxyAddr, _) = declare("AggregatorProxy").unwrap().deploy(@calldata).unwrap(); should_implement_ownable(aggregatorProxyAddr, account); } @@ -93,11 +88,7 @@ fn test_access_control() { let calldata = array![account.into(), // owner = account mockAggregatorAddr.into(),]; - let (aggregatorProxyAddr, _) = declare("AggregatorProxy") - .unwrap() - .contract_class() - .deploy(@calldata) - .unwrap(); + let (aggregatorProxyAddr, _) = declare("AggregatorProxy").unwrap().deploy(@calldata).unwrap(); should_implement_access_control(aggregatorProxyAddr, account); } diff --git a/contracts/src/tests/test_erc677.cairo b/contracts/src/tests/test_erc677.cairo index ecb36b7a5..ac7d72031 100644 --- a/contracts/src/tests/test_erc677.cairo +++ b/contracts/src/tests/test_erc677.cairo @@ -17,8 +17,7 @@ use chainlink::libraries::token::erc677::ERC677Component; use chainlink::libraries::token::erc677::ERC677Component::ERC677Impl; use snforge_std::{ - declare, ContractClassTrait, start_cheat_caller_address_global, - stop_cheat_caller_address_global, DeclareResultTrait + declare, ContractClassTrait, start_cheat_caller_address_global, stop_cheat_caller_address_global }; #[starknet::interface] @@ -43,11 +42,7 @@ fn setup() -> ContractAddress { fn setup_valid_receiver() -> (ContractAddress, MockValidReceiverDispatcher) { let calldata = ArrayTrait::new(); - let (address, _) = declare("ValidReceiver") - .unwrap() - .contract_class() - .deploy(@calldata) - .unwrap(); + let (address, _) = declare("ValidReceiver").unwrap().deploy(@calldata).unwrap(); let contract = MockValidReceiverDispatcher { contract_address: address }; (address, contract) @@ -57,11 +52,7 @@ fn setup_valid_receiver() -> (ContractAddress, MockValidReceiverDispatcher) { fn setup_invalid_receiver() -> (ContractAddress, MockInvalidReceiverDispatcher) { let calldata = ArrayTrait::new(); - let (address, _) = declare("InvalidReceiver") - .unwrap() - .contract_class() - .deploy(@calldata) - .unwrap(); + let (address, _) = declare("InvalidReceiver").unwrap().deploy(@calldata).unwrap(); let contract = MockInvalidReceiverDispatcher { contract_address: address }; (address, contract) diff --git a/contracts/src/tests/test_link_token.cairo b/contracts/src/tests/test_link_token.cairo index 709bc6413..6cf08baa5 100644 --- a/contracts/src/tests/test_link_token.cairo +++ b/contracts/src/tests/test_link_token.cairo @@ -18,8 +18,7 @@ use openzeppelin::token::erc20::ERC20Component::{ERC20Impl, ERC20MetadataImpl}; use chainlink::tests::test_ownable::should_implement_ownable; use snforge_std::{ - declare, ContractClassTrait, start_cheat_caller_address_global, - stop_cheat_caller_address_global, DeclareResultTrait + declare, ContractClassTrait, start_cheat_caller_address_global, stop_cheat_caller_address_global }; @@ -45,7 +44,7 @@ fn test_ownable() { calldata.append(class_hash_const::<123>().into()); // minter calldata.append(account.into()); // owner - let (linkAddr, _) = declare("LinkToken").unwrap().contract_class().deploy(@calldata).unwrap(); + let (linkAddr, _) = declare("LinkToken").unwrap().deploy(@calldata).unwrap(); should_implement_ownable(linkAddr, account); } diff --git a/contracts/src/tests/test_multisig.cairo b/contracts/src/tests/test_multisig.cairo index 499eb7fe1..8da361d7e 100644 --- a/contracts/src/tests/test_multisig.cairo +++ b/contracts/src/tests/test_multisig.cairo @@ -19,7 +19,7 @@ use chainlink::multisig::{IMultisigDispatcher}; use snforge_std::{ declare, ContractClassTrait, start_cheat_caller_address_global, - stop_cheat_caller_address_global, cheat_caller_address, CheatSpan, DeclareResultTrait + stop_cheat_caller_address_global, cheat_caller_address, CheatSpan }; fn STATE() -> Multisig::ContractState { @@ -123,7 +123,7 @@ fn test_submit_transaction() { assert(transaction.calldata_len == sample_calldata().len(), 'should match calldata length'); assert(!transaction.executed, 'should not be executed'); assert(transaction.confirmations == 0, 'should not have confirmations'); - // TODO: compare calldata when loops are supported +// TODO: compare calldata when loops are supported } #[test] @@ -274,11 +274,7 @@ fn test_execute() { let calldata = ArrayTrait::new(); - let (test_address, _) = declare("MockMultisigTarget") - .unwrap() - .contract_class() - .deploy(@calldata) - .unwrap(); + let (test_address, _) = declare("MockMultisigTarget").unwrap().deploy(@calldata).unwrap(); start_cheat_caller_address_global(signer1); let increment_calldata = array![42, 100]; @@ -335,11 +331,7 @@ fn test_execute_after_set_signers() { Serde::serialize(@signers, ref deploy_calldata); Serde::serialize(@init_threshold, ref deploy_calldata); - let (multisig_address, _) = declare("Multisig") - .unwrap() - .contract_class() - .deploy(@deploy_calldata) - .unwrap(); + let (multisig_address, _) = declare("Multisig").unwrap().deploy(@deploy_calldata).unwrap(); let multisig = IMultisigDispatcher { contract_address: multisig_address }; @@ -371,11 +363,7 @@ fn test_execute_after_set_signers_and_threshold() { Serde::serialize(@signers, ref deploy_calldata); Serde::serialize(@init_threshold, ref deploy_calldata); - let (multisig_address, _) = declare("Multisig") - .unwrap() - .contract_class() - .deploy(@deploy_calldata) - .unwrap(); + let (multisig_address, _) = declare("Multisig").unwrap().deploy(@deploy_calldata).unwrap(); let multisig = IMultisigDispatcher { contract_address: multisig_address }; @@ -407,11 +395,7 @@ fn test_execute_after_set_threshold() { Serde::serialize(@signers, ref deploy_calldata); Serde::serialize(@init_threshold, ref deploy_calldata); - let (multisig_address, _) = declare("Multisig") - .unwrap() - .contract_class() - .deploy(@deploy_calldata) - .unwrap(); + let (multisig_address, _) = declare("Multisig").unwrap().deploy(@deploy_calldata).unwrap(); let multisig = IMultisigDispatcher { contract_address: multisig_address }; @@ -443,11 +427,7 @@ fn test_set_threshold() { Serde::serialize(@signers, ref deploy_calldata); Serde::serialize(@init_threshold, ref deploy_calldata); - let (multisig_address, _) = declare("Multisig") - .unwrap() - .contract_class() - .deploy(@deploy_calldata) - .unwrap(); + let (multisig_address, _) = declare("Multisig").unwrap().deploy(@deploy_calldata).unwrap(); let multisig = IMultisigDispatcher { contract_address: multisig_address }; assert(multisig.get_threshold() == init_threshold, 'invalid init threshold'); @@ -471,11 +451,7 @@ fn test_recursive_set_threshold() { Serde::serialize(@signers, ref deploy_calldata); Serde::serialize(@init_threshold, ref deploy_calldata); - let (multisig_address, _) = declare("Multisig") - .unwrap() - .contract_class() - .deploy(@deploy_calldata) - .unwrap(); + let (multisig_address, _) = declare("Multisig").unwrap().deploy(@deploy_calldata).unwrap(); // Gets a dispatcher (so we can call methods on the deployed contract) let multisig = IMultisigDispatcher { contract_address: multisig_address }; @@ -521,11 +497,7 @@ fn test_set_signers() { Serde::serialize(@init_signers, ref deploy_calldata); Serde::serialize(@threshold, ref deploy_calldata); - let (multisig_address, _) = declare("Multisig") - .unwrap() - .contract_class() - .deploy(@deploy_calldata) - .unwrap(); + let (multisig_address, _) = declare("Multisig").unwrap().deploy(@deploy_calldata).unwrap(); let multisig = IMultisigDispatcher { contract_address: multisig_address }; @@ -559,11 +531,7 @@ fn test_recursive_set_signers() { Serde::serialize(@init_signers, ref deploy_calldata); Serde::serialize(@init_threshold, ref deploy_calldata); - let (multisig_address, _) = declare("Multisig") - .unwrap() - .contract_class() - .deploy(@deploy_calldata) - .unwrap(); + let (multisig_address, _) = declare("Multisig").unwrap().deploy(@deploy_calldata).unwrap(); // Gets a dispatcher (so we can call methods on the deployed contract) let multisig = IMultisigDispatcher { contract_address: multisig_address }; @@ -617,11 +585,7 @@ fn test_set_signers_and_threshold() { Serde::serialize(@init_signers, ref deploy_calldata); Serde::serialize(@init_threshold, ref deploy_calldata); - let (multisig_address, _) = declare("Multisig") - .unwrap() - .contract_class() - .deploy(@deploy_calldata) - .unwrap(); + let (multisig_address, _) = declare("Multisig").unwrap().deploy(@deploy_calldata).unwrap(); let multisig = IMultisigDispatcher { contract_address: multisig_address }; @@ -659,11 +623,7 @@ fn test_recursive_set_signers_and_threshold() { Serde::serialize(@init_signers, ref deploy_calldata); Serde::serialize(@init_threshold, ref deploy_calldata); - let (multisig_address, _) = declare("Multisig") - .unwrap() - .contract_class() - .deploy(@deploy_calldata) - .unwrap(); + let (multisig_address, _) = declare("Multisig").unwrap().deploy(@deploy_calldata).unwrap(); // Gets a dispatcher (so we can call methods on the deployed contract) let multisig = IMultisigDispatcher { contract_address: multisig_address }; diff --git a/contracts/src/tests/test_sequencer_uptime_feed.cairo b/contracts/src/tests/test_sequencer_uptime_feed.cairo index e99d3b4c4..0f09f7ecc 100644 --- a/contracts/src/tests/test_sequencer_uptime_feed.cairo +++ b/contracts/src/tests/test_sequencer_uptime_feed.cairo @@ -30,8 +30,7 @@ use chainlink::emergency::sequencer_uptime_feed::{ }; use snforge_std::{ - declare, ContractClassTrait, start_cheat_caller_address_global, - stop_cheat_caller_address_global, DeclareResultTrait + declare, ContractClassTrait, start_cheat_caller_address_global, stop_cheat_caller_address_global }; @@ -53,11 +52,7 @@ fn setup() -> (ContractAddress, ContractAddress, ISequencerUptimeFeedDispatcher) account.into() // owner ]; - let (sequencerFeedAddr, _) = declare("SequencerUptimeFeed") - .unwrap() - .contract_class() - .deploy(@calldata) - .unwrap(); + let (sequencerFeedAddr, _) = declare("SequencerUptimeFeed").unwrap().deploy(@calldata).unwrap(); let sequencerUptimeFeed = ISequencerUptimeFeedDispatcher { contract_address: sequencerFeedAddr diff --git a/contracts/src/tests/test_upgradeable.cairo b/contracts/src/tests/test_upgradeable.cairo index 6f2a56e44..78be014fa 100644 --- a/contracts/src/tests/test_upgradeable.cairo +++ b/contracts/src/tests/test_upgradeable.cairo @@ -17,8 +17,7 @@ use chainlink::libraries::mocks::mock_non_upgradeable::{ }; use snforge_std::{ - declare, ContractClassTrait, start_cheat_caller_address_global, - stop_cheat_caller_address_global, DeclareResultTrait + declare, ContractClassTrait, start_cheat_caller_address_global, stop_cheat_caller_address_global }; @@ -34,18 +33,14 @@ fn test_upgrade_and_call() { let calldata = array![]; - let (contractAddr, _) = declare("MockUpgradeable") - .unwrap() - .contract_class() - .deploy(@calldata) - .unwrap(); + let (contractAddr, _) = declare("MockUpgradeable").unwrap().deploy(@calldata).unwrap(); let mockUpgradeable = IMockUpgradeableDispatcher { contract_address: contractAddr }; assert(mockUpgradeable.foo() == true, 'should call foo'); - let contract = declare("MockNonUpgradeable").unwrap().contract_class(); + let contract = declare("MockNonUpgradeable").unwrap(); - mockUpgradeable.upgrade(*(contract.class_hash)); + mockUpgradeable.upgrade(contract.class_hash); // now, contract should be different let mockNonUpgradeable = IMockNonUpgradeableDispatcher { contract_address: contractAddr }; diff --git a/examples/contracts/aggregator_consumer/Scarb.toml b/examples/contracts/aggregator_consumer/Scarb.toml index c1dfe621e..9653f6ae9 100644 --- a/examples/contracts/aggregator_consumer/Scarb.toml +++ b/examples/contracts/aggregator_consumer/Scarb.toml @@ -21,7 +21,7 @@ chainlink = { path = "../../../contracts" } starknet = "2.8.2" [dev-dependencies] -snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" } [lib] diff --git a/examples/contracts/aggregator_consumer/scripts/src/consumer/deploy_aggregator_consumer.cairo b/examples/contracts/aggregator_consumer/scripts/src/consumer/deploy_aggregator_consumer.cairo index 4d55a13db..e59eac858 100644 --- a/examples/contracts/aggregator_consumer/scripts/src/consumer/deploy_aggregator_consumer.cairo +++ b/examples/contracts/aggregator_consumer/scripts/src/consumer/deploy_aggregator_consumer.cairo @@ -1,6 +1,5 @@ use sncast_std::{ - declare, deploy, DeclareResult, DeployResult, get_nonce, DisplayContractAddress, - DisplayClassHash + declare, deploy, DeployResult, get_nonce, DisplayContractAddress, DisplayClassHash }; use starknet::{ContractAddress, ClassHash}; diff --git a/examples/contracts/aggregator_consumer/scripts/src/mock_aggregator/deploy_mock_aggregator.cairo b/examples/contracts/aggregator_consumer/scripts/src/mock_aggregator/deploy_mock_aggregator.cairo index e3ab4e9a6..0282d8aed 100644 --- a/examples/contracts/aggregator_consumer/scripts/src/mock_aggregator/deploy_mock_aggregator.cairo +++ b/examples/contracts/aggregator_consumer/scripts/src/mock_aggregator/deploy_mock_aggregator.cairo @@ -1,6 +1,5 @@ use sncast_std::{ - declare, deploy, DeclareResult, DeployResult, get_nonce, DisplayContractAddress, - DisplayClassHash + declare, deploy, DeployResult, get_nonce, DisplayContractAddress, DisplayClassHash }; use starknet::{ContractAddress, ClassHash}; diff --git a/examples/contracts/aggregator_consumer/tests/test_consumer.cairo b/examples/contracts/aggregator_consumer/tests/test_consumer.cairo index 6cd305c8c..46a303d9c 100644 --- a/examples/contracts/aggregator_consumer/tests/test_consumer.cairo +++ b/examples/contracts/aggregator_consumer/tests/test_consumer.cairo @@ -8,14 +8,14 @@ use chainlink::ocr2::aggregator_proxy::IAggregatorDispatcher; use aggregator_consumer::ocr2::consumer::IAggregatorConsumerDispatcherTrait; use aggregator_consumer::ocr2::consumer::IAggregatorConsumerDispatcher; -use snforge_std::{declare, ContractClassTrait, DeclareResultTrait}; +use snforge_std::{declare, ContractClassTrait}; fn deploy_mock_aggregator(decimals: u8) -> ContractAddress { let mut calldata = ArrayTrait::new(); calldata.append(decimals.into()); - let contract = declare("MockAggregator").unwrap().contract_class(); + let contract = declare("MockAggregator").unwrap(); let (contract_address, _) = contract.deploy(@calldata).unwrap(); @@ -26,7 +26,7 @@ fn deploy_consumer(aggregator_address: ContractAddress) -> ContractAddress { let mut calldata = ArrayTrait::new(); calldata.append(aggregator_address.into()); - let contract = declare("AggregatorConsumer").unwrap().contract_class(); + let contract = declare("AggregatorConsumer").unwrap(); let (contract_address, _) = contract.deploy(@calldata).unwrap(); diff --git a/examples/contracts/aggregator_consumer/tests/test_price_consumer_with_sequencer.cairo b/examples/contracts/aggregator_consumer/tests/test_price_consumer_with_sequencer.cairo index 0b59e0243..f379883f9 100644 --- a/examples/contracts/aggregator_consumer/tests/test_price_consumer_with_sequencer.cairo +++ b/examples/contracts/aggregator_consumer/tests/test_price_consumer_with_sequencer.cairo @@ -13,18 +13,13 @@ use starknet::get_caller_address; use starknet::ContractAddress; use snforge_std::{ - declare, ContractClassTrait, start_cheat_caller_address_global, - stop_cheat_caller_address_global, DeclareResultTrait + declare, ContractClassTrait, start_cheat_caller_address_global, stop_cheat_caller_address_global }; fn deploy_mock_aggregator(decimals: u8) -> ContractAddress { let mut calldata = ArrayTrait::new(); calldata.append(decimals.into()); - let (contract_address, _) = declare("MockAggregator") - .unwrap() - .contract_class() - .deploy(@calldata) - .unwrap(); + let (contract_address, _) = declare("MockAggregator").unwrap().deploy(@calldata).unwrap(); contract_address } @@ -32,11 +27,7 @@ fn deploy_uptime_feed(initial_status: u128, owner_address: ContractAddress) -> C let mut calldata = ArrayTrait::new(); calldata.append(initial_status.into()); calldata.append(owner_address.into()); - let (contract_address, _) = declare("SequencerUptimeFeed") - .unwrap() - .contract_class() - .deploy(@calldata) - .unwrap(); + let (contract_address, _) = declare("SequencerUptimeFeed").unwrap().deploy(@calldata).unwrap(); contract_address } @@ -48,7 +39,6 @@ fn deploy_price_consumer( calldata.append(aggregator_address.into()); let (contract_address, _) = declare("AggregatorPriceConsumer") .unwrap() - .contract_class() .deploy(@calldata) .unwrap(); contract_address From 15b9e5208bce5b29bd30bf8c76e6ed2a70a13ebe Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 12:17:26 -0400 Subject: [PATCH 10/28] bump --- .github/actions/install-cairo/action.yml | 4 ++-- .github/actions/install-starknet-foundry/action.yml | 2 +- examples/contracts/aggregator_consumer/scripts/Scarb.toml | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/install-cairo/action.yml b/.github/actions/install-cairo/action.yml index 098f1bdc2..7786ca9a1 100644 --- a/.github/actions/install-cairo/action.yml +++ b/.github/actions/install-cairo/action.yml @@ -4,11 +4,11 @@ description: A composite action that installs cairo and scarb binaries inputs: cairo_version: description: Cairo release version - default: "v2.7.1" + default: "v2.8.2" required: false scarb_version: description: Scarb release version - default: "v2.7.1" + default: "v2.8.2" required: false runs: diff --git a/.github/actions/install-starknet-foundry/action.yml b/.github/actions/install-starknet-foundry/action.yml index c446229f6..8e4360edf 100644 --- a/.github/actions/install-starknet-foundry/action.yml +++ b/.github/actions/install-starknet-foundry/action.yml @@ -4,7 +4,7 @@ description: A composite action that installs the snforge and sncast binaries inputs: starknet_foundry_version: description: Starknet Foundry release version - default: "0.28.0" + default: "0.27.0" required: false runs: diff --git a/examples/contracts/aggregator_consumer/scripts/Scarb.toml b/examples/contracts/aggregator_consumer/scripts/Scarb.toml index d31f8eb34..bba6d3a34 100644 --- a/examples/contracts/aggregator_consumer/scripts/Scarb.toml +++ b/examples/contracts/aggregator_consumer/scripts/Scarb.toml @@ -1,15 +1,15 @@ [package] name = "src" version = "0.1.0" -cairo-version = "2.7.1" +cairo-version = "2.8.2" # See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html [dependencies] -sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.28.0" } +sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" } chainlink = { path = "../../../../contracts" } aggregator_consumer = { path = "../" } -starknet = "2.7.1" +starknet = "2.8.2" [lib] casm = true From 06a1c343b10f07dbf1d4ab6e12359f331b874598 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 12:22:31 -0400 Subject: [PATCH 11/28] 2.7.1 --- .github/actions/install-cairo/action.yml | 4 ++-- .tool-versions | 2 +- contracts/Scarb.toml | 4 ++-- examples/contracts/aggregator_consumer/Scarb.toml | 4 ++-- examples/contracts/aggregator_consumer/scripts/Scarb.toml | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/actions/install-cairo/action.yml b/.github/actions/install-cairo/action.yml index 7786ca9a1..098f1bdc2 100644 --- a/.github/actions/install-cairo/action.yml +++ b/.github/actions/install-cairo/action.yml @@ -4,11 +4,11 @@ description: A composite action that installs cairo and scarb binaries inputs: cairo_version: description: Cairo release version - default: "v2.8.2" + default: "v2.7.1" required: false scarb_version: description: Scarb release version - default: "v2.8.2" + default: "v2.7.1" required: false runs: diff --git a/.tool-versions b/.tool-versions index 3c09e539a..9a84c1a92 100644 --- a/.tool-versions +++ b/.tool-versions @@ -9,7 +9,7 @@ mockery 2.22.1 golangci-lint 1.55.0 actionlint 1.6.12 shellcheck 0.8.0 -scarb 2.8.2 +scarb 2.7.1 postgres 15.1 starknet-foundry 0.27.0 diff --git a/contracts/Scarb.toml b/contracts/Scarb.toml index 7fc6440dd..e56fd8522 100644 --- a/contracts/Scarb.toml +++ b/contracts/Scarb.toml @@ -1,7 +1,7 @@ [package] name = "chainlink" version = "0.1.0" -cairo-version = "2.8.2" +cairo-version = "2.7.1" description = "Chainlink contracts for Starknet" homepage = "https://github.com/smartcontractkit/chainlink-starknet" @@ -13,7 +13,7 @@ test = "snforge test" # Uncomment if you want to use dependencies # Note: currently testing doesn't work with dependencies [dependencies] -starknet = "2.8.2" +starknet = "2.7.1" openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.15.1" } alexandria_bytes = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "e1b080577aaa6889116fc8be5dde72b2fd21e397" } alexandria_encoding = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "e1b080577aaa6889116fc8be5dde72b2fd21e397" } diff --git a/examples/contracts/aggregator_consumer/Scarb.toml b/examples/contracts/aggregator_consumer/Scarb.toml index 9653f6ae9..44468fe75 100644 --- a/examples/contracts/aggregator_consumer/Scarb.toml +++ b/examples/contracts/aggregator_consumer/Scarb.toml @@ -6,7 +6,7 @@ [package] name = "aggregator_consumer" version = "0.1.0" -cairo-version = "2.8.2" +cairo-version = "2.7.1" [scripts] test = "snforge test" @@ -18,7 +18,7 @@ test = "snforge test" [dependencies] chainlink = { path = "../../../contracts" } -starknet = "2.8.2" +starknet = "2.7.1" [dev-dependencies] snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" } diff --git a/examples/contracts/aggregator_consumer/scripts/Scarb.toml b/examples/contracts/aggregator_consumer/scripts/Scarb.toml index bba6d3a34..b1a02bc7a 100644 --- a/examples/contracts/aggregator_consumer/scripts/Scarb.toml +++ b/examples/contracts/aggregator_consumer/scripts/Scarb.toml @@ -1,7 +1,7 @@ [package] name = "src" version = "0.1.0" -cairo-version = "2.8.2" +cairo-version = "2.7.1" # See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html @@ -9,7 +9,7 @@ cairo-version = "2.8.2" sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" } chainlink = { path = "../../../../contracts" } aggregator_consumer = { path = "../" } -starknet = "2.8.2" +starknet = "2.7.1" [lib] casm = true From ad84e371841a6fdc9a5de4483c92a674e4c3e257 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 12:34:54 -0400 Subject: [PATCH 12/28] try 2.8.0 --- .github/actions/install-cairo/action.yml | 4 ++-- .tool-versions | 2 +- contracts/Scarb.toml | 4 ++-- examples/contracts/aggregator_consumer/Scarb.toml | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/actions/install-cairo/action.yml b/.github/actions/install-cairo/action.yml index 098f1bdc2..4feae653d 100644 --- a/.github/actions/install-cairo/action.yml +++ b/.github/actions/install-cairo/action.yml @@ -4,11 +4,11 @@ description: A composite action that installs cairo and scarb binaries inputs: cairo_version: description: Cairo release version - default: "v2.7.1" + default: "v2.8.0" required: false scarb_version: description: Scarb release version - default: "v2.7.1" + default: "v2.8.0" required: false runs: diff --git a/.tool-versions b/.tool-versions index 9a84c1a92..ce0a83b40 100644 --- a/.tool-versions +++ b/.tool-versions @@ -9,7 +9,7 @@ mockery 2.22.1 golangci-lint 1.55.0 actionlint 1.6.12 shellcheck 0.8.0 -scarb 2.7.1 +scarb 2.8.0 postgres 15.1 starknet-foundry 0.27.0 diff --git a/contracts/Scarb.toml b/contracts/Scarb.toml index e56fd8522..09cba991a 100644 --- a/contracts/Scarb.toml +++ b/contracts/Scarb.toml @@ -1,7 +1,7 @@ [package] name = "chainlink" version = "0.1.0" -cairo-version = "2.7.1" +cairo-version = "2.8.0" description = "Chainlink contracts for Starknet" homepage = "https://github.com/smartcontractkit/chainlink-starknet" @@ -13,7 +13,7 @@ test = "snforge test" # Uncomment if you want to use dependencies # Note: currently testing doesn't work with dependencies [dependencies] -starknet = "2.7.1" +starknet = "2.8.0" openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.15.1" } alexandria_bytes = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "e1b080577aaa6889116fc8be5dde72b2fd21e397" } alexandria_encoding = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "e1b080577aaa6889116fc8be5dde72b2fd21e397" } diff --git a/examples/contracts/aggregator_consumer/Scarb.toml b/examples/contracts/aggregator_consumer/Scarb.toml index 44468fe75..31b2fc747 100644 --- a/examples/contracts/aggregator_consumer/Scarb.toml +++ b/examples/contracts/aggregator_consumer/Scarb.toml @@ -6,7 +6,7 @@ [package] name = "aggregator_consumer" version = "0.1.0" -cairo-version = "2.7.1" +cairo-version = "2.8.0" [scripts] test = "snforge test" @@ -18,7 +18,7 @@ test = "snforge test" [dependencies] chainlink = { path = "../../../contracts" } -starknet = "2.7.1" +starknet = "2.8.0" [dev-dependencies] snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" } From d4ffd5d70ce302d0613610f93ac02f36d2e38128 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 12:44:20 -0400 Subject: [PATCH 13/28] remove dev-deps --- examples/contracts/aggregator_consumer/Scarb.toml | 2 -- examples/contracts/aggregator_consumer/scripts/Scarb.toml | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/examples/contracts/aggregator_consumer/Scarb.toml b/examples/contracts/aggregator_consumer/Scarb.toml index 31b2fc747..b6983bc1b 100644 --- a/examples/contracts/aggregator_consumer/Scarb.toml +++ b/examples/contracts/aggregator_consumer/Scarb.toml @@ -19,8 +19,6 @@ test = "snforge test" [dependencies] chainlink = { path = "../../../contracts" } starknet = "2.8.0" - -[dev-dependencies] snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" } [lib] diff --git a/examples/contracts/aggregator_consumer/scripts/Scarb.toml b/examples/contracts/aggregator_consumer/scripts/Scarb.toml index b1a02bc7a..3dde80083 100644 --- a/examples/contracts/aggregator_consumer/scripts/Scarb.toml +++ b/examples/contracts/aggregator_consumer/scripts/Scarb.toml @@ -1,15 +1,15 @@ [package] name = "src" version = "0.1.0" -cairo-version = "2.7.1" +cairo-version = "2.8.0" # See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html [dependencies] -sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" } +sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.2.0" } chainlink = { path = "../../../../contracts" } aggregator_consumer = { path = "../" } -starknet = "2.7.1" +starknet = "2.8.0" [lib] casm = true From 7dfa8710f3713ba58a3b665fb138df6066e671a4 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 12:46:28 -0400 Subject: [PATCH 14/28] remove dev deps --- contracts/Scarb.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/contracts/Scarb.toml b/contracts/Scarb.toml index 09cba991a..276386267 100644 --- a/contracts/Scarb.toml +++ b/contracts/Scarb.toml @@ -17,8 +17,6 @@ starknet = "2.8.0" openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.15.1" } alexandria_bytes = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "e1b080577aaa6889116fc8be5dde72b2fd21e397" } alexandria_encoding = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "e1b080577aaa6889116fc8be5dde72b2fd21e397" } - -[dev-dependencies] snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" } [lib] From 405173921c3679187c0d98c597ebcecab65ad729 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 12:51:49 -0400 Subject: [PATCH 15/28] remove the rev --- contracts/Scarb.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/Scarb.toml b/contracts/Scarb.toml index 276386267..5affa2e30 100644 --- a/contracts/Scarb.toml +++ b/contracts/Scarb.toml @@ -15,8 +15,8 @@ test = "snforge test" [dependencies] starknet = "2.8.0" openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.15.1" } -alexandria_bytes = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "e1b080577aaa6889116fc8be5dde72b2fd21e397" } -alexandria_encoding = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "e1b080577aaa6889116fc8be5dde72b2fd21e397" } +alexandria_bytes = { git = "https://github.com/keep-starknet-strange/alexandria.git" } +alexandria_encoding = { git = "https://github.com/keep-starknet-strange/alexandria.git" } snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" } [lib] From 99cda72f536b6d8fde459ddbbbab4c63873859d2 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 12:53:08 -0400 Subject: [PATCH 16/28] change alexandrai version --- contracts/Scarb.lock | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/contracts/Scarb.lock b/contracts/Scarb.lock index 4f7feb312..07ff68ee2 100644 --- a/contracts/Scarb.lock +++ b/contracts/Scarb.lock @@ -4,7 +4,7 @@ version = 1 [[package]] name = "alexandria_bytes" version = "0.1.0" -source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +source = "git+https://github.com/keep-starknet-strange/alexandria.git#82088715b454d8cf197b9c54c31525ca0cb57a05" dependencies = [ "alexandria_data_structures", "alexandria_math", @@ -13,7 +13,7 @@ dependencies = [ [[package]] name = "alexandria_data_structures" version = "0.2.0" -source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +source = "git+https://github.com/keep-starknet-strange/alexandria.git#82088715b454d8cf197b9c54c31525ca0cb57a05" dependencies = [ "alexandria_encoding", ] @@ -21,7 +21,7 @@ dependencies = [ [[package]] name = "alexandria_encoding" version = "0.1.0" -source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +source = "git+https://github.com/keep-starknet-strange/alexandria.git#82088715b454d8cf197b9c54c31525ca0cb57a05" dependencies = [ "alexandria_bytes", "alexandria_math", @@ -30,16 +30,13 @@ dependencies = [ [[package]] name = "alexandria_math" -version = "0.2.0" -source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" -dependencies = [ - "alexandria_data_structures", -] +version = "0.2.1" +source = "git+https://github.com/keep-starknet-strange/alexandria.git#82088715b454d8cf197b9c54c31525ca0cb57a05" [[package]] name = "alexandria_numeric" version = "0.1.0" -source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +source = "git+https://github.com/keep-starknet-strange/alexandria.git#82088715b454d8cf197b9c54c31525ca0cb57a05" dependencies = [ "alexandria_math", "alexandria_searching", @@ -48,7 +45,7 @@ dependencies = [ [[package]] name = "alexandria_searching" version = "0.1.0" -source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +source = "git+https://github.com/keep-starknet-strange/alexandria.git#82088715b454d8cf197b9c54c31525ca0cb57a05" dependencies = [ "alexandria_data_structures", ] From 001022f1c74005fb91ed04805212b63034815f86 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 12:55:11 -0400 Subject: [PATCH 17/28] update alexandria and script package --- .../contracts/aggregator_consumer/Scarb.lock | 30 +++++++------------ .../aggregator_consumer/scripts/Scarb.toml | 2 +- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/examples/contracts/aggregator_consumer/Scarb.lock b/examples/contracts/aggregator_consumer/Scarb.lock index 36b34015d..1ec1f686c 100644 --- a/examples/contracts/aggregator_consumer/Scarb.lock +++ b/examples/contracts/aggregator_consumer/Scarb.lock @@ -12,7 +12,7 @@ dependencies = [ [[package]] name = "alexandria_bytes" version = "0.1.0" -source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +source = "git+https://github.com/keep-starknet-strange/alexandria.git#82088715b454d8cf197b9c54c31525ca0cb57a05" dependencies = [ "alexandria_data_structures", "alexandria_math", @@ -21,7 +21,7 @@ dependencies = [ [[package]] name = "alexandria_data_structures" version = "0.2.0" -source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +source = "git+https://github.com/keep-starknet-strange/alexandria.git#82088715b454d8cf197b9c54c31525ca0cb57a05" dependencies = [ "alexandria_encoding", ] @@ -29,7 +29,7 @@ dependencies = [ [[package]] name = "alexandria_encoding" version = "0.1.0" -source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +source = "git+https://github.com/keep-starknet-strange/alexandria.git#82088715b454d8cf197b9c54c31525ca0cb57a05" dependencies = [ "alexandria_bytes", "alexandria_math", @@ -38,16 +38,13 @@ dependencies = [ [[package]] name = "alexandria_math" -version = "0.2.0" -source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" -dependencies = [ - "alexandria_data_structures", -] +version = "0.2.1" +source = "git+https://github.com/keep-starknet-strange/alexandria.git#82088715b454d8cf197b9c54c31525ca0cb57a05" [[package]] name = "alexandria_numeric" version = "0.1.0" -source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +source = "git+https://github.com/keep-starknet-strange/alexandria.git#82088715b454d8cf197b9c54c31525ca0cb57a05" dependencies = [ "alexandria_math", "alexandria_searching", @@ -56,7 +53,7 @@ dependencies = [ [[package]] name = "alexandria_searching" version = "0.1.0" -source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397" +source = "git+https://github.com/keep-starknet-strange/alexandria.git#82088715b454d8cf197b9c54c31525ca0cb57a05" dependencies = [ "alexandria_data_structures", ] @@ -68,6 +65,7 @@ dependencies = [ "alexandria_bytes", "alexandria_encoding", "openzeppelin", + "snforge_std", ] [[package]] @@ -155,15 +153,7 @@ name = "openzeppelin_utils" version = "0.15.1" source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.15.1#2f8a93d762858714095a1d391afffa9e21df6983" -[[package]] -name = "snforge_scarb_plugin" -version = "0.1.0" -source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.28.0#4dfe39d96690ed6b3d56971512700de3f58288ea" - [[package]] name = "snforge_std" -version = "0.28.0" -source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.28.0#4dfe39d96690ed6b3d56971512700de3f58288ea" -dependencies = [ - "snforge_scarb_plugin", -] +version = "0.27.0" +source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.27.0#2d99b7c00678ef0363881ee0273550c44a9263de" diff --git a/examples/contracts/aggregator_consumer/scripts/Scarb.toml b/examples/contracts/aggregator_consumer/scripts/Scarb.toml index 3dde80083..3e6b14573 100644 --- a/examples/contracts/aggregator_consumer/scripts/Scarb.toml +++ b/examples/contracts/aggregator_consumer/scripts/Scarb.toml @@ -6,7 +6,7 @@ cairo-version = "2.8.0" # See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html [dependencies] -sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.2.0" } +sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" } chainlink = { path = "../../../../contracts" } aggregator_consumer = { path = "../" } starknet = "2.8.0" From 3b016b7ea4e89016b0cca37e18b88f3622dc98d8 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 14:34:12 -0400 Subject: [PATCH 18/28] no way --- .github/actions/build-test-image/action.yml | 6 ++++-- .github/workflows/contracts.yml | 14 ++++++++++---- .github/workflows/examples.yml | 7 +++++-- .github/workflows/integration-tests-smoke.yml | 6 ++++-- .github/workflows/integration-tests-soak.yml | 6 ++++-- .github/workflows/integration_gauntlet.yml | 7 +++++-- .github/workflows/lint.yml | 7 +++++-- 7 files changed, 37 insertions(+), 16 deletions(-) diff --git a/.github/actions/build-test-image/action.yml b/.github/actions/build-test-image/action.yml index 29c5fa853..63f21ab87 100644 --- a/.github/actions/build-test-image/action.yml +++ b/.github/actions/build-test-image/action.yml @@ -22,8 +22,10 @@ inputs: runs: using: composite steps: - - name: Install Cairo - uses: ./.github/actions/install-cairo + - name: Install asdf + uses: asdf-vm/actions/install@v3 + # - name: Install Cairo + # uses: ./.github/actions/install-cairo - name: Check if image exists id: check-image uses: smartcontractkit/chainlink-github-actions/docker/image-exists@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 diff --git a/.github/workflows/contracts.yml b/.github/workflows/contracts.yml index dcb61a054..f095a644c 100644 --- a/.github/workflows/contracts.yml +++ b/.github/workflows/contracts.yml @@ -20,8 +20,11 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable - - name: Install Cairo - uses: ./.github/actions/install-cairo + - name: Install asdf + uses: asdf-vm/actions/install@v3 + + # - name: Install Cairo + # uses: ./.github/actions/install-cairo - name: Test run: nix develop -c make test-ts-contracts @@ -38,8 +41,11 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable - - name: Install Cairo - uses: ./.github/actions/install-cairo + - name: Install asdf + uses: asdf-vm/actions/install@v3 + + # - name: Install Cairo + # uses: ./.github/actions/install-cairo - name: Install Starknet Foundry uses: ./.github/actions/install-starknet-foundry diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index c645b4ce0..9441c46d7 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -20,8 +20,11 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable - - name: Install Cairo - uses: ./.github/actions/install-cairo + - name: Install asdf + uses: asdf-vm/actions/install@v3 + + # - name: Install Cairo + # uses: ./.github/actions/install-cairo - name: Install Starknet Foundry uses: ./.github/actions/install-starknet-foundry diff --git a/.github/workflows/integration-tests-smoke.yml b/.github/workflows/integration-tests-smoke.yml index c87094d24..e03fc4e2e 100644 --- a/.github/workflows/integration-tests-smoke.yml +++ b/.github/workflows/integration-tests-smoke.yml @@ -160,8 +160,10 @@ jobs: uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # nix:v2.24.6 with: nix_path: nixpkgs=channel:nixos-unstable - - name: Install Cairo - uses: ./.github/actions/install-cairo + # - name: Install Cairo + # uses: ./.github/actions/install-cairo + - name: Install asdf + uses: asdf-vm/actions/install@v3 - name: Build contracts run: | cd contracts && scarb --profile release build diff --git a/.github/workflows/integration-tests-soak.yml b/.github/workflows/integration-tests-soak.yml index 204537d98..0b4d40363 100644 --- a/.github/workflows/integration-tests-soak.yml +++ b/.github/workflows/integration-tests-soak.yml @@ -53,8 +53,10 @@ jobs: uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # nix:v2.24.6 with: nix_path: nixpkgs=channel:nixos-unstable - - name: Install Cairo - uses: ./.github/actions/install-cairo + - name: Install asdf + uses: asdf-vm/actions/install@v3 + # - name: Install Cairo + # uses: ./.github/actions/install-cairo - name: Build contracts run: | cd contracts && scarb --profile release build diff --git a/.github/workflows/integration_gauntlet.yml b/.github/workflows/integration_gauntlet.yml index eafe935af..f19dd9b56 100644 --- a/.github/workflows/integration_gauntlet.yml +++ b/.github/workflows/integration_gauntlet.yml @@ -55,8 +55,11 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable - - name: Install Cairo - uses: ./.github/actions/install-cairo + # - name: Install Cairo + # uses: ./.github/actions/install-cairo + + - name: Install asdf + uses: asdf-vm/actions/install@v3 - name: Test run: nix develop -c make test-integration-gauntlet diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 40fb56ad4..858db6511 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,8 +20,11 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable - - name: Install Cairo - uses: ./.github/actions/install-cairo + # - name: Install Cairo + # uses: ./.github/actions/install-cairo + + - name: Install asdf + uses: asdf-vm/actions/install@v3 - name: Install run: nix develop -c yarn install --frozen-lockfile From 007540c0dd5afac0c63fd91cbc69305e70fdff7a Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 14:47:14 -0400 Subject: [PATCH 19/28] do the thing --- .github/actions/build-test-image/action.yml | 6 +-- .github/actions/install-cairo/action.yml | 37 ++++++++++++------- .github/workflows/contracts.yml | 14 ++----- .github/workflows/examples.yml | 7 +--- .github/workflows/integration-tests-smoke.yml | 6 +-- .github/workflows/integration-tests-soak.yml | 6 +-- .github/workflows/integration_gauntlet.yml | 7 +--- .github/workflows/lint.yml | 7 +--- 8 files changed, 39 insertions(+), 51 deletions(-) diff --git a/.github/actions/build-test-image/action.yml b/.github/actions/build-test-image/action.yml index 63f21ab87..29c5fa853 100644 --- a/.github/actions/build-test-image/action.yml +++ b/.github/actions/build-test-image/action.yml @@ -22,10 +22,8 @@ inputs: runs: using: composite steps: - - name: Install asdf - uses: asdf-vm/actions/install@v3 - # - name: Install Cairo - # uses: ./.github/actions/install-cairo + - name: Install Cairo + uses: ./.github/actions/install-cairo - name: Check if image exists id: check-image uses: smartcontractkit/chainlink-github-actions/docker/image-exists@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19 diff --git a/.github/actions/install-cairo/action.yml b/.github/actions/install-cairo/action.yml index 4feae653d..cfe51dcc7 100644 --- a/.github/actions/install-cairo/action.yml +++ b/.github/actions/install-cairo/action.yml @@ -14,20 +14,29 @@ inputs: runs: using: composite steps: - - name: Setup Cairo for Linux - id: install-cairo - shell: bash - run: | - wget https://github.com/starkware-libs/cairo/releases/download/${{ inputs.cairo_version }}/release-x86_64-unknown-linux-musl.tar.gz - tar -xvzf release-x86_64-unknown-linux-musl.tar.gz - mv -vf cairo cairo-build - echo "$GITHUB_WORKSPACE/cairo-build/bin" >> $GITHUB_PATH + - name: Setup asdf + uses: asdf-vm/actions/setup@v3 - - name: Setup Scarb for Linux - id: install-scarb + - name: Set up Scarb for Linux shell: bash run: | - wget https://github.com/software-mansion/scarb/releases/download/${{ inputs.scarb_version }}/scarb-${{ inputs.scarb_version }}-x86_64-unknown-linux-musl.tar.gz - tar -xvzf scarb-${{ inputs.scarb_version }}-x86_64-unknown-linux-musl.tar.gz - mv -vf scarb-${{ inputs.scarb_version }}-x86_64-unknown-linux-musl scarb-build - echo "$GITHUB_WORKSPACE/scarb-build/bin" >> $GITHUB_PATH + asdf plugin add scarb + asdf install scarb ${{ inputs.scarb_version }} + + # - name: Setup Cairo for Linux + # id: install-cairo + # shell: bash + # run: | + # wget https://github.com/starkware-libs/cairo/releases/download/${{ inputs.cairo_version }}/release-x86_64-unknown-linux-musl.tar.gz + # tar -xvzf release-x86_64-unknown-linux-musl.tar.gz + # mv -vf cairo cairo-build + # echo "$GITHUB_WORKSPACE/cairo-build/bin" >> $GITHUB_PATH + + # - name: Setup Scarb for Linux + # id: install-scarb + # shell: bash + # run: | + # wget https://github.com/software-mansion/scarb/releases/download/${{ inputs.scarb_version }}/scarb-${{ inputs.scarb_version }}-x86_64-unknown-linux-musl.tar.gz + # tar -xvzf scarb-${{ inputs.scarb_version }}-x86_64-unknown-linux-musl.tar.gz + # mv -vf scarb-${{ inputs.scarb_version }}-x86_64-unknown-linux-musl scarb-build + # echo "$GITHUB_WORKSPACE/scarb-build/bin" >> $GITHUB_PATH diff --git a/.github/workflows/contracts.yml b/.github/workflows/contracts.yml index f095a644c..dcb61a054 100644 --- a/.github/workflows/contracts.yml +++ b/.github/workflows/contracts.yml @@ -20,11 +20,8 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable - - name: Install asdf - uses: asdf-vm/actions/install@v3 - - # - name: Install Cairo - # uses: ./.github/actions/install-cairo + - name: Install Cairo + uses: ./.github/actions/install-cairo - name: Test run: nix develop -c make test-ts-contracts @@ -41,11 +38,8 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable - - name: Install asdf - uses: asdf-vm/actions/install@v3 - - # - name: Install Cairo - # uses: ./.github/actions/install-cairo + - name: Install Cairo + uses: ./.github/actions/install-cairo - name: Install Starknet Foundry uses: ./.github/actions/install-starknet-foundry diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 9441c46d7..c645b4ce0 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -20,11 +20,8 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable - - name: Install asdf - uses: asdf-vm/actions/install@v3 - - # - name: Install Cairo - # uses: ./.github/actions/install-cairo + - name: Install Cairo + uses: ./.github/actions/install-cairo - name: Install Starknet Foundry uses: ./.github/actions/install-starknet-foundry diff --git a/.github/workflows/integration-tests-smoke.yml b/.github/workflows/integration-tests-smoke.yml index e03fc4e2e..c87094d24 100644 --- a/.github/workflows/integration-tests-smoke.yml +++ b/.github/workflows/integration-tests-smoke.yml @@ -160,10 +160,8 @@ jobs: uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # nix:v2.24.6 with: nix_path: nixpkgs=channel:nixos-unstable - # - name: Install Cairo - # uses: ./.github/actions/install-cairo - - name: Install asdf - uses: asdf-vm/actions/install@v3 + - name: Install Cairo + uses: ./.github/actions/install-cairo - name: Build contracts run: | cd contracts && scarb --profile release build diff --git a/.github/workflows/integration-tests-soak.yml b/.github/workflows/integration-tests-soak.yml index 0b4d40363..204537d98 100644 --- a/.github/workflows/integration-tests-soak.yml +++ b/.github/workflows/integration-tests-soak.yml @@ -53,10 +53,8 @@ jobs: uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # nix:v2.24.6 with: nix_path: nixpkgs=channel:nixos-unstable - - name: Install asdf - uses: asdf-vm/actions/install@v3 - # - name: Install Cairo - # uses: ./.github/actions/install-cairo + - name: Install Cairo + uses: ./.github/actions/install-cairo - name: Build contracts run: | cd contracts && scarb --profile release build diff --git a/.github/workflows/integration_gauntlet.yml b/.github/workflows/integration_gauntlet.yml index f19dd9b56..eafe935af 100644 --- a/.github/workflows/integration_gauntlet.yml +++ b/.github/workflows/integration_gauntlet.yml @@ -55,11 +55,8 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable - # - name: Install Cairo - # uses: ./.github/actions/install-cairo - - - name: Install asdf - uses: asdf-vm/actions/install@v3 + - name: Install Cairo + uses: ./.github/actions/install-cairo - name: Test run: nix develop -c make test-integration-gauntlet diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 858db6511..40fb56ad4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,11 +20,8 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable - # - name: Install Cairo - # uses: ./.github/actions/install-cairo - - - name: Install asdf - uses: asdf-vm/actions/install@v3 + - name: Install Cairo + uses: ./.github/actions/install-cairo - name: Install run: nix develop -c yarn install --frozen-lockfile From ff148ad2a6040c112f963d8e1e8c5e2e35405d1f Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 14:51:58 -0400 Subject: [PATCH 20/28] fix typo --- .github/actions/install-cairo/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/install-cairo/action.yml b/.github/actions/install-cairo/action.yml index cfe51dcc7..745524711 100644 --- a/.github/actions/install-cairo/action.yml +++ b/.github/actions/install-cairo/action.yml @@ -8,7 +8,7 @@ inputs: required: false scarb_version: description: Scarb release version - default: "v2.8.0" + default: "2.8.0" required: false runs: From efcdf8110d591fa53a83d2b2d7327ddada719662 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 14:56:17 -0400 Subject: [PATCH 21/28] install starknet foundry using asdf --- .github/actions/install-starknet-foundry/action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/actions/install-starknet-foundry/action.yml b/.github/actions/install-starknet-foundry/action.yml index 8e4360edf..73bca3bae 100644 --- a/.github/actions/install-starknet-foundry/action.yml +++ b/.github/actions/install-starknet-foundry/action.yml @@ -14,5 +14,6 @@ runs: id: install-starknet-foundry shell: bash run: | - curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh - snfoundryup -v ${{ inputs.starknet_foundry_version }} + asdf install starknet-foundry ${{ inputs.starknet_foundry_version }} + # curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh + # snfoundryup -v ${{ inputs.starknet_foundry_version }} From 62b7308e4c64a69c1dc0553fb46ed8a58e204324 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 14:58:06 -0400 Subject: [PATCH 22/28] add plugin --- .github/actions/install-starknet-foundry/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/install-starknet-foundry/action.yml b/.github/actions/install-starknet-foundry/action.yml index 73bca3bae..fed3e74e6 100644 --- a/.github/actions/install-starknet-foundry/action.yml +++ b/.github/actions/install-starknet-foundry/action.yml @@ -14,6 +14,7 @@ runs: id: install-starknet-foundry shell: bash run: | + asdf plugin add starknet-foundry asdf install starknet-foundry ${{ inputs.starknet_foundry_version }} # curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh # snfoundryup -v ${{ inputs.starknet_foundry_version }} From 62a770544cf2c0a95084ced9daa70e2f800abca0 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 15:02:30 -0400 Subject: [PATCH 23/28] add to path --- .github/actions/install-starknet-foundry/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/install-starknet-foundry/action.yml b/.github/actions/install-starknet-foundry/action.yml index fed3e74e6..7558566f5 100644 --- a/.github/actions/install-starknet-foundry/action.yml +++ b/.github/actions/install-starknet-foundry/action.yml @@ -16,5 +16,6 @@ runs: run: | asdf plugin add starknet-foundry asdf install starknet-foundry ${{ inputs.starknet_foundry_version }} + echo "/home/runner/.local/bin" >> $GITHUB_PATH # curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh # snfoundryup -v ${{ inputs.starknet_foundry_version }} From f58a2b36661ed368deb17d8ffc6e87572f544f8f Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 15:06:36 -0400 Subject: [PATCH 24/28] clean cache --- .github/actions/install-starknet-foundry/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/install-starknet-foundry/action.yml b/.github/actions/install-starknet-foundry/action.yml index 7558566f5..f1d00930c 100644 --- a/.github/actions/install-starknet-foundry/action.yml +++ b/.github/actions/install-starknet-foundry/action.yml @@ -16,6 +16,7 @@ runs: run: | asdf plugin add starknet-foundry asdf install starknet-foundry ${{ inputs.starknet_foundry_version }} + snforge clean-cache echo "/home/runner/.local/bin" >> $GITHUB_PATH # curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh # snfoundryup -v ${{ inputs.starknet_foundry_version }} From 3460b65943f8d068f355b2e9e8197e71b431a72f Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 15:11:05 -0400 Subject: [PATCH 25/28] move clean cache --- .github/actions/install-starknet-foundry/action.yml | 1 - Makefile | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/actions/install-starknet-foundry/action.yml b/.github/actions/install-starknet-foundry/action.yml index f1d00930c..7558566f5 100644 --- a/.github/actions/install-starknet-foundry/action.yml +++ b/.github/actions/install-starknet-foundry/action.yml @@ -16,7 +16,6 @@ runs: run: | asdf plugin add starknet-foundry asdf install starknet-foundry ${{ inputs.starknet_foundry_version }} - snforge clean-cache echo "/home/runner/.local/bin" >> $GITHUB_PATH # curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/scripts/install.sh | sh # snfoundryup -v ${{ inputs.starknet_foundry_version }} diff --git a/Makefile b/Makefile index 94f576867..b6fe65fba 100644 --- a/Makefile +++ b/Makefile @@ -233,7 +233,7 @@ test-integration-soak-ci: .PHONY: test-examples test-examples: cd ./examples/contracts/aggregator_consumer && \ - snforge test + snforge clean-cache && snforge test .PHONY: test-integration-gauntlet # TODO: fix example @@ -271,7 +271,7 @@ build-cairo-contracts: .PHONY: test-cairo-contracts test-cairo-contracts: - cd contracts && snforge test + cd contracts && snforge clean-cache && snforge test # TODO: this script needs to be replaced with a predefined K8s enviroment .PHONY: env-devnet-hardhat From 0f290778ed642ce98fb490ea56df6a4b92bade4d Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 15:16:54 -0400 Subject: [PATCH 26/28] 2.7.1 --- .github/actions/install-cairo/action.yml | 4 ++-- .tool-versions | 2 +- contracts/Scarb.toml | 4 ++-- examples/contracts/aggregator_consumer/Scarb.toml | 4 ++-- examples/contracts/aggregator_consumer/scripts/Scarb.toml | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/actions/install-cairo/action.yml b/.github/actions/install-cairo/action.yml index 745524711..f76ef2a88 100644 --- a/.github/actions/install-cairo/action.yml +++ b/.github/actions/install-cairo/action.yml @@ -4,11 +4,11 @@ description: A composite action that installs cairo and scarb binaries inputs: cairo_version: description: Cairo release version - default: "v2.8.0" + default: "v2.7.1" required: false scarb_version: description: Scarb release version - default: "2.8.0" + default: "2.7.1" required: false runs: diff --git a/.tool-versions b/.tool-versions index ce0a83b40..9a84c1a92 100644 --- a/.tool-versions +++ b/.tool-versions @@ -9,7 +9,7 @@ mockery 2.22.1 golangci-lint 1.55.0 actionlint 1.6.12 shellcheck 0.8.0 -scarb 2.8.0 +scarb 2.7.1 postgres 15.1 starknet-foundry 0.27.0 diff --git a/contracts/Scarb.toml b/contracts/Scarb.toml index aefcc7b4b..55b8f1db8 100644 --- a/contracts/Scarb.toml +++ b/contracts/Scarb.toml @@ -1,7 +1,7 @@ [package] name = "chainlink" version = "0.1.0" -cairo-version = "2.8.0" +cairo-version = "2.7.1" description = "Chainlink contracts for Starknet" homepage = "https://github.com/smartcontractkit/chainlink-starknet" @@ -13,7 +13,7 @@ test = "snforge test" # Uncomment if you want to use dependencies # Note: currently testing doesn't work with dependencies [dependencies] -starknet = "2.8.0" +starknet = "2.7.1" openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.15.1" } alexandria_bytes = { git = "https://github.com/keep-starknet-strange/alexandria.git" } alexandria_encoding = { git = "https://github.com/keep-starknet-strange/alexandria.git" } diff --git a/examples/contracts/aggregator_consumer/Scarb.toml b/examples/contracts/aggregator_consumer/Scarb.toml index b6983bc1b..d14034a07 100644 --- a/examples/contracts/aggregator_consumer/Scarb.toml +++ b/examples/contracts/aggregator_consumer/Scarb.toml @@ -6,7 +6,7 @@ [package] name = "aggregator_consumer" version = "0.1.0" -cairo-version = "2.8.0" +cairo-version = "2.7.1" [scripts] test = "snforge test" @@ -18,7 +18,7 @@ test = "snforge test" [dependencies] chainlink = { path = "../../../contracts" } -starknet = "2.8.0" +starknet = "2.7.1" snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" } [lib] diff --git a/examples/contracts/aggregator_consumer/scripts/Scarb.toml b/examples/contracts/aggregator_consumer/scripts/Scarb.toml index 3e6b14573..b1a02bc7a 100644 --- a/examples/contracts/aggregator_consumer/scripts/Scarb.toml +++ b/examples/contracts/aggregator_consumer/scripts/Scarb.toml @@ -1,7 +1,7 @@ [package] name = "src" version = "0.1.0" -cairo-version = "2.8.0" +cairo-version = "2.7.1" # See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html @@ -9,7 +9,7 @@ cairo-version = "2.8.0" sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" } chainlink = { path = "../../../../contracts" } aggregator_consumer = { path = "../" } -starknet = "2.8.0" +starknet = "2.7.1" [lib] casm = true From aeb4aa379cf6cd03633c1e2721bee456ae60a6bd Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 15:19:51 -0400 Subject: [PATCH 27/28] 2.7.0 --- .github/actions/install-cairo/action.yml | 4 ++-- .tool-versions | 2 +- contracts/Scarb.toml | 4 ++-- examples/contracts/aggregator_consumer/Scarb.toml | 4 ++-- examples/contracts/aggregator_consumer/scripts/Scarb.toml | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/actions/install-cairo/action.yml b/.github/actions/install-cairo/action.yml index f76ef2a88..1a5ff5b61 100644 --- a/.github/actions/install-cairo/action.yml +++ b/.github/actions/install-cairo/action.yml @@ -4,11 +4,11 @@ description: A composite action that installs cairo and scarb binaries inputs: cairo_version: description: Cairo release version - default: "v2.7.1" + default: "v2.7.0" required: false scarb_version: description: Scarb release version - default: "2.7.1" + default: "2.7.0" required: false runs: diff --git a/.tool-versions b/.tool-versions index 9a84c1a92..f53f76ba8 100644 --- a/.tool-versions +++ b/.tool-versions @@ -9,7 +9,7 @@ mockery 2.22.1 golangci-lint 1.55.0 actionlint 1.6.12 shellcheck 0.8.0 -scarb 2.7.1 +scarb 2.7.0 postgres 15.1 starknet-foundry 0.27.0 diff --git a/contracts/Scarb.toml b/contracts/Scarb.toml index 55b8f1db8..5da5d8eee 100644 --- a/contracts/Scarb.toml +++ b/contracts/Scarb.toml @@ -1,7 +1,7 @@ [package] name = "chainlink" version = "0.1.0" -cairo-version = "2.7.1" +cairo-version = "2.7.0" description = "Chainlink contracts for Starknet" homepage = "https://github.com/smartcontractkit/chainlink-starknet" @@ -13,7 +13,7 @@ test = "snforge test" # Uncomment if you want to use dependencies # Note: currently testing doesn't work with dependencies [dependencies] -starknet = "2.7.1" +starknet = "2.7.0" openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.15.1" } alexandria_bytes = { git = "https://github.com/keep-starknet-strange/alexandria.git" } alexandria_encoding = { git = "https://github.com/keep-starknet-strange/alexandria.git" } diff --git a/examples/contracts/aggregator_consumer/Scarb.toml b/examples/contracts/aggregator_consumer/Scarb.toml index d14034a07..77dbc4a0f 100644 --- a/examples/contracts/aggregator_consumer/Scarb.toml +++ b/examples/contracts/aggregator_consumer/Scarb.toml @@ -6,7 +6,7 @@ [package] name = "aggregator_consumer" version = "0.1.0" -cairo-version = "2.7.1" +cairo-version = "2.7.0" [scripts] test = "snforge test" @@ -18,7 +18,7 @@ test = "snforge test" [dependencies] chainlink = { path = "../../../contracts" } -starknet = "2.7.1" +starknet = "2.7.0" snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" } [lib] diff --git a/examples/contracts/aggregator_consumer/scripts/Scarb.toml b/examples/contracts/aggregator_consumer/scripts/Scarb.toml index b1a02bc7a..7433666e0 100644 --- a/examples/contracts/aggregator_consumer/scripts/Scarb.toml +++ b/examples/contracts/aggregator_consumer/scripts/Scarb.toml @@ -1,7 +1,7 @@ [package] name = "src" version = "0.1.0" -cairo-version = "2.7.1" +cairo-version = "2.7.0" # See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html @@ -9,7 +9,7 @@ cairo-version = "2.7.1" sncast_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" } chainlink = { path = "../../../../contracts" } aggregator_consumer = { path = "../" } -starknet = "2.7.1" +starknet = "2.7.0" [lib] casm = true From d5cf7376093763babba03a01e13f84e5bbd93ae5 Mon Sep 17 00:00:00 2001 From: Augustus Chang Date: Fri, 27 Sep 2024 15:24:16 -0400 Subject: [PATCH 28/28] wait really --- contracts/Scarb.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/Scarb.toml b/contracts/Scarb.toml index 5da5d8eee..a21ade212 100644 --- a/contracts/Scarb.toml +++ b/contracts/Scarb.toml @@ -20,7 +20,7 @@ alexandria_encoding = { git = "https://github.com/keep-starknet-strange/alexandr snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" } [dev-dependencies] -alexandria_math = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "bcdca70afdf59c9976148e95cebad5cf63d75a7f" } +alexandria_math = { git = "https://github.com/keep-starknet-strange/alexandria.git" } [lib]