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

Audit #557

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
Open

Audit #557

Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .github/actions/build-test-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ runs:
steps:
- name: Install Cairo
uses: ./.github/actions/install-cairo
with:
use_musl_libc: "true"
- name: Check if image exists
id: check-image
uses: smartcontractkit/chainlink-github-actions/docker/image-exists@fc3e0df622521019f50d772726d6bf8dc919dd38 # v2.3.19
Expand Down
43 changes: 27 additions & 16 deletions .github/actions/install-cairo/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,43 @@ name: Install Cairo and Scarb
description: A composite action that installs cairo and scarb binaries

inputs:
cairo_version:
description: Cairo release version
default: "v2.6.4"
required: false
# cairo_version:
# description: Cairo release version
# default: "v2.8.2"
# required: false
scarb_version:
description: Scarb release version
default: "v2.6.5"
default: "v2.8.2"
required: false
use_musl_libc:
description: "C library implementation"
default: "false"
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 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
# echo "$GITHUB_WORKSPACE"
# echo "this is the github workspace"

- 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
if [ "${{ inputs.use_musl_libc }}" = "true" ]; then
libc_version="musl"
else
libc_version="gnu"
fi
wget https://github.com/software-mansion/scarb/releases/download/${{ inputs.scarb_version }}/scarb-${{ inputs.scarb_version }}-x86_64-unknown-linux-${libc_version}.tar.gz
tar -xvzf scarb-${{ inputs.scarb_version }}-x86_64-unknown-linux-${libc_version}.tar.gz
Comment on lines +41 to +42
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See this example where we check the shasum of the file.

mv -vf scarb-${{ inputs.scarb_version }}-x86_64-unknown-linux-${libc_version} scarb-build
echo "$GITHUB_WORKSPACE/scarb-build/bin" >> $GITHUB_PATH
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.31.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.62.2
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.31.0

# Kubernetes
k3d 5.4.4
Expand Down
10 changes: 5 additions & 5 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
scarb test

.PHONY: test-integration-gauntlet
# TODO: fix example
Expand Down
130 changes: 116 additions & 14 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=6a989d636243494a0529fc3af06a924493499564#6a989d636243494a0529fc3af06a924493499564"
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=6a989d636243494a0529fc3af06a924493499564#6a989d636243494a0529fc3af06a924493499564"
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=6a989d636243494a0529fc3af06a924493499564#6a989d636243494a0529fc3af06a924493499564"
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?rev=6a989d636243494a0529fc3af06a924493499564#6a989d636243494a0529fc3af06a924493499564"

[[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=6a989d636243494a0529fc3af06a924493499564#6a989d636243494a0529fc3af06a924493499564"
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?rev=6a989d636243494a0529fc3af06a924493499564#6a989d636243494a0529fc3af06a924493499564"
dependencies = [
"alexandria_data_structures",
]
Expand All @@ -66,10 +63,115 @@ dependencies = [

[[package]]
name = "openzeppelin"
version = "0.10.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.10.0#d77082732daab2690ba50742ea41080eb23299d3"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_finance",
"openzeppelin_governance",
"openzeppelin_introspection",
"openzeppelin_merkle_tree",
"openzeppelin_presets",
"openzeppelin_security",
"openzeppelin_token",
"openzeppelin_upgrades",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_access"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
dependencies = [
"openzeppelin_introspection",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_account"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
dependencies = [
"openzeppelin_introspection",
"openzeppelin_utils",
]

[[package]]
name = "openzeppelin_finance"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
dependencies = [
"openzeppelin_access",
"openzeppelin_token",
]

[[package]]
name = "openzeppelin_governance"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
dependencies = [
"openzeppelin_access",
"openzeppelin_introspection",
]

[[package]]
name = "openzeppelin_introspection"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"

[[package]]
name = "openzeppelin_merkle_tree"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"

[[package]]
name = "openzeppelin_presets"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
dependencies = [
"openzeppelin_access",
"openzeppelin_account",
"openzeppelin_finance",
"openzeppelin_introspection",
"openzeppelin_token",
"openzeppelin_upgrades",
]

[[package]]
name = "openzeppelin_security"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"

[[package]]
name = "openzeppelin_token"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"
dependencies = [
"openzeppelin_account",
"openzeppelin_governance",
"openzeppelin_introspection",
]

[[package]]
name = "openzeppelin_upgrades"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"

[[package]]
name = "openzeppelin_utils"
version = "0.17.0"
source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.17.0#bf5d02c25c989ccc24f3ab42ec649617d3f21289"

[[package]]
name = "snforge_scarb_plugin"
version = "0.31.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.31.0#72ea785ca354e9e506de3e5d687da9fb2c1b3c67"

[[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.31.0"
source = "git+https://github.com/foundry-rs/starknet-foundry.git?tag=v0.31.0#72ea785ca354e9e506de3e5d687da9fb2c1b3c67"
dependencies = [
"snforge_scarb_plugin",
]
14 changes: 7 additions & 7 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.8.2"
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" }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.27.0" }
starknet = "2.8.2"
openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.17.0" }
alexandria_bytes = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "6a989d636243494a0529fc3af06a924493499564" }
alexandria_encoding = { git = "https://github.com/keep-starknet-strange/alexandria.git", rev = "6a989d636243494a0529fc3af06a924493499564" }

[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", rev = "6a989d636243494a0529fc3af06a924493499564" }
snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry.git", tag = "v0.31.0" }

[lib]

Expand Down
2 changes: 0 additions & 2 deletions contracts/cairo_project.toml

This file was deleted.

Loading
Loading