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.test bump cairo #532

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9df857a
initial commit for bumping cairo
augustbleeds Aug 27, 2024
65c9afd
update build process
augustbleeds Aug 27, 2024
6d273b8
fix cairo tests
augustbleeds Aug 29, 2024
b72a983
merge develop (starknet-foundry introduction)
augustbleeds Sep 4, 2024
c8e93d6
fix merge confilicts
augustbleeds Sep 4, 2024
845a6ff
use scarb fmt instead of cairo-format
augustbleeds Sep 4, 2024
7f1e697
update starknet-foundry ci/cd
augustbleeds Sep 4, 2024
0d2546a
bump scarb
augustbleeds Sep 27, 2024
9e1d327
try snforge directly
augustbleeds Sep 27, 2024
d2c9f03
lets go?
augustbleeds Sep 27, 2024
15b9e52
bump
augustbleeds Sep 27, 2024
06a1c34
2.7.1
augustbleeds Sep 27, 2024
ad84e37
try 2.8.0
augustbleeds Sep 27, 2024
d4ffd5d
remove dev-deps
augustbleeds Sep 27, 2024
7dfa871
remove dev deps
augustbleeds Sep 27, 2024
4051739
remove the rev
augustbleeds Sep 27, 2024
99cda72
change alexandrai version
augustbleeds Sep 27, 2024
001022f
update alexandria and script package
augustbleeds Sep 27, 2024
420608a
Merge branch 'develop' into augustus.test-bump-cairo
augustbleeds Sep 27, 2024
3b016b7
no way
augustbleeds Sep 27, 2024
007540c
do the thing
augustbleeds Sep 27, 2024
ff148ad
fix typo
augustbleeds Sep 27, 2024
efcdf81
install starknet foundry using asdf
augustbleeds Sep 27, 2024
62b7308
add plugin
augustbleeds Sep 27, 2024
62a7705
add to path
augustbleeds Sep 27, 2024
f58a2b3
clean cache
augustbleeds Sep 27, 2024
3460b65
move clean cache
augustbleeds Sep 27, 2024
0f29077
2.7.1
augustbleeds Sep 27, 2024
aeb4aa3
2.7.0
augustbleeds Sep 27, 2024
d5cf737
wait really
augustbleeds Sep 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 25 additions & 16 deletions .github/actions/install-cairo/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,39 @@
inputs:
cairo_version:
description: Cairo release version
default: "v2.6.4"
default: "v2.7.0"
required: false
scarb_version:
description: Scarb release version
default: "v2.6.5"
default: "2.7.0"
required: false

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

Check failure on line 18 in .github/actions/install-cairo/action.yml

View workflow job for this annotation

GitHub Actions / Validate Workflow Changes

1. v3 is not a valid SHA reference (sha-ref / error) 2. No version comment found (version-comment / warning)

- 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
7 changes: 5 additions & 2 deletions .github/actions/install-starknet-foundry/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@ 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 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 }}
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
Expand Up @@ -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.0
postgres 15.1
starknet-foundry 0.27.0

Expand Down
12 changes: 6 additions & 6 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 Expand Up @@ -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
Expand Down Expand Up @@ -271,7 +271,7 @@ build-cairo-contracts:

.PHONY: test-cairo-contracts
test-cairo-contracts:
cd contracts && scarb test
cd contracts && snforge clean-cache && snforge test

# TODO: this script needs to be replaced with a predefined K8s enviroment
.PHONY: env-devnet-hardhat
Expand Down
101 changes: 89 additions & 12 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#82088715b454d8cf197b9c54c31525ca0cb57a05"
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#82088715b454d8cf197b9c54c31525ca0cb57a05"
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#82088715b454d8cf197b9c54c31525ca0cb57a05"
dependencies = [
"alexandria_bytes",
"alexandria_math",
Expand All @@ -30,16 +30,13 @@ dependencies = [

[[package]]
name = "alexandria_math"
version = "0.2.0"
source = "git+https://github.com/keep-starknet-strange/alexandria.git?rev=bcdca70afdf59c9976148e95cebad5cf63d75a7f#bcdca70afdf59c9976148e95cebad5cf63d75a7f"
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=bcdca70afdf59c9976148e95cebad5cf63d75a7f#bcdca70afdf59c9976148e95cebad5cf63d75a7f"
source = "git+https://github.com/keep-starknet-strange/alexandria.git#82088715b454d8cf197b9c54c31525ca0cb57a05"
dependencies = [
"alexandria_math",
"alexandria_searching",
Expand All @@ -48,7 +45,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#82088715b454d8cf197b9c54c31525ca0cb57a05"
dependencies = [
"alexandria_data_structures",
]
Expand All @@ -66,8 +63,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"
Expand Down
12 changes: 6 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.0"
description = "Chainlink contracts for Starknet"
homepage = "https://github.com/smartcontractkit/chainlink-starknet"

Expand All @@ -13,14 +13,14 @@ 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" }
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" }
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]

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);
}
}
Loading
Loading