diff --git a/.github/workflows/solidity-foundry.yml b/.github/workflows/solidity-foundry.yml index bac136ec164..755874b9462 100644 --- a/.github/workflows/solidity-foundry.yml +++ b/.github/workflows/solidity-foundry.yml @@ -16,13 +16,20 @@ jobs: - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 id: changes with: + # Foundry is only used for Solidity v0.8 contracts, therefore we can ignore + # changes to older contracts. filters: | src: - - 'contracts/**/*' + - 'contracts/src/v0.8/**/*' - '.github/workflows/solidity-foundry.yml' + - 'contacts/foundry.toml' tests: + strategy: + matrix: + product: [ vrf, automation, llo-feeds, functions, automation-dev, shared ] needs: [changes] + if: needs.changes.outputs.changes == 'true' name: Tests # See https://github.com/foundry-rs/foundry/issues/3827 runs-on: ubuntu-22.04 @@ -37,36 +44,38 @@ jobs: # and not native Foundry. This is to make sure the dependencies # stay in sync. - name: Setup NodeJS - if: ${{ needs.changes.outputs.changes == 'true' }} uses: ./.github/actions/setup-nodejs - name: Install Foundry - if: ${{ needs.changes.outputs.changes == 'true' }} uses: foundry-rs/foundry-toolchain@v1 with: version: nightly - name: Run Forge build - if: ${{ needs.changes.outputs.changes == 'true' }} run: | forge --version forge build id: build working-directory: contracts + env: + FOUNDRY_PROFILE: ${{ matrix.product }} - name: Run Forge tests - if: ${{ needs.changes.outputs.changes == 'true' }} run: | forge test -vvv id: test working-directory: contracts + env: + FOUNDRY_PROFILE: ${{ matrix.product }} - name: Run Forge snapshot - if: ${{ needs.changes.outputs.changes == 'true' }} run: | - forge snapshot --match-test _gas --check + forge snapshot --check gas-snapshots/${{ matrix.product }}.gas-snapshot id: snapshot working-directory: contracts + env: + FOUNDRY_PROFILE: ${{ matrix.product }} + - name: Collect Metrics if: always() id: collect-gha-metrics @@ -74,5 +83,5 @@ jobs: with: basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} - this-job-name: Foundry Tests + this-job-name: Foundry Tests ${{ matrix.product }} continue-on-error: true diff --git a/.github/workflows/solidity-hardhat.yml b/.github/workflows/solidity-hardhat.yml new file mode 100644 index 00000000000..4a2394f17f0 --- /dev/null +++ b/.github/workflows/solidity-hardhat.yml @@ -0,0 +1,177 @@ +name: Solidity-Hardhat + +on: + merge_group: + push: + +env: + NODE_OPTIONS: --max_old_space_size=8192 + +defaults: + run: + shell: bash + +jobs: + changes: + name: Detect changes + runs-on: ubuntu-latest + outputs: + changes: ${{ steps.changes.outputs.src }} + steps: + - name: Checkout the repo + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 + id: changes + with: + filters: | + src: + - 'contracts/src/!(v0.8/(llo-feeds|ccip)/**)/**/*' + - 'contracts/test/**/*' + - 'contracts/package.json' + - 'contracts/hardhat.config.ts' + - 'contracts/ci.json' + - '.github/workflows/solidity-hardhat.yml' + + split-tests: + name: Split Solidity Tests + runs-on: ubuntu-latest + outputs: + splits: ${{ steps.split.outputs.splits }} + steps: + - name: Checkout the repo + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - name: Generate splits + id: split + uses: ./.github/actions/split-tests + with: + config: ./contracts/ci.json + - name: Collect Metrics + id: collect-gha-metrics + uses: smartcontractkit/push-gha-metrics-action@6f41029bc7f0d0db5827f6804a2322e2a89e3b32 + with: + basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} + hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} + this-job-name: Split Solidity Tests + continue-on-error: true + + solidity-coverage-splits: + needs: [changes, split-tests] + if: needs.changes.outputs.changes == 'true' + name: Solidity Coverage ${{ matrix.split.id }} ${{ fromJSON('["(skipped)", ""]')[needs.changes.outputs.changes == 'true'] }} + strategy: + fail-fast: false + matrix: + split: ${{ fromJson(needs.split-tests.outputs.splits) }} + runs-on: ubuntu20.04-4cores-16GB + steps: + - name: Checkout the repo + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - name: Setup NodeJS + uses: ./.github/actions/setup-nodejs + - name: Setup Hardhat + uses: ./.github/actions/setup-hardhat + with: + namespace: coverage + - name: Run coverage + env: + SPLIT: ${{ matrix.split.coverageTests }} + shell: bash + run: pnpm coverage --testfiles "$SPLIT" + working-directory: contracts + - name: Push coverage + run: ./tools/bin/codecov -f ./contracts/coverage.json + - name: Rename coverage + run: mv ./contracts/coverage.json ./contracts/coverage-${{ matrix.split.idx }}.json + - name: Upload coverage + uses: actions/upload-artifact@v3 + with: + name: solidity-coverage-${{ matrix.split.idx }} + path: ./contracts/coverage-${{ matrix.split.idx }}.json + - name: Collect Metrics + id: collect-gha-metrics + uses: smartcontractkit/push-gha-metrics-action@6f41029bc7f0d0db5827f6804a2322e2a89e3b32 + with: + basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} + hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} + this-job-name: Solidity Coverage ${{ matrix.split.id }} + continue-on-error: true + + solidity-coverage: + needs: [changes, solidity-coverage-splits] + if: needs.changes.outputs.changes == 'true' + name: Solidity Coverage ${{ fromJSON('["(skipped)", ""]')[needs.changes.outputs.changes == 'true'] }} + runs-on: ubuntu-latest + steps: + - name: Checkout the repo + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - name: Setup NodeJS + uses: ./.github/actions/setup-nodejs + - name: Make coverage directory + run: mkdir ./contracts/coverage-reports + - name: Download coverage + uses: actions/download-artifact@v3 + with: + path: ./contracts/coverage-reports + - name: Display structure of downloaded files + run: ls -R coverage-reports + working-directory: contracts + - name: Generate merged report + run: pnpm istanbul report text text-summary + working-directory: contracts + + solidity-splits: + needs: [changes, split-tests] + if: needs.changes.outputs.changes == 'true' + name: Solidity ${{ matrix.split.id }} ${{ fromJSON('["(skipped)", ""]')[needs.changes.outputs.changes == 'true'] }} + strategy: + fail-fast: false + matrix: + split: ${{ fromJson(needs.split-tests.outputs.splits) }} + runs-on: ubuntu20.04-4cores-16GB + steps: + - name: Checkout the repo + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + - name: Setup NodeJS + uses: ./.github/actions/setup-nodejs + - name: Setup Hardhat + uses: ./.github/actions/setup-hardhat + with: + namespace: coverage + - name: Run tests + env: + SPLIT: ${{ matrix.split.tests }} + working-directory: contracts + run: pnpm test -- $SPLIT + - name: Collect Metrics + id: collect-gha-metrics + uses: smartcontractkit/push-gha-metrics-action@6f41029bc7f0d0db5827f6804a2322e2a89e3b32 + with: + basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} + hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} + this-job-name: Solidity ${{ matrix.split.id }} + continue-on-error: true + + solidity: + needs: [changes, solidity-splits] + name: Solidity + runs-on: ubuntu-latest + if: always() + steps: + - run: echo 'Solidity tests finished!' + - name: Check test results + run: | + if [[ "${{ needs.changes.result }}" = "failure" || "${{ needs.solidity-splits.result }}" = "failure" ]]; then + echo "One or more changes / solidity-splits jobs failed" + exit 1 + else + echo "All test jobs passed successfully" + fi + - name: Collect Metrics + if: always() + id: collect-gha-metrics + uses: smartcontractkit/push-gha-metrics-action@6f41029bc7f0d0db5827f6804a2322e2a89e3b32 + with: + basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} + hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} + this-job-name: Solidity + continue-on-error: true \ No newline at end of file diff --git a/.github/workflows/solidity.yml b/.github/workflows/solidity.yml index a8cd4107b32..75e8fda6add 100644 --- a/.github/workflows/solidity.yml +++ b/.github/workflows/solidity.yml @@ -4,9 +4,6 @@ on: merge_group: push: -env: - NODE_OPTIONS: --max_old_space_size=8192 - defaults: run: shell: bash @@ -28,179 +25,20 @@ jobs: - 'contracts/**/*' - '.github/workflows/solidity.yml' - split-tests: - name: Split Solidity Tests - runs-on: ubuntu-latest - outputs: - splits: ${{ steps.split.outputs.splits }} - steps: - - name: Checkout the repo - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - - name: Generate splits - id: split - uses: ./.github/actions/split-tests - with: - config: ./contracts/ci.json - - name: Collect Metrics - id: collect-gha-metrics - uses: smartcontractkit/push-gha-metrics-action@6f41029bc7f0d0db5827f6804a2322e2a89e3b32 - with: - basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} - hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} - this-job-name: Split Solidity Tests - continue-on-error: true - - solidity-coverage-splits: - needs: [changes, split-tests] - name: Solidity Coverage ${{ matrix.split.id }} ${{ fromJSON('["(skipped)", ""]')[needs.changes.outputs.changes == 'true'] }} - strategy: - fail-fast: false - matrix: - split: ${{ fromJson(needs.split-tests.outputs.splits) }} - runs-on: ubuntu20.04-4cores-16GB - steps: - - name: Checkout the repo - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - - name: Setup NodeJS - if: ${{ needs.changes.outputs.changes == 'true' }} - uses: ./.github/actions/setup-nodejs - - name: Setup Hardhat - if: ${{ needs.changes.outputs.changes == 'true' }} - uses: ./.github/actions/setup-hardhat - with: - namespace: coverage - - name: Run coverage - if: ${{ needs.changes.outputs.changes == 'true' }} - env: - SPLIT: ${{ matrix.split.coverageTests }} - shell: bash - run: pnpm coverage --testfiles "$SPLIT" - working-directory: contracts - - name: Push coverage - if: ${{ needs.changes.outputs.changes == 'true' }} - run: ./tools/bin/codecov -f ./contracts/coverage.json - - name: Rename coverage - if: ${{ needs.changes.outputs.changes == 'true' }} - run: mv ./contracts/coverage.json ./contracts/coverage-${{ matrix.split.idx }}.json - - name: Upload coverage - if: ${{ needs.changes.outputs.changes == 'true' }} - uses: actions/upload-artifact@v3 - with: - name: solidity-coverage-${{ matrix.split.idx }} - path: ./contracts/coverage-${{ matrix.split.idx }}.json - - name: Collect Metrics - if: ${{ needs.changes.outputs.changes == 'true' }} - id: collect-gha-metrics - uses: smartcontractkit/push-gha-metrics-action@6f41029bc7f0d0db5827f6804a2322e2a89e3b32 - with: - basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} - hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} - this-job-name: Solidity Coverage ${{ matrix.split.id }} - continue-on-error: true - - solidity-coverage: - needs: [changes, solidity-coverage-splits] - name: Solidity Coverage ${{ fromJSON('["(skipped)", ""]')[needs.changes.outputs.changes == 'true'] }} - runs-on: ubuntu-latest - steps: - - name: Checkout the repo - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - - name: Setup NodeJS - if: ${{ needs.changes.outputs.changes == 'true' }} - uses: ./.github/actions/setup-nodejs - - name: Make coverage directory - if: ${{ needs.changes.outputs.changes == 'true' }} - run: mkdir ./contracts/coverage-reports - - name: Download coverage - if: ${{ needs.changes.outputs.changes == 'true' }} - uses: actions/download-artifact@v3 - with: - path: ./contracts/coverage-reports - - name: Display structure of downloaded files - if: ${{ needs.changes.outputs.changes == 'true' }} - run: ls -R coverage-reports - working-directory: contracts - - name: Generate merged report - if: ${{ needs.changes.outputs.changes == 'true' }} - run: pnpm istanbul report text text-summary - working-directory: contracts - - solidity-splits: - needs: [changes, split-tests] - name: Solidity ${{ matrix.split.id }} ${{ fromJSON('["(skipped)", ""]')[needs.changes.outputs.changes == 'true'] }} - strategy: - fail-fast: false - matrix: - split: ${{ fromJson(needs.split-tests.outputs.splits) }} - runs-on: ubuntu20.04-4cores-16GB - steps: - - name: Checkout the repo - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - - name: Setup NodeJS - if: ${{ needs.changes.outputs.changes == 'true' }} - uses: ./.github/actions/setup-nodejs - - name: Setup Hardhat - if: ${{ needs.changes.outputs.changes == 'true' }} - uses: ./.github/actions/setup-hardhat - with: - namespace: coverage - - name: Run tests - if: ${{ needs.changes.outputs.changes == 'true' }} - env: - SPLIT: ${{ matrix.split.tests }} - working-directory: contracts - run: pnpm test -- $SPLIT - - name: Collect Metrics - if: ${{ needs.changes.outputs.changes == 'true' }} - id: collect-gha-metrics - uses: smartcontractkit/push-gha-metrics-action@6f41029bc7f0d0db5827f6804a2322e2a89e3b32 - with: - basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} - hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} - this-job-name: Solidity ${{ matrix.split.id }} - continue-on-error: true - - solidity: - needs: [changes, solidity-splits] - name: Solidity - runs-on: ubuntu-latest - if: always() - steps: - - run: echo 'Solidity tests finished!' - - name: Check test results - run: | - if [[ "${{ needs.changes.result }}" = "failure" || "${{ needs.solidity-splits.result }}" = "failure" ]]; then - echo "One or more changes / solidity-splits jobs failed" - exit 1 - else - echo "All test jobs passed successfully" - fi - - name: Collect Metrics - if: always() - id: collect-gha-metrics - uses: smartcontractkit/push-gha-metrics-action@6f41029bc7f0d0db5827f6804a2322e2a89e3b32 - with: - basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }} - hostname: ${{ secrets.GRAFANA_CLOUD_HOST }} - this-job-name: Solidity - continue-on-error: true - prepublish-test: needs: [changes] + if: needs.changes.outputs.changes == 'true' name: Prepublish Test ${{ fromJSON('["(skipped)", ""]')[needs.changes.outputs.changes == 'true'] }} runs-on: ubuntu-latest steps: - name: Checkout the repo uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Setup NodeJS - if: ${{ needs.changes.outputs.changes == 'true' }} uses: ./.github/actions/setup-nodejs - name: Run Prepublish test - if: ${{ needs.changes.outputs.changes == 'true' }} working-directory: contracts run: pnpm prepublishOnly - name: Collect Metrics - if: ${{ needs.changes.outputs.changes == 'true' }} id: collect-gha-metrics uses: smartcontractkit/push-gha-metrics-action@6f41029bc7f0d0db5827f6804a2322e2a89e3b32 with: @@ -211,6 +49,7 @@ jobs: native-compile: needs: [changes] + if: needs.changes.outputs.changes == 'true' name: Native Compilation ${{ fromJSON('["(skipped)", ""]')[needs.changes.outputs.changes == 'true'] }} runs-on: ubuntu-latest steps: @@ -225,18 +64,15 @@ jobs: - name: Install diff-so-fancy run: echo "$GITHUB_WORKSPACE/diff-so-fancy" >> $GITHUB_PATH - name: Setup NodeJS - if: ${{ needs.changes.outputs.changes == 'true' }} uses: ./.github/actions/setup-nodejs with: prod: "true" - name: Setup Go - if: ${{ needs.changes.outputs.changes == 'true' }} uses: ./.github/actions/setup-go - name: Run native compile and generate wrappers - if: ${{ needs.changes.outputs.changes == 'true' }} - run: make go-solidity-wrappers + run: make wrappers-all + working-directory: ./contracts - name: Verify local solc binaries - if: ${{ needs.changes.outputs.changes == 'true' }} run: ./tools/ci/check_solc_hashes - name: Check if Go solidity wrappers are updated if: ${{ needs.changes.outputs.changes == 'true' }} @@ -245,9 +81,8 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} if: ${{ failure() }} - run: gh pr comment -b 'Go solidity wrappers are out-of-date, regenerate them via the `make go-solidity-wrappers` command' + run: gh pr comment -b 'Go solidity wrappers are out-of-date, regenerate them via the `make wrappers-all` command' - name: Collect Metrics - if: ${{ needs.changes.outputs.changes == 'true' }} id: collect-gha-metrics uses: smartcontractkit/push-gha-metrics-action@6f41029bc7f0d0db5827f6804a2322e2a89e3b32 with: @@ -261,19 +96,17 @@ jobs: run: working-directory: contracts needs: [changes] + if: needs.changes.outputs.changes == 'true' name: Lint ${{ fromJSON('["(skipped)", ""]')[needs.changes.outputs.changes == 'true'] }} runs-on: ubuntu-latest steps: - name: Checkout the repo uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Setup NodeJS - if: ${{ needs.changes.outputs.changes == 'true' }} uses: ./.github/actions/setup-nodejs - name: Run pnpm lint - if: ${{ needs.changes.outputs.changes == 'true' }} run: pnpm lint - name: Collect Metrics - if: ${{ needs.changes.outputs.changes == 'true' }} id: collect-gha-metrics uses: smartcontractkit/push-gha-metrics-action@6f41029bc7f0d0db5827f6804a2322e2a89e3b32 with: @@ -287,19 +120,17 @@ jobs: run: working-directory: contracts needs: [changes] + if: needs.changes.outputs.changes == 'true' name: Prettier Formatting runs-on: ubuntu-latest steps: - name: Checkout the repo uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - name: Setup NodeJS - if: ${{ needs.changes.outputs.changes == 'true' }} uses: ./.github/actions/setup-nodejs - name: Run prettier check - if: ${{ needs.changes.outputs.changes == 'true' }} run: pnpm prettier:check - name: Collect Metrics - if: ${{ needs.changes.outputs.changes == 'true' }} id: collect-gha-metrics uses: smartcontractkit/push-gha-metrics-action@6f41029bc7f0d0db5827f6804a2322e2a89e3b32 with: diff --git a/GNUmakefile b/GNUmakefile index 0feef78effd..b9d11a7cbc6 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -89,36 +89,6 @@ operator-ui: ## Fetch the frontend abigen: ## Build & install abigen. ./tools/bin/build_abigen -.PHONY: go-solidity-wrappers -go-solidity-wrappers: pnpmdep abigen ## Recompiles solidity contracts and their go wrappers. - go generate ./core/gethwrappers - -.PHONY: go-solidity-wrappers-transmission -go-solidity-wrappers-transmission: pnpmdep abigen ## Recompiles solidity contracts and their go wrappers. - ./contracts/scripts/native_solc_compile_all_transmission - go generate ./core/gethwrappers/transmission - -.PHONY: go-solidity-wrappers-ocr2vrf -go-solidity-wrappers-ocr2vrf: pnpmdep abigen ## Recompiles solidity contracts and their go wrappers. - ./contracts/scripts/native_solc_compile_all_ocr2vrf - # replace the go:generate_disabled directive with the regular go:generate directive - sed -i '' 's/go:generate_disabled/go:generate/g' core/gethwrappers/ocr2vrf/go_generate.go - go generate ./core/gethwrappers/ocr2vrf - go generate ./core/internal/mocks - # put the go:generate_disabled directive back - sed -i '' 's/go:generate/go:generate_disabled/g' core/gethwrappers/ocr2vrf/go_generate.go - - -.PHONY: go-solidity-wrappers-functions -go-solidity-wrappers-functions: pnpmdep abigen ## Recompiles solidity contracts and their go wrappers. - ./contracts/scripts/native_solc_compile_all_functions - go generate ./core/gethwrappers/functions/go_generate.go - -.PHONY: go-solidity-wrappers-llo -go-solidity-wrappers-llo: pnpmdep abigen ## Recompiles solidity contracts and their go wrappers. - ./contracts/scripts/native_solc_compile_all_llo - go generate ./core/gethwrappers/llo-feeds/go_generate.go - .PHONY: generate generate: abigen codecgen mockery ## Execute all go:generate commands. go generate -x ./... @@ -177,9 +147,6 @@ config-docs: ## Generate core node configuration documentation golangci-lint: ## Run golangci-lint for all issues. docker run --rm -v $(shell pwd):/app -w /app golangci/golangci-lint:v1.53.2 golangci-lint run --max-issues-per-linter 0 --max-same-issues 0 > golangci-lint-output.txt -.PHONY: snapshot -snapshot: - cd ./contracts && forge snapshot --match-test _gas GORELEASER_CONFIG ?= .goreleaser.yaml diff --git a/contracts/.gas-snapshot b/contracts/.gas-snapshot deleted file mode 100644 index 34c7e6a348a..00000000000 --- a/contracts/.gas-snapshot +++ /dev/null @@ -1,8 +0,0 @@ -FunctionsOracle_setDONPublicKey:testSetDONPublicKey_gas() (gas: 97558) -FunctionsOracle_setRegistry:testSetRegistry_gas() (gas: 31987) -Verifier_accessControlledVerify:testVerifyWithAccessControl_gas() (gas: 207063) -Verifier_setConfig:testSetConfigSuccess_gas() (gas: 922517) -Verifier_verify:testVerifyProxySuccess_gas() (gas: 197508) -Verifier_verify:testVerifySuccess_gas() (gas: 182991) -Verifier_verifyWithFee:testVerifyProxyWithLinkFeeSuccess_gas() (gas: 245475) -Verifier_verifyWithFee:testVerifyProxyWithNativeFeeSuccess_gas() (gas: 262092) \ No newline at end of file diff --git a/contracts/GNUmakefile b/contracts/GNUmakefile new file mode 100644 index 00000000000..ea70ae43f93 --- /dev/null +++ b/contracts/GNUmakefile @@ -0,0 +1,80 @@ +# ALL_FOUNDRY_PRODUCTS contains a list of all products that have a foundry +# profile defined. Adding a product to this list will make it available for +# snapshotting. +ALL_FOUNDRY_PRODUCTS = vrf automation llo-feeds functions automation-dev shared + +# To make a snapshot for a specific product, either set the `FOUNDRY_PROFILE` env var +# or call the target with `FOUNDRY_PROFILE=product` +# When developing with Foundry, you'll most likely already have the env var set +# to run the tests for the product you're working on. In that case, you can just +# call `make snapshot` and it will use the env var. +# env var example +# export FOUNDRY_PROFILE=llo-feeds +# make snapshot +# make call example +# make FOUNDRY_PROFILE=llo-feeds snapshot +.PHONY: snapshot +snapshot: ## Make a snapshot for a specific product. + export FOUNDRY_PROFILE=$(FOUNDRY_PROFILE) && forge snapshot --snap gas-snapshots/$(FOUNDRY_PROFILE).gas-snapshot + +.PHONY: snapshot-all +snapshot-all: ## Make a snapshot for all products. + for foundry_profile in $(ALL_FOUNDRY_PRODUCTS) ; do \ + make snapshot FOUNDRY_PROFILE=$$foundry_profile ; \ + done + +.PHONY: pnpmdep +pnpmdep: ## Install solidity contract dependencies through pnpm + pnpm i + +.PHONY: abigen +abigen: ## Build & install abigen. + ../tools/bin/build_abigen + + +# To generate gethwrappers for a specific product, either set the `FOUNDRY_PROFILE` +# env var or call the target with `FOUNDRY_PROFILE=product` +# This uses FOUNDRY_PROFILE, even though it does support non-foundry products. This +# is to improve the workflow for developers working with Foundry, which is the +# recommended way to develop Solidity for CL products. +# env var example +# export FOUNDRY_PROFILE=llo-feeds +# make wrappers +# make call example +# make FOUNDRY_PROFILE=llo-feeds wrappers +.PHONY: wrappers +wrappers: pnpmdep abigen ## Recompiles solidity contracts and their go wrappers. + ./scripts/native_solc_compile_all_$(FOUNDRY_PROFILE) + go generate ../core/gethwrappers/$(FOUNDRY_PROFILE) + +# This call generates all gethwrappers for all products. It does so based on the +# assumption that native_solc_compile_all contains sub-calls to each product, and +# go_generate does the same. +.PHONY: wrappers-all +wrappers-all: pnpmdep abigen ## Recompiles solidity contracts and their go wrappers. + # go_generate contains a call to compile all contracts before generating wrappers + go generate ../core/gethwrappers/go_generate.go + +# Custom wrapper generation for OCR2VRF as their contracts do not exist in this repo +.PHONY: go-solidity-wrappers-ocr2vrf +go-solidity-wrappers-ocr2vrf: pnpmdep abigen ## Recompiles OCR2VRF solidity contracts and their go wrappers. + ./scripts/native_solc_compile_all_ocr2vrf + # replace the go:generate_disabled directive with the regular go:generate directive + sed -i '' 's/go:generate_disabled/go:generate/g' ../core/gethwrappers/ocr2vrf/go_generate.go + go generate ../core/gethwrappers/ocr2vrf + go generate ../core/internal/mocks + # put the go:generate_disabled directive back + sed -i '' 's/go:generate/go:generate_disabled/g' ../core/gethwrappers/ocr2vrf/go_generate.go + + +help: + @echo "" + @echo " .__ .__ .__ .__ __" + @echo " ____ | |__ _____ |__| ____ | | |__| ____ | | __" + @echo " _/ ___\| | \\\\\\__ \ | |/ \| | | |/ \| |/ /" + @echo " \ \___| Y \/ __ \| | | \ |_| | | \ <" + @echo " \___ >___| (____ /__|___| /____/__|___| /__|_ \\" + @echo " \/ \/ \/ \/ \/ \/" + @echo "" + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | \ + awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' diff --git a/contracts/foundry.toml b/contracts/foundry.toml index f7b3f8b39ad..c1da24ad814 100644 --- a/contracts/foundry.toml +++ b/contracts/foundry.toml @@ -33,4 +33,23 @@ src = 'src/v0.8/automation' test = 'src/v0.8/automation/test' solc_version = '0.8.6' +[profile.automation-dev] +optimizer_runs = 10000 +src = 'src/v0.8/dev/automation' +test = 'src/v0.8/dev/automation/test' + +[profile.llo-feeds] +optimizer_runs = 1000000 +src = 'src/v0.8/llo-feeds' +test = 'src/v0.8/llo-feeds/test' +solc_version = '0.8.16' + +[profile.shared] +optimizer_runs = 1000000 +src = 'src/v0.8/shared' +test = 'src/v0.8/shared/test' +solc_version = '0.8.19' +deny_warnings = true + + # See more config options https://github.com/foundry-rs/foundry/tree/master/config diff --git a/contracts/gas-snapshots/automation-dev.gas-snapshot b/contracts/gas-snapshots/automation-dev.gas-snapshot new file mode 100644 index 00000000000..1a939d69e19 --- /dev/null +++ b/contracts/gas-snapshots/automation-dev.gas-snapshot @@ -0,0 +1,5 @@ +AutomationForwarder_forward:testBasicSuccess() (gas: 87630) +AutomationForwarder_forward:testNotAuthorizedReverts() (gas: 21681) +AutomationForwarder_forward:testWrongFunctionSelectorSuccess() (gas: 17958) +AutomationForwarder_updateRegistry:testBasicSuccess() (gas: 14577) +AutomationForwarder_updateRegistry:testNotFromRegistryNotAuthorizedReverts() (gas: 13893) \ No newline at end of file diff --git a/contracts/gas-snapshots/automation.gas-snapshot b/contracts/gas-snapshots/automation.gas-snapshot new file mode 100644 index 00000000000..934aebf982d --- /dev/null +++ b/contracts/gas-snapshots/automation.gas-snapshot @@ -0,0 +1,8 @@ +HeartbeatRequester_getAggregatorRequestHeartbeat:testBasicSuccess() (gas: 75412) +HeartbeatRequester_getAggregatorRequestHeartbeat:testHeartbeatNotPermittedReverts() (gas: 21730) +HeartbeatRequester_permitHeartbeat:testBasicDeployerSuccess() (gas: 48280) +HeartbeatRequester_permitHeartbeat:testBasicSuccess() (gas: 45856) +HeartbeatRequester_permitHeartbeat:testOnlyCallableByOwnerReverts() (gas: 13796) +HeartbeatRequester_removeHeartbeat:testBasicSuccess() (gas: 30192) +HeartbeatRequester_removeHeartbeat:testOnlyCallableByOwnerReverts() (gas: 11629) +HeartbeatRequester_removeHeartbeat:testRemoveNoPermitsSuccess() (gas: 15660) \ No newline at end of file diff --git a/contracts/gas-snapshots/functions.gas-snapshot b/contracts/gas-snapshots/functions.gas-snapshot new file mode 100644 index 00000000000..bda023cf117 --- /dev/null +++ b/contracts/gas-snapshots/functions.gas-snapshot @@ -0,0 +1,11 @@ +FunctionsOracle_sendRequest:testEmptyRequestDataReverts() (gas: 13430) +FunctionsOracle_setDONPublicKey:testEmptyPublicKeyReverts() (gas: 10974) +FunctionsOracle_setDONPublicKey:testOnlyOwnerReverts() (gas: 11255) +FunctionsOracle_setDONPublicKey:testSetDONPublicKeySuccess() (gas: 126453) +FunctionsOracle_setDONPublicKey:testSetDONPublicKey_gas() (gas: 97558) +FunctionsOracle_setRegistry:testEmptyPublicKeyReverts() (gas: 10635) +FunctionsOracle_setRegistry:testOnlyOwnerReverts() (gas: 10927) +FunctionsOracle_setRegistry:testSetRegistrySuccess() (gas: 35791) +FunctionsOracle_setRegistry:testSetRegistry_gas() (gas: 31987) +FunctionsOracle_typeAndVersion:testTypeAndVersionSuccess() (gas: 6905) +FunctionsRouter_createSubscription:testCreateSubscriptionSuccess() (gas: 111376) \ No newline at end of file diff --git a/contracts/gas-snapshots/llo-feeds.gas-snapshot b/contracts/gas-snapshots/llo-feeds.gas-snapshot new file mode 100644 index 00000000000..b643c6f8cd8 --- /dev/null +++ b/contracts/gas-snapshots/llo-feeds.gas-snapshot @@ -0,0 +1,219 @@ +FeeManagerProcessFeeTest:test_DiscountIsAppliedForNative() (gas: 47654) +FeeManagerProcessFeeTest:test_V1PayloadVerifies() (gas: 17377) +FeeManagerProcessFeeTest:test_V2PayloadVerifies() (gas: 104591) +FeeManagerProcessFeeTest:test_V2PayloadWithoutQuoteFails() (gas: 19950) +FeeManagerProcessFeeTest:test_V2PayloadWithoutZeroFee() (gas: 62375) +FeeManagerProcessFeeTest:test_WithdrawERC20() (gas: 62862) +FeeManagerProcessFeeTest:test_WithdrawNonAdminAddr() (gas: 48655) +FeeManagerProcessFeeTest:test_WithdrawUnwrappedNative() (gas: 20266) +FeeManagerProcessFeeTest:test_baseFeeIsAppliedForLink() (gas: 15021) +FeeManagerProcessFeeTest:test_baseFeeIsAppliedForNative() (gas: 17517) +FeeManagerProcessFeeTest:test_correctDiscountIsAppliedWhenBothTokensAreDiscounted() (gas: 83916) +FeeManagerProcessFeeTest:test_discountAIsNotAppliedWhenSetForOtherUsers() (gas: 51279) +FeeManagerProcessFeeTest:test_discountFeeRoundsDownWhenUneven() (gas: 47800) +FeeManagerProcessFeeTest:test_discountIsAppliedForLink() (gas: 45109) +FeeManagerProcessFeeTest:test_discountIsAppliedWith100PercentSurcharge() (gas: 71303) +FeeManagerProcessFeeTest:test_discountIsNoLongerAppliedAfterRemoving() (gas: 41064) +FeeManagerProcessFeeTest:test_discountIsNotAppliedForInvalidTokenAddress() (gas: 12439) +FeeManagerProcessFeeTest:test_discountIsNotAppliedToOtherFeeds() (gas: 49326) +FeeManagerProcessFeeTest:test_emptyQuoteRevertsWithError() (gas: 12305) +FeeManagerProcessFeeTest:test_eventIsEmittedAfterSurchargeIsSet() (gas: 36250) +FeeManagerProcessFeeTest:test_eventIsEmittedUponWithdraw() (gas: 59974) +FeeManagerProcessFeeTest:test_feeIsUpdatedAfterDiscountIsRemoved() (gas: 43550) +FeeManagerProcessFeeTest:test_feeIsUpdatedAfterNewDiscountIsApplied() (gas: 60124) +FeeManagerProcessFeeTest:test_feeIsUpdatedAfterNewSurchargeIsApplied() (gas: 56407) +FeeManagerProcessFeeTest:test_feeIsZeroWith100PercentDiscount() (gas: 47510) +FeeManagerProcessFeeTest:test_getBaseRewardWithLinkQuote() (gas: 15064) +FeeManagerProcessFeeTest:test_getLinkFeeIsRoundedUp() (gas: 45278) +FeeManagerProcessFeeTest:test_getLinkRewardIsRoundedDown() (gas: 45180) +FeeManagerProcessFeeTest:test_getLinkRewardWithNativeQuoteAndSurchargeWithLinkDiscount() (gas: 74934) +FeeManagerProcessFeeTest:test_getRewardWithLinkDiscount() (gas: 45087) +FeeManagerProcessFeeTest:test_getRewardWithLinkQuoteAndLinkDiscount() (gas: 45110) +FeeManagerProcessFeeTest:test_getRewardWithNativeQuote() (gas: 17540) +FeeManagerProcessFeeTest:test_getRewardWithNativeQuoteAndSurcharge() (gas: 45608) +FeeManagerProcessFeeTest:test_linkAvailableForPaymentReturnsLinkBalance() (gas: 47416) +FeeManagerProcessFeeTest:test_nativeSurcharge0Percent() (gas: 25630) +FeeManagerProcessFeeTest:test_nativeSurcharge100Percent() (gas: 45644) +FeeManagerProcessFeeTest:test_nativeSurchargeCannotExceed100Percent() (gas: 12085) +FeeManagerProcessFeeTest:test_nativeSurchargeEventIsEmittedOnUpdate() (gas: 36252) +FeeManagerProcessFeeTest:test_noFeeIsAppliedWhenReportHasZeroFee() (gas: 47172) +FeeManagerProcessFeeTest:test_noFeeIsAppliedWhenReportHasZeroFeeAndDiscountAndSurchargeIsSet() (gas: 70762) +FeeManagerProcessFeeTest:test_nonAdminProxyUserCannotProcessFee() (gas: 19062) +FeeManagerProcessFeeTest:test_nonAdminUserCanNotSetDiscount() (gas: 14751) +FeeManagerProcessFeeTest:test_processFeeAsProxy() (gas: 105088) +FeeManagerProcessFeeTest:test_processFeeDefaultReportsStillVerifiesWithEmptyQuote() (gas: 18170) +FeeManagerProcessFeeTest:test_processFeeEmitsEventIfNotEnoughLink() (gas: 121568) +FeeManagerProcessFeeTest:test_processFeeIfSubscriberIsSelf() (gas: 19197) +FeeManagerProcessFeeTest:test_processFeeNative() (gas: 154869) +FeeManagerProcessFeeTest:test_processFeeUsesCorrectDigest() (gas: 106112) +FeeManagerProcessFeeTest:test_processFeeWithDefaultReportPayloadAndQuoteStillVerifies() (gas: 20509) +FeeManagerProcessFeeTest:test_processFeeWithInvalidReportVersion() (gas: 21997) +FeeManagerProcessFeeTest:test_processFeeWithUnwrappedNative() (gas: 159309) +FeeManagerProcessFeeTest:test_processFeeWithUnwrappedNativeLinkAddress() (gas: 68253) +FeeManagerProcessFeeTest:test_processFeeWithUnwrappedNativeShortFunds() (gas: 72784) +FeeManagerProcessFeeTest:test_processFeeWithUnwrappedNativeWithExcessiveFee() (gas: 166315) +FeeManagerProcessFeeTest:test_processFeeWithWithCorruptQuotePayload() (gas: 19786) +FeeManagerProcessFeeTest:test_processFeeWithWithEmptyQuotePayload() (gas: 20264) +FeeManagerProcessFeeTest:test_processFeeWithWithZeroQuotePayload() (gas: 21226) +FeeManagerProcessFeeTest:test_reportWithNoExpiryOrFeeReturnsZero() (gas: 10966) +FeeManagerProcessFeeTest:test_setDiscountOver100Percent() (gas: 14453) +FeeManagerProcessFeeTest:test_subscriberDiscountEventIsEmittedOnUpdate() (gas: 41119) +FeeManagerProcessFeeTest:test_surchargeFeeRoundsUpWhenUneven() (gas: 45937) +FeeManagerProcessFeeTest:test_surchargeIsApplied() (gas: 45905) +FeeManagerProcessFeeTest:test_surchargeIsAppliedForNativeFeeWithDiscount() (gas: 71618) +FeeManagerProcessFeeTest:test_surchargeIsNoLongerAppliedAfterRemoving() (gas: 40744) +FeeManagerProcessFeeTest:test_surchargeIsNotAppliedForLinkFee() (gas: 45125) +FeeManagerProcessFeeTest:test_surchargeIsNotAppliedWith100PercentDiscount() (gas: 71116) +FeeManagerProcessFeeTest:test_testRevertIfReportHasExpired() (gas: 15561) +RewardManagerClaimTest:test_claimAllRecipients() (gas: 257750) +RewardManagerClaimTest:test_claimMultipleRecipients() (gas: 143154) +RewardManagerClaimTest:test_claimRewardsWithDuplicatPoolIdsDoesNotPayoutTwice() (gas: 306046) +RewardManagerClaimTest:test_claimSingleRecipient() (gas: 82153) +RewardManagerClaimTest:test_claimUnevenAmountRoundsDown() (gas: 291448) +RewardManagerClaimTest:test_claimUnregisteredPoolId() (gas: 33836) +RewardManagerClaimTest:test_claimUnregisteredRecipient() (gas: 35153) +RewardManagerClaimTest:test_eventIsEmittedUponClaim() (gas: 79828) +RewardManagerClaimTest:test_eventIsNotEmittedUponUnsuccessfulClaim() (gas: 24119) +RewardManagerClaimTest:test_recipientsClaimMultipleDeposits() (gas: 345435) +RewardManagerClaimTest:test_singleRecipientClaimMultipleDeposits() (gas: 122526) +RewardManagerNoRecipientSet:test_claimAllRecipientsAfterRecipientsSet() (gas: 456069) +RewardManagerPayRecipientsTest:test_addFundsToPoolAsNonOwnerOrFeeManager() (gas: 12746) +RewardManagerPayRecipientsTest:test_addFundsToPoolAsOwner() (gas: 48620) +RewardManagerPayRecipientsTest:test_payAllRecipients() (gas: 239952) +RewardManagerPayRecipientsTest:test_payAllRecipientsFromNonAdminUser() (gas: 15490) +RewardManagerPayRecipientsTest:test_payAllRecipientsFromRecipientInPool() (gas: 240242) +RewardManagerPayRecipientsTest:test_payAllRecipientsWithAdditionalInvalidRecipient() (gas: 251334) +RewardManagerPayRecipientsTest:test_payAllRecipientsWithAdditionalUnregisteredRecipient() (gas: 254496) +RewardManagerPayRecipientsTest:test_payRecipientWithInvalidPool() (gas: 28014) +RewardManagerPayRecipientsTest:test_payRecipientsEmptyRecipientList() (gas: 19996) +RewardManagerPayRecipientsTest:test_payRecipientsWithInvalidPoolId() (gas: 43841) +RewardManagerPayRecipientsTest:test_paySingleRecipient() (gas: 78279) +RewardManagerPayRecipientsTest:test_paySubsetOfRecipientsInPool() (gas: 189107) +RewardManagerRecipientClaimDifferentWeightsTest:test_allRecipientsClaimingReceiveExpectedAmount() (gas: 260811) +RewardManagerRecipientClaimMultiplePoolsTest:test_claimAllRecipientsMultiplePools() (gas: 476699) +RewardManagerRecipientClaimMultiplePoolsTest:test_claimAllRecipientsSinglePool() (gas: 263819) +RewardManagerRecipientClaimMultiplePoolsTest:test_claimEmptyPoolWhenSecondPoolContainsFunds() (gas: 270760) +RewardManagerRecipientClaimMultiplePoolsTest:test_claimMultipleRecipientsMultiplePools() (gas: 243846) +RewardManagerRecipientClaimMultiplePoolsTest:test_claimMultipleRecipientsSinglePool() (gas: 143216) +RewardManagerRecipientClaimMultiplePoolsTest:test_claimSingleRecipientMultiplePools() (gas: 122217) +RewardManagerRecipientClaimMultiplePoolsTest:test_claimSingleUniqueRecipient() (gas: 96657) +RewardManagerRecipientClaimMultiplePoolsTest:test_claimUnevenAmountRoundsDown() (gas: 532419) +RewardManagerRecipientClaimMultiplePoolsTest:test_claimUnregisteredRecipient() (gas: 55393) +RewardManagerRecipientClaimMultiplePoolsTest:test_getRewardsAvailableToRecipientInBothPools() (gas: 24031) +RewardManagerRecipientClaimMultiplePoolsTest:test_getRewardsAvailableToRecipientInNoPools() (gas: 18192) +RewardManagerRecipientClaimMultiplePoolsTest:test_getRewardsAvailableToRecipientInSinglePool() (gas: 21793) +RewardManagerRecipientClaimMultiplePoolsTest:test_recipientsClaimMultipleDeposits() (gas: 349885) +RewardManagerRecipientClaimMultiplePoolsTest:test_singleRecipientClaimMultipleDeposits() (gas: 122542) +RewardManagerRecipientClaimUnevenWeightTest:test_allRecipientsClaimingReceiveExpectedAmount() (gas: 184329) +RewardManagerRecipientClaimUnevenWeightTest:test_allRecipientsClaimingReceiveExpectedAmountWithSmallDeposit() (gas: 204221) +RewardManagerSetRecipientsTest:test_eventIsEmittedUponSetRecipients() (gas: 185494) +RewardManagerSetRecipientsTest:test_setRecipientContainsDuplicateRecipients() (gas: 117290) +RewardManagerSetRecipientsTest:test_setRewardRecipientFromManagerAddress() (gas: 185271) +RewardManagerSetRecipientsTest:test_setRewardRecipientFromNonOwnerOrFeeManagerAddress() (gas: 16348) +RewardManagerSetRecipientsTest:test_setRewardRecipientTwice() (gas: 184667) +RewardManagerSetRecipientsTest:test_setRewardRecipientWeights() (gas: 174935) +RewardManagerSetRecipientsTest:test_setRewardRecipientWithZeroAddress() (gas: 84821) +RewardManagerSetRecipientsTest:test_setRewardRecipientWithZeroWeight() (gas: 177469) +RewardManagerSetRecipientsTest:test_setRewardRecipients() (gas: 179469) +RewardManagerSetRecipientsTest:test_setRewardRecipientsIsEmpty() (gas: 82005) +RewardManagerSetRecipientsTest:test_setSingleRewardRecipient() (gas: 105112) +RewardManagerSetupTest:test_eventEmittedUponFeeManagerUpdate() (gas: 16365) +RewardManagerSetupTest:test_eventEmittedUponFeePaid() (gas: 250264) +RewardManagerSetupTest:test_rejectsZeroLinkAddressOnConstruction() (gas: 59044) +RewardManagerSetupTest:test_setFeeManagerZeroAddress() (gas: 12015) +RewardManagerUpdateRewardRecipientsMultiplePoolsTest:test_updatePrimaryRecipientWeights() (gas: 342516) +RewardManagerUpdateRewardRecipientsTest:test_eventIsEmittedUponUpdateRecipients() (gas: 267066) +RewardManagerUpdateRewardRecipientsTest:test_onlyAdminCanUpdateRecipients() (gas: 14622) +RewardManagerUpdateRewardRecipientsTest:test_partialUpdateRecipientWeights() (gas: 197909) +RewardManagerUpdateRewardRecipientsTest:test_updateAllRecipientsWithSameAddressAndWeight() (gas: 261004) +RewardManagerUpdateRewardRecipientsTest:test_updatePartialRecipientsToSubset() (gas: 235391) +RewardManagerUpdateRewardRecipientsTest:test_updatePartialRecipientsWithExcessiveWeight() (gas: 248952) +RewardManagerUpdateRewardRecipientsTest:test_updatePartialRecipientsWithSameAddressAndWeight() (gas: 141088) +RewardManagerUpdateRewardRecipientsTest:test_updatePartialRecipientsWithUnderWeightSet() (gas: 249017) +RewardManagerUpdateRewardRecipientsTest:test_updateRecipientWeights() (gas: 337998) +RewardManagerUpdateRewardRecipientsTest:test_updateRecipientWithNewZeroAddress() (gas: 247682) +RewardManagerUpdateRewardRecipientsTest:test_updateRecipientsContainsDuplicateRecipients() (gas: 274972) +RewardManagerUpdateRewardRecipientsTest:test_updateRecipientsToDifferentLargerSet() (gas: 250186) +RewardManagerUpdateRewardRecipientsTest:test_updateRecipientsToDifferentPartialSet() (gas: 248406) +RewardManagerUpdateRewardRecipientsTest:test_updateRecipientsToDifferentSet() (gas: 249627) +RewardManagerUpdateRewardRecipientsTest:test_updateRecipientsToDifferentSetWithInvalidWeights() (gas: 248516) +RewardManagerUpdateRewardRecipientsTest:test_updateRecipientsUpdateAndRemoveExistingForLargerSet() (gas: 241638) +RewardManagerUpdateRewardRecipientsTest:test_updateRecipientsUpdateAndRemoveExistingForSmallerSet() (gas: 239964) +VerificationdeactivateConfigWhenThereAreMultipleDigestsTest:test_correctlyRemovesAMiddleDigest() (gas: 24243) +VerificationdeactivateConfigWhenThereAreMultipleDigestsTest:test_correctlyRemovesTheFirstDigest() (gas: 24210) +VerificationdeactivateConfigWhenThereAreMultipleDigestsTest:test_correctlyUnsetsDigestsInSequence() (gas: 44316) +VerificationdeactivateConfigWhenThereAreMultipleDigestsTest:test_revertsIfCalledByNonOwner() (gas: 11322) +VerificationdeactivateConfigWhenThereAreMultipleDigestsTest:test_revertsIfRemovingAnEmptyDigest() (gas: 10951) +VerificationdeactivateConfigWhenThereAreMultipleDigestsTest:test_revertsIfRemovingAnNonExistentDigest() (gas: 13425) +VerifierActivateConfigTest:test_revertsIfDigestIsEmpty() (gas: 10939) +VerifierActivateConfigTest:test_revertsIfDigestNotSet() (gas: 13371) +VerifierActivateConfigTest:test_revertsIfNotOwner() (gas: 13410) +VerifierActivateConfigWithDeactivatedConfigTest:test_allowsVerification() (gas: 93459) +VerifierActivateFeedTest:test_revertsIfNoFeedExistsActivate() (gas: 13179) +VerifierActivateFeedTest:test_revertsIfNoFeedExistsDeactivate() (gas: 13179) +VerifierActivateFeedTest:test_revertsIfNotOwnerActivateFeed() (gas: 13360) +VerifierActivateFeedTest:test_revertsIfNotOwnerDeactivateFeed() (gas: 13437) +VerifierConstructorTest:test_revertsIfInitializedWithEmptyVerifierProxy() (gas: 59818) +VerifierConstructorTest:test_setsTheCorrectProperties() (gas: 1678828) +VerifierDeactivateFeedWithVerifyTest:test_currentReportAllowsVerification() (gas: 188309) +VerifierDeactivateFeedWithVerifyTest:test_currentReportFailsVerification() (gas: 109640) +VerifierDeactivateFeedWithVerifyTest:test_previousReportAllowsVerification() (gas: 95886) +VerifierDeactivateFeedWithVerifyTest:test_previousReportFailsVerification() (gas: 66198) +VerifierProxyAccessControlledVerificationTest:test_proxiesToTheVerifierIfHasAccess() (gas: 203049) +VerifierProxyAccessControlledVerificationTest:test_revertsIfNoAccess() (gas: 105809) +VerifierProxyConstructorTest:test_correctlySetsTheCorrectAccessControllerInterface() (gas: 1073832) +VerifierProxyConstructorTest:test_correctlySetsTheOwner() (gas: 1053935) +VerifierProxyConstructorTest:test_correctlySetsVersion() (gas: 6939) +VerifierProxyInitializeVerifierTest:test_revertsIfDigestAlreadySet() (gas: 50301) +VerifierProxyInitializeVerifierTest:test_revertsIfNotCorrectVerifier() (gas: 13573) +VerifierProxyInitializeVerifierTest:test_revertsIfNotOwner() (gas: 13375) +VerifierProxyInitializeVerifierTest:test_revertsIfVerifierAlreadyInitialized() (gas: 41915) +VerifierProxyInitializeVerifierTest:test_revertsIfZeroAddress() (gas: 10904) +VerifierProxyInitializeVerifierTest:test_setFeeManagerZeroAddress() (gas: 10913) +VerifierProxyInitializeVerifierTest:test_updatesVerifierIfVerifier() (gas: 49628) +VerifierProxySetAccessControllerTest:test_emitsTheCorrectEvent() (gas: 35384) +VerifierProxySetAccessControllerTest:test_revertsIfCalledByNonOwner() (gas: 11367) +VerifierProxySetAccessControllerTest:test_successfullySetsNewAccessController() (gas: 32075) +VerifierProxySetAccessControllerTest:test_successfullySetsNewAccessControllerIsEmpty() (gas: 12174) +VerifierProxyUnsetVerifierTest:test_revertsIfDigestDoesNotExist() (gas: 13174) +VerifierProxyUnsetVerifierTest:test_revertsIfNotAdmin() (gas: 11249) +VerifierProxyUnsetVerifierWithPreviouslySetVerifierTest:test_correctlyUnsetsVerifier() (gas: 12719) +VerifierProxyUnsetVerifierWithPreviouslySetVerifierTest:test_emitsAnEventAfterUnsettingVerifier() (gas: 17965) +VerifierProxyVerifyTest:test_proxiesToTheCorrectVerifier() (gas: 200395) +VerifierProxyVerifyTest:test_revertsIfNoVerifierConfigured() (gas: 108443) +VerifierSetConfigTest:test_correctlyUpdatesTheConfig() (gas: 1057727) +VerifierSetConfigTest:test_revertsIfCalledByNonOwner() (gas: 179223) +VerifierSetConfigTest:test_revertsIfDuplicateSigners() (gas: 251512) +VerifierSetConfigTest:test_revertsIfFaultToleranceIsZero() (gas: 176522) +VerifierSetConfigTest:test_revertsIfNotEnoughSigners() (gas: 15814) +VerifierSetConfigTest:test_revertsIfSetWithTooManySigners() (gas: 22170) +VerifierSetConfigTest:test_revertsIfSignerContainsZeroAddress() (gas: 227942) +VerifierSetConfigWhenThereAreMultipleDigestsTest:test_correctlySetsConfigWhenDigestsAreRemoved() (gas: 538532) +VerifierSetConfigWhenThereAreMultipleDigestsTest:test_correctlyUpdatesDigestsOnMultipleVerifiersInTheProxy() (gas: 963972) +VerifierSetConfigWhenThereAreMultipleDigestsTest:test_correctlyUpdatesTheDigestInTheProxy() (gas: 520054) +VerifierSupportsInterfaceTest:test_falseIfIsNotCorrectInterface() (gas: 5590) +VerifierSupportsInterfaceTest:test_trueIfIsCorrectInterface() (gas: 5611) +VerifierTestBillingReport:test_verifyWithLink() (gas: 274052) +VerifierTestBillingReport:test_verifyWithNative() (gas: 252372) +VerifierTestBillingReport:test_verifyWithNativeUnwrapped() (gas: 263437) +VerifierTestBillingReport:test_verifyWithNativeUnwrappedReturnsChange() (gas: 270504) +VerifierVerifyMultipleConfigDigestTest:test_canVerifyNewerReportsWithNewerConfigs() (gas: 127500) +VerifierVerifyMultipleConfigDigestTest:test_canVerifyOlderReportsWithOlderConfigs() (gas: 183379) +VerifierVerifyMultipleConfigDigestTest:test_revertsIfAReportIsVerifiedWithAnExistingButIncorrectDigest() (gas: 84470) +VerifierVerifyMultipleConfigDigestTest:test_revertsIfVerifyingWithAnUnsetDigest() (gas: 124369) +VerifierVerifySingleConfigDigestTest:test_emitsAnEventIfReportVerified() (gas: 183237) +VerifierVerifySingleConfigDigestTest:test_returnsThePriceAndBlockNumIfReportVerified() (gas: 183406) +VerifierVerifySingleConfigDigestTest:test_revertsIfConfigDigestNotSet() (gas: 112459) +VerifierVerifySingleConfigDigestTest:test_revertsIfDuplicateSignersHaveSigned() (gas: 178601) +VerifierVerifySingleConfigDigestTest:test_revertsIfMismatchedSignatureLength() (gas: 49278) +VerifierVerifySingleConfigDigestTest:test_revertsIfReportHasUnconfiguredFeedID() (gas: 100262) +VerifierVerifySingleConfigDigestTest:test_revertsIfVerifiedByNonProxy() (gas: 101024) +VerifierVerifySingleConfigDigestTest:test_revertsIfVerifiedWithIncorrectAddresses() (gas: 180352) +VerifierVerifySingleConfigDigestTest:test_revertsIfWrongNumberOfSigners() (gas: 106317) +VerifierVerifySingleConfigDigestTest:test_setsTheCorrectEpoch() (gas: 190539) +Verifier_accessControlledVerify:testVerifyWithAccessControl_gas() (gas: 207063) +Verifier_setConfig:testSetConfigSuccess_gas() (gas: 922517) +Verifier_verify:testVerifyProxySuccess_gas() (gas: 197508) +Verifier_verify:testVerifySuccess_gas() (gas: 182991) +Verifier_verifyWithFee:testVerifyProxyWithLinkFeeSuccess_gas() (gas: 245475) +Verifier_verifyWithFee:testVerifyProxyWithNativeFeeSuccess_gas() (gas: 262092) \ No newline at end of file diff --git a/contracts/gas-snapshots/shared.gas-snapshot b/contracts/gas-snapshots/shared.gas-snapshot new file mode 100644 index 00000000000..e69de29bb2d diff --git a/contracts/gas-snapshots/vrf.gas-snapshot b/contracts/gas-snapshots/vrf.gas-snapshot new file mode 100644 index 00000000000..a6232a44400 --- /dev/null +++ b/contracts/gas-snapshots/vrf.gas-snapshot @@ -0,0 +1,14 @@ +TrustedBlockhashStoreTest:testGenericBHSFunctions() (gas: 53507) +TrustedBlockhashStoreTest:testTrustedBHSFunctions() (gas: 49536) +VRFCoordinatorV2Plus_Migration:testDeregister() (gas: 99350) +VRFCoordinatorV2Plus_Migration:testMigrateRevertsWhenInvalidCaller() (gas: 27277) +VRFCoordinatorV2Plus_Migration:testMigrateRevertsWhenInvalidCoordinator() (gas: 17777) +VRFCoordinatorV2Plus_Migration:testMigrateRevertsWhenPendingFulfillment() (gas: 237557) +VRFCoordinatorV2Plus_Migration:testMigration() (gas: 451067) +VRFV2Plus:testCreateSubscription() (gas: 92494) +VRFV2Plus:testRegisterProvingKey() (gas: 100951) +VRFV2Plus:testRequestAndFulfillRandomWordsLINK() (gas: 667896) +VRFV2Plus:testRequestAndFulfillRandomWordsNative() (gas: 618375) +VRFV2Plus:testSetConfig() (gas: 72991) +VRFV2PlusWrapperTest:testRequestAndFulfillRandomWordsLINKWrapper() (gas: 373063) +VRFV2PlusWrapperTest:testRequestAndFulfillRandomWordsNativeWrapper() (gas: 273557) \ No newline at end of file diff --git a/contracts/scripts/native_solc_compile_all b/contracts/scripts/native_solc_compile_all index 1612bc29976..b90405e7de9 100755 --- a/contracts/scripts/native_solc_compile_all +++ b/contracts/scripts/native_solc_compile_all @@ -12,7 +12,7 @@ python3 -m pip install --require-hashes -r $SCRIPTPATH/requirements.txt # 6 and 7 are legacy contracts, for each other product we have a native_solc_compile_all_$product script # These scripts can be run individually, or all together with this script. # To add new CL products, simply write a native_solc_compile_all_$product script and add it to the list below. -for product in 6 7 feeds functions llo transmission vrf automation logpoller events_mock +for product in 6 7 feeds functions llo-feeds transmission vrf automation logpoller events_mock do $SCRIPTPATH/native_solc_compile_all_$product done diff --git a/contracts/scripts/native_solc_compile_all_llo b/contracts/scripts/native_solc_compile_all_llo-feeds similarity index 100% rename from contracts/scripts/native_solc_compile_all_llo rename to contracts/scripts/native_solc_compile_all_llo-feeds diff --git a/core/gethwrappers/go_generate_test.go b/core/gethwrappers/go_generate_test.go index fa19bc437be..9ded44c0785 100644 --- a/core/gethwrappers/go_generate_test.go +++ b/core/gethwrappers/go_generate_test.go @@ -94,7 +94,7 @@ func compareCurrentCompilerArtifactAgainstRecordsAndSoliditySources( t *testing.T, versionInfo ContractVersion, ) { hash := VersionHash(versionInfo.AbiPath, versionInfo.BinaryPath) - recompileCommand := fmt.Sprintf("(cd %s; make go-solidity-wrappers)", rootDir) + recompileCommand := fmt.Sprintf("(cd %s/contracts; make wrappers-all)", rootDir) assert.Equal(t, versionInfo.Hash, hash, utils.BoxOutput(`compiled %s and/or %s has changed; please rerun %s, @@ -122,7 +122,7 @@ func init() { } fmt.Printf("some solidity artifacts missing (%s); rebuilding...", solidityArtifactsMissing) - // Don't want to run "make go-solidity-wrappers" here, because that would + // Don't want to run "make wrappers-all" here, because that would // result in an infinite loop cmd := exec.Command("bash", "-c", compileCommand) cmd.Stdout = os.Stdout