diff --git a/.github/actions/cache_foundry_build/action.yml b/.github/actions/cache_foundry_build/action.yml new file mode 100644 index 000000000..e4aaf45ba --- /dev/null +++ b/.github/actions/cache_foundry_build/action.yml @@ -0,0 +1,29 @@ +name: 'Cache foundry build' +description: 'Caches foundry build by path' + +inputs: + package_folder: # id of input + description: 'contracts package folder' + required: true + foundry_profile: + description: 'foundry profile for caching' + +runs: + using: "composite" + + steps: + - name: Cache contracts build + uses: actions/cache@v3 + with: + # npm cache files are stored in out and cache + path: | + ${{ inputs.package_folder }}/cache + ${{ inputs.package_folder }}/out + # cache key is based on foundry config, contracts source tests, and scripts + key: ${{ inputs.package_folder }}${{ inputs.foundry_profile}}-${{ hashFiles(format('{0}/foundry.toml', inputs.package_folder)) }}-${{ hashFiles(format('{0}/src/**/*.sol', inputs.package_folder)) }}-${{ hashFiles(format('{0}/test/**/*.sol', inputs.package_folder)) }}-${{ hashFiles(format('{0}/script/**/*.sol', inputs.package_folder)) }} + # the following backups cache keys are searched, in case an exact match is not found + # see https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#matching-a-cache-key + restore-keys: | + ${{ inputs.package_folder }}${{ inputs.foundry_profile}}-${{ hashFiles(format('{0}/foundry.toml', inputs.package_folder)) }}-${{ hashFiles(format('{0}/src/**/*.sol', inputs.package_folder)) }}-${{ hashFiles(format('{0}/test/**/*.sol', inputs.package_folder)) }}- + ${{ inputs.package_folder }}${{ inputs.foundry_profile}}-${{ hashFiles(format('{0}/foundry.toml', inputs.package_folder)) }}-${{ hashFiles(format('{0}/src/**/*.sol', inputs.package_folder)) }}- + ${{ inputs.package_folder }}${{ inputs.foundry_profile}}-${{ hashFiles(format('{0}/foundry.toml', inputs.package_folder)) }}- diff --git a/.github/workflows/1155.yml b/.github/workflows/1155.yml new file mode 100644 index 000000000..0eba44f0a --- /dev/null +++ b/.github/workflows/1155.yml @@ -0,0 +1,21 @@ +name: "1155" +on: + workflow_call: + +jobs: + build: + uses: ./.github/workflows/build.yml + with: + package_folder: packages/1155-contracts + + test: + needs: build + uses: ./.github/workflows/test.yml + with: + package_folder: packages/1155-contracts + + coverage: + uses: ./.github/workflows/coverage.yml + with: + package: "1155-contracts" + files_to_ignore: '"*DeploymentConfig*" "*Redeem*" "*deployment*" "*packages*"' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..71a558d58 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,28 @@ +on: + workflow_call: + inputs: + package_folder: + required: true + type: string + +jobs: + check: + strategy: + fail-fast: true + + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install node deps and founry + uses: ./.github/actions/setup_deps + + - name: Cache build + uses: ./.github/actions/cache_foundry_build + with: + package_folder: ${{ inputs.package_folder }} + + - name: Build contracts + run: | + cd ${{ inputs.package_folder}} && forge build diff --git a/.github/workflows/contracts.yml b/.github/workflows/contracts.yml new file mode 100644 index 000000000..ae500c2cd --- /dev/null +++ b/.github/workflows/contracts.yml @@ -0,0 +1,17 @@ +name: "Contracts" + +on: "push" + +jobs: + contracts-1155: + name: 1155 + uses: ./.github/workflows/1155.yml + + contracts-protocol-rewards: + name: Protocol Rewards + uses: ./.github/workflows/protocol-rewards.yml + + contracts-protocol-deployments: + name: Protocol Deployments + uses: ./.github/workflows/protocol-deployments.yml + secrets: inherit diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 966b7ba79..58e251a8c 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -19,7 +19,7 @@ jobs: strategy: fail-fast: true - name: Check solidity test coverage + name: Coverage runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -29,6 +29,12 @@ jobs: - name: Install node deps and founry uses: ./.github/actions/setup_deps + - name: Cache build + uses: ./.github/actions/cache_foundry_build + with: + package_folder: packages/${{ inputs.package }} + foundry_profile: coverage + - name: Run Forge coverage run: cd $package_folder && forge coverage --report lcov diff --git a/.github/workflows/foundry.yml b/.github/workflows/foundry.yml deleted file mode 100644 index ad7a2eb47..000000000 --- a/.github/workflows/foundry.yml +++ /dev/null @@ -1,150 +0,0 @@ -name: "Foundry" - -on: "push" - -env: - # Setting an environment variable with the value of a configuration variable - $build_artifact: foundry_artifact - -jobs: - build: - name: Build contracts and cache output - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Install node deps and founry - uses: ./.github/actions/setup_deps - - - name: Build contracts - run: | - npx turbo run build:contracts - - - name: Archive built artifacts - uses: actions/upload-artifact@v3 - with: - name: $build_artifact - path: | - **/*/cache - **/*/out - retention-days: 1 - - contract_size_check: - needs: build - strategy: - fail-fast: true - - name: Check contract sizes - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Install node deps and founry - uses: ./.github/actions/setup_deps - - - name: Download foundry artifacts - uses: actions/download-artifact@v3 - with: - name: $build_artifact - - - name: Check contract sizes - run: | - npx turbo run build:sizes - - test: - needs: build - strategy: - fail-fast: true - - name: Tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Install node deps and founry - uses: ./.github/actions/setup_deps - - - name: Download foundry artifacts - uses: actions/download-artifact@v3 - with: - name: $build_artifact - - - name: Run tests - run: | - npx turbo run test - - test_fork: - needs: build - strategy: - fail-fast: true - - name: Fork tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Install node deps and founry - uses: ./.github/actions/setup_deps - - - name: Download foundry artifacts - uses: actions/download-artifact@v3 - with: - name: $build_artifact - - - name: Run fork tests - run: | - npx turbo run test:fork - env: - ALCHEMY_KEY: ${{ secrets.ALCHEMY_KEY }} - - storage_layout: - needs: build - strategy: - fail-fast: true - - name: Inpect storage layout - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Install node deps and founry - uses: ./.github/actions/setup_deps - - - name: Download foundry artifacts - uses: actions/download-artifact@v3 - with: - name: $build_artifact - - - name: "Inspect Storage Layout" - continue-on-error: false - run: npx turbo run storage-inspect:check - - build_js: - strategy: - fail-fast: true - - name: Build js package - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Install node deps and founry - uses: ./.github/actions/setup_deps - - - name: Build js package - run: | - npx turbo run build - - coverage-1155: - uses: ./.github/workflows/coverage.yml - name: "Test coverage - 1155" - with: - package: "1155-contracts" - files_to_ignore: '"*DeploymentConfig*" "*Redeem*" "*deployment*" "*packages*"' - - coverage-protocol-rewards: - uses: ./.github/workflows/coverage.yml - name: "Test coverage - protocol rewards" - with: - package: "protocol-rewards" - files_to_ignore: '"*lib*"' diff --git a/.github/workflows/protocol-deployments.yml b/.github/workflows/protocol-deployments.yml new file mode 100644 index 000000000..44ba3db37 --- /dev/null +++ b/.github/workflows/protocol-deployments.yml @@ -0,0 +1,16 @@ +name: "1155" +on: + workflow_call: + +jobs: + build: + uses: ./.github/workflows/build.yml + with: + package_folder: packages/protocol-deployments + + test: + needs: build + uses: ./.github/workflows/test.yml + with: + package_folder: packages/protocol-deployments + secrets: inherit diff --git a/.github/workflows/protocol-rewards.yml b/.github/workflows/protocol-rewards.yml new file mode 100644 index 000000000..2e30c8fae --- /dev/null +++ b/.github/workflows/protocol-rewards.yml @@ -0,0 +1,21 @@ +name: "Protocol Rewards" +on: + workflow_call: + +jobs: + build: + uses: ./.github/workflows/build.yml + with: + package_folder: packages/protocol-rewards + + test: + needs: build + uses: ./.github/workflows/test.yml + with: + package_folder: packages/protocol-rewards + + coverage: + uses: ./.github/workflows/coverage.yml + with: + package: "protocol-rewards" + files_to_ignore: '"*lib*"' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..90e2c7d7d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,30 @@ +on: + workflow_call: + inputs: + package_folder: + required: true + type: string + +jobs: + check: + strategy: + fail-fast: true + + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install node deps and founry + uses: ./.github/actions/setup_deps + + - name: Load foundry cache + uses: ./.github/actions/cache_foundry_build + with: + package_folder: ${{ inputs.package_folder }} + + - name: Test + run: | + cd ${{ inputs.package_folder}} && yarn test + env: + ALCHEMY_KEY: ${{ secrets.ALCHEMY_KEY }} diff --git a/packages/1155-contracts/CHANGELOG.md b/packages/1155-contracts/CHANGELOG.md index 900a76d17..5278cd306 100644 --- a/packages/1155-contracts/CHANGELOG.md +++ b/packages/1155-contracts/CHANGELOG.md @@ -1,5 +1,12 @@ # @zoralabs/zora-1155-contracts +## 2.4.0 + +### Minor Changes + +- 366ac20: Fix broken storage layout by not including an interface on CreatorRoyaltiesControl +- e25ac54: ignore nonzero supply royalty schedule + ## 2.3.1 ### Patch Changes diff --git a/packages/1155-contracts/package.json b/packages/1155-contracts/package.json index cbc882480..87d152c6d 100644 --- a/packages/1155-contracts/package.json +++ b/packages/1155-contracts/package.json @@ -1,6 +1,6 @@ { "name": "@zoralabs/zora-1155-contracts", - "version": "2.3.1", + "version": "2.4.0", "repository": "git@github.com:ourzora/zora-protocol.git", "author": "Iain ", "license": "MIT", diff --git a/packages/1155-contracts/src/royalties/CreatorRoyaltiesControl.sol b/packages/1155-contracts/src/royalties/CreatorRoyaltiesControl.sol index 1888e4785..8fb239c4e 100644 --- a/packages/1155-contracts/src/royalties/CreatorRoyaltiesControl.sol +++ b/packages/1155-contracts/src/royalties/CreatorRoyaltiesControl.sol @@ -11,7 +11,7 @@ import {IERC2981} from "@openzeppelin/contracts/interfaces/IERC2981.sol"; /// @title CreatorRoyaltiesControl /// @author ZORA @iainnash / @tbtstl /// @notice Contract for managing the royalties of an 1155 contract -abstract contract CreatorRoyaltiesControl is CreatorRoyaltiesStorageV1, SharedBaseConstants, ICreatorRoyaltyErrors { +abstract contract CreatorRoyaltiesControl is CreatorRoyaltiesStorageV1, SharedBaseConstants { uint256 immutable ROYALTY_BPS_TO_PERCENT = 10_000; /// @notice The royalty information for a given token. @@ -41,7 +41,7 @@ abstract contract CreatorRoyaltiesControl is CreatorRoyaltiesStorageV1, SharedBa } // Don't allow setting royalties to burn address if (configuration.royaltyRecipient == address(0) && configuration.royaltyBPS > 0) { - revert InvalidMintSchedule(); + revert ICreatorRoyaltyErrors.InvalidMintSchedule(); } royalties[tokenId] = configuration; diff --git a/packages/1155-contracts/src/version/ContractVersionBase.sol b/packages/1155-contracts/src/version/ContractVersionBase.sol index 236c94a3e..52fcb687f 100644 --- a/packages/1155-contracts/src/version/ContractVersionBase.sol +++ b/packages/1155-contracts/src/version/ContractVersionBase.sol @@ -1,5 +1,5 @@ // This file is automatically generated by code; do not manually update -// Last updated on 2023-11-06T00:58:51.853Z +// Last updated on 2023-11-09T00:33:12.481Z // SPDX-License-Identifier: MIT pragma solidity 0.8.17; @@ -10,6 +10,6 @@ import {IVersionedContract} from "../interfaces/IVersionedContract.sol"; contract ContractVersionBase is IVersionedContract { /// @notice The version of the contract function contractVersion() external pure override returns (string memory) { - return "2.3.1"; + return "2.4.0"; } } diff --git a/packages/protocol-deployments/package.json b/packages/protocol-deployments/package.json index 57b5c6c0e..828c39f6c 100644 --- a/packages/protocol-deployments/package.json +++ b/packages/protocol-deployments/package.json @@ -8,8 +8,7 @@ "type": "module", "scripts": { "dev": "FOUNDRY_PROFILE=dev forge test --watch -vvv", - "test:fork": "FORK_TEST_CHAINS=mainnet,goerli,optimism,optimism_goerli,zora,zora_goerli,base_goerli,base,zora_sepolia forge test -vvv", - "test": "forge test -vvv", + "test": "FORK_TEST_CHAINS=mainnet,goerli,optimism,optimism_goerli,zora,zora_goerli,base_goerli,base,zora_sepolia forge test -vvv", "build": "yarn wagmi && yarn bundle-configs && tsup", "bundle-configs": "node script/bundle-chainConfigs.mjs && yarn prettier", "prettier": "prettier --write 'package/**/*.ts' 'script/**/*.ts' 'wagmi.config.ts'", diff --git a/packages/protocol-deployments/test/ZoraCreator1155Factory_Fork.t.sol b/packages/protocol-deployments/test/ZoraCreator1155Factory_Fork.t.sol index 8ba6a23fd..47343f428 100644 --- a/packages/protocol-deployments/test/ZoraCreator1155Factory_Fork.t.sol +++ b/packages/protocol-deployments/test/ZoraCreator1155Factory_Fork.t.sol @@ -131,8 +131,6 @@ contract ZoraCreator1155FactoryForkTest is ForkDeploymentConfig, Test { address factoryAddress = deployment.factoryProxy; ZoraCreator1155FactoryImpl factory = ZoraCreator1155FactoryImpl(factoryAddress); - assertEq(factory.implementation(), deployment.factoryImpl, "factory implementation incorrect"); - assertEq(getChainConfig().factoryOwner, IOwnable(factoryAddress).owner(), string.concat("configured owner incorrect on: ", chainName)); // make sure that the address from the factory matches the stored fixed price address