From 574b947dfcfcb5fa05b46d8961ece29e06b14129 Mon Sep 17 00:00:00 2001 From: Alex Kroeger Date: Mon, 28 Oct 2024 13:54:28 -0700 Subject: [PATCH] add a GitHub workflow for automated bytecode verification, update bridged USDC standard documentation, update the entity name in copyright headers --- .env.example | 2 +- .eslintrc.js | 2 +- .github/composite-actions/setup-ci/action.yml | 8 +- .github/resources/coverage-report-template.md | 2 +- .github/workflows/bytecode-verification.yml | 37 + .github/workflows/check-pr.yml | 50 ++ .github/workflows/ci.yml | 33 +- .github/workflows/coverage.yml | 2 +- .licenseignore | 7 + .nvmrc | 2 +- .solcover.js | 2 +- .vscode/settings.json | 2 +- @types/AnyFiatTokenV2Instance.d.ts | 2 +- @types/TransactionRawLog.d.ts | 2 +- @types/ipfs-only-hash.d.ts | 19 + README.md | 4 +- ...FiatTokenProxyContractCreationBytecode.bin | 1 + ...opMainnetFiatTokenProxyRuntimeBytecode.bin | 1 + contracts/interface/IERC1271.sol | 2 +- contracts/interface/celo/ICeloGasToken.sol | 2 +- contracts/interface/celo/IDecimals.sol | 2 +- .../interface/celo/IFiatTokenFeeAdapter.sol | 2 +- contracts/minting/Controller.sol | 2 +- contracts/minting/MasterMinter.sol | 2 +- contracts/minting/MintController.sol | 2 +- .../minting/MinterManagementInterface.sol | 2 +- .../test/ContractThatCallsPublicFunctions.sol | 2 +- contracts/test/ContractThatReverts.sol | 2 +- .../test/ContractWithExternalFunctions.sol | 2 +- .../test/ContractWithPublicFunctions.sol | 2 +- contracts/test/DummyERC20.sol | 2 +- contracts/test/ECRecoverTest.sol | 2 +- contracts/test/EIP712Test.sol | 2 +- contracts/test/MessageHashUtilsTest.sol | 2 +- contracts/test/MockERC1271Wallet.sol | 2 +- ...nWithEditableBalanceAndBlacklistStates.sol | 2 +- .../test/MockFiatTokenWithEditableChainId.sol | 2 +- ...UpgradedFiatTokenNewFieldsNewLogicTest.sol | 2 +- .../test/UpgradedFiatTokenNewFieldsTest.sol | 2 +- .../UpgradedFiatTokenV2_2NewFieldsTest.sol | 2 +- .../MockFiatTokenCeloWithExposedFunctions.sol | 2 +- ...iatTokenFeeAdapterWithExposedFunctions.sol | 2 +- .../AdminUpgradeabilityProxy.sol | 2 +- contracts/upgradeability/Proxy.sol | 2 +- .../upgradeability/UpgradeabilityProxy.sol | 2 +- contracts/util/ECRecover.sol | 2 +- contracts/util/EIP712.sol | 2 +- contracts/util/MessageHashUtils.sol | 2 +- contracts/util/SignatureChecker.sol | 2 +- contracts/v1.1/FiatTokenV1_1.sol | 2 +- contracts/v1.1/Rescuable.sol | 2 +- contracts/v1/AbstractFiatTokenV1.sol | 2 +- contracts/v1/Blacklistable.sol | 2 +- contracts/v1/FiatTokenProxy.sol | 2 +- contracts/v1/FiatTokenV1.sol | 2 +- contracts/v2/AbstractFiatTokenV2.sol | 2 +- contracts/v2/EIP2612.sol | 2 +- contracts/v2/EIP3009.sol | 2 +- contracts/v2/EIP712Domain.sol | 2 +- contracts/v2/FiatTokenUtil.sol | 2 +- contracts/v2/FiatTokenV2.sol | 2 +- contracts/v2/FiatTokenV2_1.sol | 2 +- contracts/v2/FiatTokenV2_2.sol | 2 +- contracts/v2/celo/FiatTokenCeloV2_2.sol | 2 +- .../v2/celo/FiatTokenFeeAdapterProxy.sol | 2 +- contracts/v2/celo/FiatTokenFeeAdapterV1.sol | 2 +- contracts/v2/upgrader/AbstractV2Upgrader.sol | 2 +- contracts/v2/upgrader/V2Upgrader.sol | 2 +- contracts/v2/upgrader/V2_1Upgrader.sol | 2 +- contracts/v2/upgrader/V2_2Upgrader.sol | 2 +- .../helpers/AbstractUpgraderHelper.sol | 2 +- .../v2/upgrader/helpers/V2UpgraderHelper.sol | 2 +- .../upgrader/helpers/V2_2UpgraderHelper.sol | 2 +- doc/bridged_USDC_standard.md | 49 +- doc/bridged_asset_automated_verification.md | 106 +++ doc/deployment.md | 8 +- doc/metadata_extraction.md | 35 + flatten-generated-types.sh | 2 +- foundry.toml | 2 +- hardhat.config.ts | 4 +- package.json | 83 +- scripts/deploy/DeployImpl.sol | 2 +- scripts/deploy/ScriptUtils.sol | 2 +- scripts/deploy/celo/deploy-fee-adapter.s.sol | 2 +- .../deploy/celo/deploy-fiat-token-celo.s.sol | 2 +- scripts/deploy/deploy-fiat-token.s.sol | 2 +- scripts/deploy/deploy-impl-and-upgrader.s.sol | 2 +- scripts/deploy/deploy-master-minter.s.sol | 2 +- scripts/git/diff-check.sh | 2 +- scripts/git/rebase.sh | 2 +- scripts/hardhat/alternativeArtifacts.ts | 59 ++ .../hardhat/downloadBlacklistedAccounts.ts | 2 +- scripts/hardhat/getContractCreationBlock.ts | 2 +- scripts/hardhat/hardhatArgumentTypes.ts | 2 +- scripts/hardhat/helpers.ts | 24 +- scripts/hardhat/readValuesFromContract.ts | 2 +- .../hardhat/validateAccountsToBlacklist.ts | 2 +- scripts/hardhat/verifyBytecodeOnChain.ts | 180 ---- scripts/hardhat/verifyOnChainBytecode.ts | 541 ++++++++++++ scripts/verifyBridgedTokenBytecode.ts | 244 ++++++ setup.sh | 2 +- test/helpers/constants.ts | 2 +- test/helpers/index.ts | 2 +- test/helpers/storageSlots.behavior.ts | 2 +- test/minting/AccountUtils.js | 2 +- test/minting/ControllerTestUtils.js | 10 +- test/minting/MintControllerTests.js | 15 +- test/minting/MintControllerUtils.js | 9 +- test/minting/MintP0_ArgumentTests.js | 15 +- test/minting/MintP0_BasicTests.js | 19 +- test/minting/MintP0_EndToEndTests.js | 19 +- test/minting/MintP0_EventsTests.js | 2 +- test/misc/gas.ts | 2 +- test/misc/publicToExternal.test.ts | 2 +- test/scripts/deploy/TestUtils.sol | 2 +- .../deploy/celo/deploy-fee-adapter.t.sol | 2 +- .../deploy/celo/deploy-fiat-token-celo.t.sol | 2 +- test/scripts/deploy/deploy-fiat-token.t.sol | 2 +- .../deploy/deploy-impl-and-upgrader.t.sol | 2 +- .../scripts/deploy/deploy-master-minter.t.sol | 2 +- .../hardhat/testData/FiatTokenProxy.bin | 1 + .../testData/FiatTokenProxy.metadata.json | 231 ++++++ .../testData/V2_2UpgraderDeploymentTrace.json | 22 + .../V2_2UpgraderHelperCreationBytecode.bin | 1 + .../hardhat/verifyOnChainBytecode.test.ts | 314 +++++++ test/util/ECRecover.test.ts | 2 +- test/util/EIP712Test.ts | 2 +- test/util/MessageHashUtils.test.ts | 2 +- test/util/SignatureChecker.test.ts | 2 +- test/v1.1/FiatTokenV1_1.test.ts | 2 +- test/v1.1/Rescuable.behavior.ts | 2 +- test/v1.1/Rescuable.test.ts | 2 +- test/v1/FiatTokenV1.test.ts | 2 +- test/v1/Pausable.test.js | 2 +- test/v1/TokenTestUtils.js | 714 ---------------- test/v1/abiHacking.test.js | 2 +- test/v1/events.test.js | 2 +- test/v1/extendedPositive.test.js | 2 +- test/v1/helpers/abi.js | 2 +- test/v1/helpers/tokenTest.js | 72 +- test/v1/helpers/wrapTests.js | 2 +- test/v1/legacy.test.js | 2 +- test/v1/misc.test.js | 2 +- test/v1/negative.test.js | 2 +- test/v1/positive.test.js | 2 +- test/v1/proxyNegative.test.js | 2 +- test/v1/proxyPositive.test.js | 2 +- test/v2/FiatTokenV2.test.ts | 2 +- test/v2/FiatTokenV2_1.test.ts | 2 +- test/v2/FiatTokenV2_2.test.ts | 2 +- .../GasAbstraction/GasAbstraction.behavior.ts | 2 +- test/v2/GasAbstraction/helpers.ts | 2 +- .../GasAbstraction/testCancelAuthorization.ts | 2 +- test/v2/GasAbstraction/testPermit.ts | 2 +- .../testReceiveWithAuthorization.ts | 2 +- .../testTransferWithAuthorization.ts | 2 +- .../testTransferWithMultipleAuthorizations.ts | 2 +- ...hEditableBalanceAndBlacklistStates.test.ts | 2 +- .../MockFiatTokenWithEditableChainId.test.ts | 2 +- test/v2/V2Upgrader.test.ts | 2 +- test/v2/V2_1Upgrader.test.ts | 2 +- test/v2/V2_2Upgrader.test.ts | 2 +- test/v2/celo/FiatTokenCeloV2_2.test.ts | 2 +- test/v2/celo/FiatTokenFeeAdapterV1.test.ts | 2 +- ...kFiatTokenCeloWithExposedFunctions.test.ts | 2 +- ...okenFeeAdapterWithExposedFunctions.test.ts | 2 +- test/v2/safeAllowance.behavior.ts | 2 +- test/v2/v2.behavior.ts | 2 +- test/v2/v2_2.behavior.ts | 2 +- utils.js | 2 +- verification_artifacts/input.template.json | 15 + yarn.lock | 771 ++++++++++++++++-- 172 files changed, 2747 insertions(+), 1248 deletions(-) create mode 100644 .github/workflows/bytecode-verification.yml create mode 100644 .github/workflows/check-pr.yml create mode 100644 @types/ipfs-only-hash.d.ts create mode 100644 cached_artifacts/opMainnetFiatTokenProxyContractCreationBytecode.bin create mode 100644 cached_artifacts/opMainnetFiatTokenProxyRuntimeBytecode.bin create mode 100644 doc/bridged_asset_automated_verification.md create mode 100644 doc/metadata_extraction.md create mode 100644 scripts/hardhat/alternativeArtifacts.ts delete mode 100644 scripts/hardhat/verifyBytecodeOnChain.ts create mode 100644 scripts/hardhat/verifyOnChainBytecode.ts create mode 100644 scripts/verifyBridgedTokenBytecode.ts create mode 100644 test/scripts/hardhat/testData/FiatTokenProxy.bin create mode 100644 test/scripts/hardhat/testData/FiatTokenProxy.metadata.json create mode 100644 test/scripts/hardhat/testData/V2_2UpgraderDeploymentTrace.json create mode 100644 test/scripts/hardhat/testData/V2_2UpgraderHelperCreationBytecode.bin create mode 100644 test/scripts/hardhat/verifyOnChainBytecode.test.ts delete mode 100644 test/v1/TokenTestUtils.js create mode 100644 verification_artifacts/input.template.json diff --git a/.env.example b/.env.example index 267469422..de753c1b6 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,4 @@ -# Copyright 2024 Circle Internet Financial, LTD. All rights reserved. +# Copyright 2024 Circle Internet Group, Inc. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 # diff --git a/.eslintrc.js b/.eslintrc.js index c0f2eb1ed..6580bb89e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,5 +1,5 @@ /** - * Copyright 2023 Circle Internet Financial, LTD. All rights reserved. + * Copyright 2023 Circle Internet Group, Inc. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * diff --git a/.github/composite-actions/setup-ci/action.yml b/.github/composite-actions/setup-ci/action.yml index f07d4cda0..1a55f4a67 100644 --- a/.github/composite-actions/setup-ci/action.yml +++ b/.github/composite-actions/setup-ci/action.yml @@ -1,4 +1,4 @@ -# Copyright 2024 Circle Internet Financial, LTD. All rights reserved. +# Copyright 2024 Circle Internet Group, Inc. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 # @@ -19,9 +19,9 @@ runs: using: composite steps: - name: Install Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: "16.14.0" + node-version: "20.9.0" - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 @@ -40,7 +40,7 @@ runs: shell: bash - name: Retrieve cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} diff --git a/.github/resources/coverage-report-template.md b/.github/resources/coverage-report-template.md index 9a0c5ddc0..e01f08e4e 100644 --- a/.github/resources/coverage-report-template.md +++ b/.github/resources/coverage-report-template.md @@ -1,5 +1,5 @@