feat: remove ethereum-cryptography package
#943
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| push: | |
| branches: | |
| - main | |
| env: | |
| FOUNDRY_PROFILE: ci | |
| # This enables colored output for tests run by `mocha`. | |
| # `FORCE_COLOR` is used by `chalk`, which is used internally by `mocha`. | |
| # https://github.com/chalk/chalk#supportscolor | |
| # https://github.com/orgs/community/discussions/26944#discussioncomment-3254075 | |
| FORCE_COLOR: 3 | |
| jobs: | |
| type-check: | |
| name: TypeScript Type-Check | |
| runs-on: smart-contracts-linux-medium | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| submodules: recursive | |
| - name: Set up Node.js | |
| uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | |
| with: | |
| node-version: '20' | |
| - name: Install Foundry | |
| uses: step-security/foundry-toolchain@01e2d127ea061e2ce8fa34340de71ca8518f093e # v1.2.1 | |
| with: | |
| version: stable | |
| - name: Run Forge build | |
| run: forge build | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Run TypeScript Type-Check | |
| run: npm run type-check | |
| - name: Run ESLint | |
| run: npm run lint | |
| readme-check: | |
| name: README docs generation check | |
| runs-on: smart-contracts-linux-medium | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| submodules: recursive | |
| - name: Set up Node.js | |
| uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | |
| with: | |
| node-version: '20' | |
| - name: Install Foundry | |
| uses: step-security/foundry-toolchain@01e2d127ea061e2ce8fa34340de71ca8518f093e # v1.2.1 | |
| with: | |
| version: stable | |
| - name: Run Forge build | |
| run: forge build | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Embed tables and code examples into README | |
| run: npm run make:readme | |
| - name: Format README tables to perform diff check | |
| run: npx prettier README.md --write | |
| - name: Check that README is up-to-date | |
| run: git --no-pager diff --exit-code README.md || (echo "==== README is not up to date, run 'npm run make:readme' and include changes made to 'README.md' ====" && false) | |
| npm-test: | |
| name: 'NPM Unit and Hardhat plugin Tests' | |
| runs-on: smart-contracts-linux-medium | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| submodules: recursive | |
| - name: Set up Node.js | |
| uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | |
| with: | |
| node-version: '20' | |
| - name: Install Foundry | |
| uses: step-security/foundry-toolchain@01e2d127ea061e2ce8fa34340de71ca8518f093e # v1.2.1 | |
| with: | |
| version: stable | |
| - name: Run Forge build | |
| run: forge build | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Run Unit Tests | |
| run: npm run coverage | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 | |
| with: | |
| name: lcov-${{ github.job }} | |
| path: coverage/lcov.info | |
| sol-tests-local-storage: | |
| name: 'Forge tests w/storage emulation' | |
| runs-on: smart-contracts-linux-medium | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| submodules: recursive | |
| - name: Set up Node.js | |
| uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | |
| with: | |
| node-version: '20' | |
| - name: Install Foundry | |
| uses: step-security/foundry-toolchain@01e2d127ea061e2ce8fa34340de71ca8518f093e # v1.2.1 | |
| with: | |
| version: stable | |
| - name: Run Forge build | |
| run: forge build | |
| - name: Run Forge tests using local storage emulation (without forking) | |
| run: forge coverage --report summary --report lcov -vvv | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 | |
| with: | |
| name: lcov-${{ github.job }} | |
| path: lcov.info | |
| sol-tests-ffi-mock: | |
| name: 'Forge tests w/FFI curl process mock' | |
| runs-on: smart-contracts-linux-medium | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| submodules: recursive | |
| - name: Set up Node.js | |
| uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | |
| with: | |
| node-version: '20' | |
| - name: Install Foundry | |
| uses: step-security/foundry-toolchain@01e2d127ea061e2ce8fa34340de71ca8518f093e # v1.2.1 | |
| with: | |
| version: stable | |
| - name: Run Forge build | |
| run: forge build | |
| - name: Mock curl | |
| run: echo "./test/scripts" >> "$GITHUB_PATH" | |
| - name: Run Forge tests using JSON-RPC Mainnet and Testnet servers (with forking) | |
| run: forge coverage --report summary --report lcov -vvv --fork-url https://testnet.hashio.io/api --fork-block-number 13890397 | |
| - name: Show Mocked curl Requests | |
| run: cat test/scripts/curl.log | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 | |
| with: | |
| name: lcov-${{ github.job }} | |
| path: lcov.info | |
| sol-tests-json-rpc-mock: | |
| name: 'Forge tests w/RPC mock server' | |
| runs-on: smart-contracts-linux-medium | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| submodules: recursive | |
| - name: Set up Node.js | |
| uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | |
| with: | |
| node-version: '20' | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Install Foundry | |
| uses: step-security/foundry-toolchain@01e2d127ea061e2ce8fa34340de71ca8518f093e # v1.2.1 | |
| with: | |
| version: stable | |
| - name: Run Forge build | |
| run: forge build | |
| - name: Start JSON-RPC mock server | |
| run: node test/scripts/json-rpc-mock.js & | |
| - name: Run Forge tests using JSON-RPC mock server for storage emulation (with forking) | |
| run: forge coverage --report summary --report lcov -vvv --fork-url http://localhost:7546 --no-storage-caching | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 | |
| with: | |
| name: lcov-${{ github.job }} | |
| path: lcov.info | |
| coverage-report: | |
| name: Coverage Report | |
| runs-on: smart-contracts-linux-medium | |
| needs: [npm-test, sol-tests-local-storage, sol-tests-ffi-mock, sol-tests-json-rpc-mock] | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| submodules: recursive | |
| - name: Download coverage reports | |
| uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
| with: | |
| pattern: lcov-* | |
| - name: Send the coverage results to Codecov and comment coverage changes | |
| uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./lcov-npm-test/lcov.info,./lcov-sol-tests-local-storage/lcov.info,./lcov-sol-tests-ffi-mock/lcov.info,./lcov-sol-tests-json-rpc-mock/lcov.info | |
| slug: hashgraph/hedera-forking | |
| foundry-example-tests: | |
| name: 'Foundry example tests' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| solc: [ | |
| # Ensures we use the `override` specifier | |
| # https://soliditylang.org/blog/2021/09/27/solidity-0.8.8-release-announcement/ | |
| '0.8.7', | |
| # Ensures we do not use `string.concat` | |
| # > General: string.concat now properly takes strings as arguments and returns string memory. | |
| # > It was accidentally introduced as a copy of bytes.concat before. | |
| # https://soliditylang.org/blog/2022/02/16/solidity-0.8.12-release-announcement/ | |
| '0.8.11', | |
| # Ensures we do not overload/use free functions | |
| # https://soliditylang.org/blog/2022/03/16/solidity-0.8.13-release-announcement/ | |
| '0.8.12', | |
| # Ensures we do not use "named parameters in mapping types" | |
| # See _Language Features_ https://soliditylang.org/blog/2023/02/01/solidity-0.8.18-release-announcement/ | |
| '0.8.17', | |
| # Ensures we do not use "qualified access to events from other contracts" | |
| # See _Qualified access to foreign events_ https://soliditylang.org/blog/2023/07/19/solidity-0.8.21-release-announcement/ | |
| '0.8.19', | |
| '0.8.24', | |
| ] | |
| runs-on: smart-contracts-linux-medium | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| submodules: recursive | |
| - name: Install Foundry | |
| uses: step-security/foundry-toolchain@01e2d127ea061e2ce8fa34340de71ca8518f093e # v1.2.1 | |
| with: | |
| version: stable | |
| - name: Run Forge build on Foundry HTS example | |
| run: forge build | |
| working-directory: examples/foundry-hts | |
| env: | |
| # https://book.getfoundry.sh/reference/config/solidity-compiler#solc_version | |
| FOUNDRY_SOLC_VERSION: ${{ matrix.solc }} | |
| - name: Run Forge HTS example tests using remote network with a pinned block number | |
| run: forge test -vv --fork-url mainnet --fork-block-number 72433403 | |
| working-directory: examples/foundry-hts | |
| hardhat-example-tests: | |
| name: 'Hardhat example tests w/mainnet' | |
| runs-on: smart-contracts-linux-medium | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| submodules: recursive | |
| - name: Set up Node.js | |
| uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | |
| with: | |
| node-version: '20' | |
| - name: Install Foundry | |
| uses: step-security/foundry-toolchain@01e2d127ea061e2ce8fa34340de71ca8518f093e # v1.2.1 | |
| with: | |
| version: stable | |
| - name: Run Forge build | |
| run: forge build | |
| - name: Install Library Dependencies | |
| run: npm ci | |
| - name: Install Dependencies | |
| run: npm ci | |
| working-directory: examples/hardhat-hts | |
| - name: Run Hardhat example tests | |
| run: npm run test | |
| working-directory: examples/hardhat-hts | |
| foundry-example-scripts: | |
| name: Foundry example scripts w/local node | |
| runs-on: smart-contracts-linux-medium | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| submodules: recursive | |
| - name: Set up Node.js | |
| uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | |
| with: | |
| node-version: 20 | |
| - name: Install Foundry | |
| uses: step-security/foundry-toolchain@01e2d127ea061e2ce8fa34340de71ca8518f093e # v1.2.1 | |
| with: | |
| version: stable | |
| - name: Run Forge build | |
| run: forge build | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Start the local node | |
| run: npx hedera start --detach --verbose=trace | |
| timeout-minutes: 5 | |
| - name: Run Forge build on Foundry HTS example | |
| run: forge build | |
| working-directory: examples/foundry-hts | |
| # Uses a local node's account private key | |
| # https://github.com/hiero-ledger/hiero-local-node?tab=readme-ov-file#hedera-start-options | |
| - name: Set up Local Node's account Private Key | |
| run: echo "PRIVATE_KEY=0x105d050185ccb907fba04dd92d8de9e32c18305e097ab41dadda21489a211524" > .env | |
| working-directory: examples/foundry-hts | |
| - name: Run Foundry script on local node | |
| run: forge script script/CreateToken.s.sol -vvv --rpc-url localnode --skip-simulation --broadcast | |
| working-directory: examples/foundry-hts | |
| # https://book.getfoundry.sh/guides/scripting-with-solidity | |
| - name: Verify the token was created | |
| run: | | |
| TOKEN_ADDR=`cat broadcast/CreateToken.s.sol/298/run-latest.json | jq '.receipts[0].contractAddress' --raw-output` | |
| echo "Token Address: $TOKEN_ADDR" | |
| TOKEN_CODE=`cast code --rpc-url localnode $TOKEN_ADDR` | |
| echo "Token Code: $TOKEN_CODE" | |
| test $TOKEN_CODE != "0x" | |
| working-directory: examples/foundry-hts | |
| - name: Stop the local node | |
| if: ${{ !cancelled() }} | |
| run: npx hedera stop | |
| e2e-test: | |
| name: 'NPM e2e validation tests' | |
| runs-on: smart-contracts-linux-medium | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| submodules: recursive | |
| - name: Set up Node.js | |
| uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | |
| with: | |
| node-version: '20' | |
| - name: Install Foundry | |
| uses: step-security/foundry-toolchain@01e2d127ea061e2ce8fa34340de71ca8518f093e # v1.2.1 | |
| with: | |
| version: stable | |
| - name: Run Forge build | |
| run: forge build | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Start the local node | |
| run: npx hedera start -d --verbose=trace | |
| timeout-minutes: 5 | |
| - name: Run e2e Validation Tests | |
| run: npm run test:e2e | |
| - name: Stop the local node | |
| if: ${{ !cancelled() }} | |
| run: npx hedera stop | |
| slither-analysis: | |
| name: 'Slither static code analysis' | |
| runs-on: smart-contracts-linux-medium | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout Code | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| submodules: recursive | |
| - name: Run Slither | |
| uses: crytic/slither-action@f197989dea5b53e986d0f88c60a034ddd77ec9a8 # v0.4.0 | |
| with: | |
| fail-on: high |