Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Augustus.new bump cairo #529

Closed
wants to merge 16 commits into from
Closed
4 changes: 2 additions & 2 deletions .github/actions/install-cairo/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.8.2"
required: false
scarb_version:
description: Scarb release version
default: "v2.6.5"
default: "v2.8.2"
required: false

runs:
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/install-starknet-foundry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ mockery 2.22.1
golangci-lint 1.55.0
actionlint 1.6.12
shellcheck 0.8.0
scarb 2.6.5
scarb 2.8.2
postgres 15.1
starknet-foundry 0.27.0
starknet-foundry 0.28.0

# Kubernetes
k3d 5.4.4
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
108 changes: 98 additions & 10 deletions contracts/Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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=bcdca70afdf59c9976148e95cebad5cf63d75a7f#bcdca70afdf59c9976148e95cebad5cf63d75a7f"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397"
dependencies = [
"alexandria_data_structures",
"alexandria_math",
Expand All @@ -13,15 +13,15 @@ dependencies = [
[[package]]
name = "alexandria_data_structures"
version = "0.2.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=bcdca70afdf59c9976148e95cebad5cf63d75a7f#bcdca70afdf59c9976148e95cebad5cf63d75a7f"
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=bcdca70afdf59c9976148e95cebad5cf63d75a7f#bcdca70afdf59c9976148e95cebad5cf63d75a7f"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397"
dependencies = [
"alexandria_bytes",
"alexandria_math",
Expand All @@ -31,15 +31,15 @@ dependencies = [
[[package]]
name = "alexandria_math"
version = "0.2.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=bcdca70afdf59c9976148e95cebad5cf63d75a7f#bcdca70afdf59c9976148e95cebad5cf63d75a7f"
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=bcdca70afdf59c9976148e95cebad5cf63d75a7f#bcdca70afdf59c9976148e95cebad5cf63d75a7f"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397"
dependencies = [
"alexandria_math",
"alexandria_searching",
Expand All @@ -48,7 +48,7 @@ dependencies = [
[[package]]
name = "alexandria_searching"
version = "0.1.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=bcdca70afdf59c9976148e95cebad5cf63d75a7f#bcdca70afdf59c9976148e95cebad5cf63d75a7f"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=e1b080577aaa6889116fc8be5dde72b2fd21e397#e1b080577aaa6889116fc8be5dde72b2fd21e397"
dependencies = [
"alexandria_data_structures",
]
Expand All @@ -65,10 +65,98 @@ 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_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.27.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.27.0#2d99b7c00678ef0363881ee0273550c44a9263de"
version = "0.28.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.28.0#4dfe39d96690ed6b3d56971512700de3f58288ea"
dependencies = [
"snforge_scarb_plugin",
]
14 changes: 8 additions & 6 deletions contracts/Scarb.toml
Original file line number Diff line number Diff line change
@@ -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"

Expand All @@ -13,11 +13,13 @@ test = "snforge test"
# 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" }
alexandria_bytes = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "bcdca70afdf59c9976148e95cebad5cf63d75a7f" }
alexandria_encoding = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "bcdca70afdf59c9976148e95cebad5cf63d75a7f" }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.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", 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]

Expand Down
7 changes: 5 additions & 2 deletions contracts/src/account.cairo
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// copied from https://raw.githubusercontent.com/OpenZeppelin/cairo-contracts/861fc416f87addbe23a3b47f9d19ab27c10d5dc8/src/presets/account.cairo (0.9.0)
// copied from
// https://raw.githubusercontent.com/OpenZeppelin/cairo-contracts/861fc416f87addbe23a3b47f9d19ab27c10d5dc8/src/presets/account.cairo
// (0.9.0)

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts for Cairo v0.9.0 (presets/account.cairo)

/// # Account Preset
///
/// OpenZeppelin's basic account which can change its public key and declare, deploy, or call contracts.
/// OpenZeppelin's basic account which can change its public key and declare, deploy, or call
/// contracts.
#[starknet::contract(account)]
mod Account {
use openzeppelin::account::AccountComponent;
Expand Down
6 changes: 4 additions & 2 deletions contracts/src/emergency/sequencer_uptime_feed.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<u128, Transmission>,
_round_transmissions: Map<u128, Transmission>,
_latest_round_id: u128,
}

Expand Down Expand Up @@ -177,7 +178,8 @@ mod SequencerUptimeFeed {

#[l1_handler]
fn update_status(ref self: ContractState, from_address: felt252, status: u128, timestamp: u64) {
// Cairo enforces from_address to be a felt252 on the method signature, but we can cast it right after
// Cairo enforces from_address to be a felt252 on the method signature, but we can cast it
// right after
let from_address: EthAddress = from_address.try_into().unwrap();
assert(self._l1_sender.read() == from_address, 'EXPECTED_FROM_BRIDGE_ONLY');

Expand Down
3 changes: 2 additions & 1 deletion contracts/src/libraries/access_control.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ trait IAccessController<TContractState> {
mod AccessControlComponent {
use starknet::ContractAddress;
use starknet::class_hash::ClassHash;
use starknet::storage::Map;
use zeroable::Zeroable;

use openzeppelin::access::ownable::OwnableComponent;
Expand All @@ -23,7 +24,7 @@ mod AccessControlComponent {
#[storage]
struct Storage {
_check_enabled: bool,
_access_list: LegacyMap<ContractAddress, bool>,
_access_list: Map<ContractAddress, bool>,
}

#[event]
Expand Down
3 changes: 2 additions & 1 deletion contracts/src/libraries/token/erc677.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ trait IERC677Receiver<TContractState> {
fn on_token_transfer(
ref self: TContractState, sender: ContractAddress, value: u256, data: Array<felt252>
);
// implements EIP-165, where function selectors are defined by Ethereum ABI using the ethereum function signatures
// implements EIP-165, where function selectors are defined by Ethereum ABI using the ethereum
// function signatures
fn supports_interface(ref self: TContractState, interface_id: u32) -> bool;
}

Expand Down
6 changes: 3 additions & 3 deletions contracts/src/libraries/upgradeable.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ mod Upgradeable {

// this method assumes replace_class_syscall has a very low possibility of being deprecated
// but if it does, we will either have upgraded the contract to be non-upgradeable by then
// because the starknet ecosystem has stabilized or we will be able to upgrade the contract to the proxy pattern
// #[internal]
// because the starknet ecosystem has stabilized or we will be able to upgrade the contract to
// the proxy pattern #[internal]
fn upgrade(new_impl: ClassHash) {
assert(!new_impl.is_zero(), 'Class hash cannot be zero');
replace_class_syscall(new_impl).unwrap_syscall();
// TODO: Upgraded(new_impl);
// TODO: Upgraded(new_impl);
}
}
18 changes: 10 additions & 8 deletions contracts/src/multisig.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -154,14 +155,14 @@ mod Multisig {
#[storage]
struct Storage {
_threshold: usize,
_signers: LegacyMap<usize, ContractAddress>,
_is_signer: LegacyMap<ContractAddress, bool>,
_signers: Map<usize, ContractAddress>,
_is_signer: Map<ContractAddress, bool>,
_signers_len: usize,
_tx_valid_since: u128,
_next_nonce: u128,
_transactions: LegacyMap<u128, Transaction>,
_transaction_calldata: LegacyMap<(u128, usize), felt252>,
_is_confirmed: LegacyMap<(u128, ContractAddress), bool>,
_transactions: Map<u128, Transaction>,
_transaction_calldata: Map<(u128, usize), felt252>,
_is_confirmed: Map<(u128, ContractAddress), bool>,
}

#[constructor]
Expand Down Expand Up @@ -342,10 +343,11 @@ mod Multisig {
)
.unwrap_syscall();

// TODO: this shouldn't be necessary. call_contract_syscall returns a Span<felt252>, which
// is a serialized result, but returning a Span<felt252> results in an error:
// TODO: this shouldn't be necessary. call_contract_syscall returns a Span<felt252>,
// which is a serialized result, but returning a Span<felt252> results in an error:
//
// Trait has no implementation in context: core::serde::Serde::<core::array::Span::<core::felt252>>
// Trait has no implementation in context:
// core::serde::Serde::<core::array::Span::<core::felt252>>
//
// Cairo docs also have an example that returns a Span<felt252>:
// https://github.com/starkware-libs/cairo/blob/fe425d0893ff93a936bb3e8bbbac771033074bdb/docs/reference/src/components/cairo/modules/language_constructs/pages/contracts.adoc#L226
Expand Down
Loading
Loading