diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 00000000..14980729 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,12 @@ +{ + "extends": ["@matterlabs/eslint-config-typescript"], + "rules": { + "no-multiple-empty-lines": ["error", { "max": 1 }], + "@typescript-eslint/no-namespace": "off", + "@typescript-eslint/ban-ts-comment": "off", + "import/no-named-as-default-member": "off", + "import/namespace": "off", + "import/no-unresolved": "off", + "import/order": "off" + } +} diff --git a/.githooks/pre-commit b/.githooks/pre-commit new file mode 100755 index 00000000..76dfb3f2 --- /dev/null +++ b/.githooks/pre-commit @@ -0,0 +1,16 @@ +#!/bin/sh + +CYAN='\033[0;36m' +NC='\033[0m' # No Color +RED='\033[0;31m' + +# Check that the code is formatted in the given directory provided in the first argument +function check_prettier { + if ! yarn prettier:check; then + echo "${RED}Commit error! Cannot commit unformatted code!${NC}" + echo "Prettier errors found. Please format the code via ${CYAN}yarn prettier:fix${NC}!" + exit 1 + fi +} + +check_prettier diff --git a/.githooks/pre-push b/.githooks/pre-push new file mode 100755 index 00000000..214d2f64 --- /dev/null +++ b/.githooks/pre-push @@ -0,0 +1,16 @@ +#!/bin/sh + +CYAN='\033[0;36m' +NC='\033[0m' # No Color +RED='\033[0;31m' + +# Checking that the code is linted and formatted in the given directory provided in the first argument +function check_lint { + if ! yarn lint:check; then + echo "${RED}Push error! Cannot push unlinted code!${NC}" + echo "Lint errors found. Please lint the code via ${CYAN}yarn lint:fix${NC} and/or fix the errors manually!" + exit 1 + fi +} + +check_lint diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 3c160c5e..79ab40e6 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,9 +1,9 @@ --- name: Scripts-Related Bug Report about: Use this template for reporting script related bugs. For contract bugs, see our security policy. -title: '' +title: "" labels: bug -assignees: '' +assignees: "" --- ### 🐛 Script Bug Report diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index d921e066..f0416490 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,9 +1,9 @@ --- name: Feature request about: Use this template for requesting features -title: '' +title: "" labels: feat -assignees: '' +assignees: "" --- ### 🌟 Feature Request diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 8ce206c8..54b41935 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -17,4 +17,3 @@ - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. -- [ ] Code has been formatted via `zk fmt` and `zk lint`. diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..1ffa5d8d --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,163 @@ +name: "CI" + +on: + pull_request: + push: + branches: + - dev + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout the repository + uses: actions/checkout@v3 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: 18.18.0 + cache: yarn + + - name: Install dependencies + run: yarn + + - name: Build artifacts + run: yarn build + + - name: Create cache + uses: actions/cache/save@v3 + with: + key: artifacts-${{ github.sha }} + path: | + artifacts-zk + cache-zk + typechain-types + contracts/artifacts + contracts/precompiles/artifacts + bootloader/build + + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout the repository + uses: actions/checkout@v3 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: 18.18.0 + cache: yarn + + - name: Install dependencies + run: yarn + + - name: Run lint + run: yarn lint:check + + check_hashes: + needs: [build] + runs-on: ubuntu-latest + + steps: + - name: Checkout the repository + uses: actions/checkout@v3 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: 18.18.0 + cache: yarn + + - name: Install dependencies + run: yarn + + - name: Restore artifacts cache + uses: actions/cache/restore@v3 + with: + fail-on-cache-miss: true + key: artifacts-${{ github.sha }} + path: | + artifacts-zk + cache-zk + typechain-types + contracts/artifacts + contracts/precompiles/artifacts + bootloader/build + + - name: Check hashes + run: yarn calculate-hashes:check + + test: + needs: [build, lint] + runs-on: ubuntu-latest + + steps: + - name: Checkout the repository + uses: actions/checkout@v3 + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: 18.18.0 + cache: yarn + + - name: Use era-test-node for testing + uses: dutterbutter/era-test-node-action@v0.1.3 + with: + releaseTag: v0.0.1-alpha.boojum + + - name: Install dependencies + run: yarn + + - name: Restore artifacts cache + uses: actions/cache/restore@v3 + with: + fail-on-cache-miss: true + key: artifacts-${{ github.sha }} + path: | + artifacts-zk + cache-zk + typechain-types + contracts/artifacts + contracts/precompiles/artifacts + bootloader/build + + - name: Run tests + run: yarn test + + - name: Print output logs of era_test_node + if: always() + run: cat era_test_node.log + + test_bootloader: + needs: [build, lint] + runs-on: ubuntu-latest + + steps: + - name: Checkout the repository + uses: actions/checkout@v3 + + - name: Install rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: nightly-2023-04-17 + + - name: Restore artifacts cache + uses: actions/cache/restore@v3 + with: + fail-on-cache-miss: true + key: artifacts-${{ github.sha }} + path: | + artifacts-zk + cache-zk + typechain-types + contracts/artifacts + contracts/precompiles/artifacts + bootloader/build + + - name: Run bootloader tests + run: "cd bootloader/test_infra && cargo run" diff --git a/.github/workflows/nodejs-license.yaml b/.github/workflows/nodejs-license.yaml index cdfc22ce..7ab1a48c 100644 --- a/.github/workflows/nodejs-license.yaml +++ b/.github/workflows/nodejs-license.yaml @@ -49,7 +49,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v3 with: - node-version: 16.15.1 + node-version: 18.18.0 - name: Install yarn run: npm install -g yarn license-checker diff --git a/.gitignore b/.gitignore index 162e711f..550cfc37 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,10 @@ typechain build yarn-debug.log* yarn-error.log* + +# Yarn files +.yarn/ +.yarnrc.yml + +.vscode +target/ diff --git a/.markdownlintignore b/.markdownlintignore new file mode 100644 index 00000000..3c3629e6 --- /dev/null +++ b/.markdownlintignore @@ -0,0 +1 @@ +node_modules diff --git a/.markdownlintrc b/.markdownlintrc new file mode 100644 index 00000000..d6bb9e81 --- /dev/null +++ b/.markdownlintrc @@ -0,0 +1,9 @@ +{ + "default": true, + "header-increment": false, + "no-duplicate-header": false, + "no-inline-html": false, + "line-length": false, + "fenced-code-language": false, + "no-multiple-blanks": false +} diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..6aab9b43 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v18.18.0 diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..47d8572e --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +contracts/openzeppelin diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 00000000..02098299 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,16 @@ +module.exports = { + ...require("@matterlabs/prettier-config"), + plugins: ["prettier-plugin-solidity"], + overrides: [ + { + files: "*.sol", + options: { + bracketSpacing: false, + printWidth: 120, + singleQuote: false, + tabWidth: 4, + useTabs: false, + }, + }, + ], +}; diff --git a/.solhint.json b/.solhint.json new file mode 100644 index 00000000..5329702d --- /dev/null +++ b/.solhint.json @@ -0,0 +1,20 @@ +{ + "extends": "solhint:recommended", + "rules": { + "state-visibility": "off", + "func-visibility": ["warn", { "ignoreConstructors": true }], + "var-name-mixedcase": "off", + "avoid-call-value": "off", + "no-empty-blocks": "off", + "not-rely-on-time": "off", + "avoid-low-level-calls": "off", + "no-inline-assembly": "off", + "const-name-snakecase": "off", + "no-complex-fallback": "off", + "reason-string": "off", + "func-name-mixedcase": "off", + "no-unused-vars": "off", + "max-states-count": "off", + "compiler-version": ["warn", "^0.8.0"] + } +} diff --git a/.solhintignore b/.solhintignore new file mode 100644 index 00000000..2fdb1b66 --- /dev/null +++ b/.solhintignore @@ -0,0 +1 @@ +contracts/openzeppelin \ No newline at end of file diff --git a/README.md b/README.md index f0176833..2e504c22 100644 --- a/README.md +++ b/README.md @@ -10,57 +10,69 @@ write smart contracts in C++, Rust and other popular languages. ## system-contracts To keep the zero-knowledge circuits as simple as possible and enable simple extensions, we created the system contracts. -These are privileged special-purpose contracts that instantiate some recurring actions on the protocol level. Some of the -most commonly used contracts: +These are privileged special-purpose contracts that instantiate some recurring actions on the protocol level. Some of +the most commonly used contracts: -`ContractDeployer` This contract is used to deploy new smart contracts. Its job is to make sure that the bytecode for each deployed -contract is known. This contract also defines the derivation address. Whenever a contract is deployed, a ContractDeployed -event is emitted. +`ContractDeployer` This contract is used to deploy new smart contracts. Its job is to make sure that the bytecode for +each deployed contract is known. This contract also defines the derivation address. Whenever a contract is deployed, a +ContractDeployed event is emitted. -`L1Messenger` This contract is used to send messages from zkSync to Ethereum. For each message sent, the L1MessageSent event is emitted. +`L1Messenger` This contract is used to send messages from zkSync to Ethereum. For each message sent, the L1MessageSent +event is emitted. -`NonceHolder` This contract stores account nonces. The account nonces are stored in a single place for efficiency (the tx nonce and -the deployment nonce are stored in a single place) and also for the ease of the operator. +`NonceHolder` This contract stores account nonces. The account nonces are stored in a single place for efficiency (the +tx nonce and the deployment nonce are stored in a single place) and also for the ease of the operator. -`Bootloader` For greater extensibility and to lower the overhead, some parts of the protocol (e.g. account abstraction rules) were -moved to an ephemeral contract called a bootloader. +`Bootloader` For greater extensibility and to lower the overhead, some parts of the protocol (e.g. account abstraction +rules) were moved to an ephemeral contract called a bootloader. -We call it ephemeral because it is not physically deployed and cannot be called, but it has a formal address that is used -on msg.sender, when it calls other contracts. +We call it ephemeral because it is not physically deployed and cannot be called, but it has a formal address that is +used on msg.sender, when it calls other contracts. ## Building -This repository is used as a submodule of the [zksync-2-dev](https://github.com/matter-labs/zksync-2-dev). +This repository is used as a submodule of the [zksync-era](https://github.com/matter-labs/zksync-era). -Compile the solidity contracts: `yarn build` +Compile the solidity and yul contracts: `yarn build` -Run the bootloader preprocessor: `yarn preprocess` +Check the system contracts hashes: `yarn calculate-hashes:check` -Compile the yul contracts: `yarn hardhat run ./scripts/compile-yul.ts` +Update the system contracts hashes: `yarn calculate-hashes:fix` ## Update Process -System contracts handle core functionalities and play a critical role in maintaining the integrity of our protocol. To ensure the highest level of security and reliability, these system contracts undergo an audit before any release. +System contracts handle core functionalities and play a critical role in maintaining the integrity of our protocol. To +ensure the highest level of security and reliability, these system contracts undergo an audit before any release. -Here is an overview of the release process of the system contracts which is aimed to preserve agility and clarity on the order of the upgrades: +Here is an overview of the release process of the system contracts which is aimed to preserve agility and clarity on the +order of the upgrades: ### `main` branch -The `main` branch contains the latest code that is ready to be deployed into production. It reflects the most stable and audited version of the protocol. +The `main` branch contains the latest code that is ready to be deployed into production. It reflects the most stable and +audited version of the protocol. -### `dev` branch +### `dev` branch -The `dev` branch is for active development & the latest code changes. Whenever a new PR with system contract changes is created it should be based on the `dev` branch. +The `dev` branch is for active development & the latest code changes. Whenever a new PR with system contract changes is +created it should be based on the `dev` branch. -### Creating a new release: +### Creating a new release -Whenever a new release is planned, a new branch named `release-vX-` should be created off the `dev` branch, where `X` represents the release version, and `` is a short descriptive name for the release. The PR with the new release should point to either the `main` branch or to the release branch with a lower version (in case the previous branch has not been merged into `main` for some reason). +Whenever a new release is planned, a new branch named `release-vX-` should be created off the `dev` branch, where +`X` represents the release version, and `` is a short descriptive name for the release. The PR with the new +release should point to either the `main` branch or to the release branch with a lower version (in case the previous +branch has not been merged into `main` for some reason). -Once the audit for the release branch is complete and all the fixes from the audit are applied, we need to merge the new changes into the `dev` branch. Once the release is final and merged into the `main` branch, the `main` branch should be merged back into the `dev` branch to keep it up-to-date. +Once the audit for the release branch is complete and all the fixes from the audit are applied, we need to merge the new +changes into the `dev` branch. Once the release is final and merged into the `main` branch, the `main` branch should be +merged back into the `dev` branch to keep it up-to-date. -### Updating Unaudited Code: +### Updating Unaudited Code -Since scripts, READMEs, etc., are code that is not subject to audits, these are to be merged directly into the `main` branch. The rest of the release branches as well as the `dev` branch should merge `main` to synchronize with these changes. +Since scripts, READMEs, etc., are code that is not subject to audits, these are to be merged directly into the `main` +branch. The rest of the release branches as well as the `dev` branch should merge `main` to synchronize with these +changes. ## License @@ -75,6 +87,7 @@ See [LICENSE-MIT](LICENSE-MIT) for details. - [Twitter](https://twitter.com/zksync) - [Twitter for Devs](https://twitter.com/zkSyncDevs) - [Discord](https://join.zksync.dev/) +- [Mirror](https://zksync.mirror.xyz/) ## Disclaimer diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..2f2871ce --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,74 @@ +# Security Policy + +We truly appreciate efforts to discover and disclose security issues responsibly! + +## Vulnerabilities + +If you'd like to report a security issue in the repositories of matter-labs organization, please proceed to our +[Bug Bounty Program on Immunefi](https://era.zksync.io/docs/reference/troubleshooting/audit-bug-bounty.html#bug-bounty-program). + +## Other Security Issues + +We take an impact-first approach instead of a rules-first approach. Therefore, if you believe you found the impactful +issue but can't report it via the Bug Bounty, please email us at +[security@matterlabs.dev](mailto:security@matterlabs.dev). + +### PGP Key + +The following PGP key may be used to communicate sensitive information to developers: + +Fingerprint: `5FED B2D0 EA2C 4906 DD66 71D7 A2C5 0B40 CE3C F297` + +``` +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBGEBmQkBEAD6tlkBEZFMvR8kOgxXX857nC2+oTik6TopJz4uCskuqDaeldMy +l+26BBzLkIeO1loS+bzVgnNFJRrGt9gv98MzNEHJVv6D7GsSLlUX/pz7Lxn0J4ry +o5XIk3MQTCUBdaXGs6GBLl5Xe8o+zNj4MKd4zjgDLinITNlE/YZCDsXyvYS3YFTQ +cwaUTNlawkKgw4BLaEqwB2JuyEhI9wx5X7ibjFL32sWMolYsNAlzFQzM09HCurTn +q0DYau9kPJARcEk9/DK2iq0z3gMCQ8iRTDaOWd8IbSP3HxcEoM5j5ZVAlULmjmUE +StDaMPLj0Kh01Tesh/j+vjchPXHT0n4zqi1+KOesAOk7SIwLadHfQMTpkU7G2fR1 +BrA5MtlzY+4Rm6o7qu3dpZ+Nc4iM3FUnaQRpvn4g5nTh8vjG94OCzX8DXWrCKyxx +amCs9PLDYOpx84fXYv4frkWpKh2digDSUGKhoHaOSnqyyvu3BNWXBCQZJ20rqEIu +sXOQMxWIoWCOOPRRvrHrKDA2hpoKjs3pGsProfpVRzb9702jhWpTfbDp9WjQlFtX +2ZIDxlwAxcugClgrp5JiUxvhg2A9lDNwCF7r1e68uNv5usBZQVKPJmnvS2nWgKy8 +x9oJsnwrEjxwiRHd34UvfMkwY9RENSJ+NoXqBdS7Lwz4m6vgbzq6K56WPQARAQAB +tCRaa1N5bmMgU2VjdXJpdHkgPHNlY3VyaXR5QHprc3luYy5pbz6JAk4EEwEKADgW +IQRf7bLQ6ixJBt1mcdeixQtAzjzylwUCYQGZCQIbAwULCQgHAgYVCgkICwIEFgID +AQIeAQIXgAAKCRCixQtAzjzyl5y8EAC/T3oq88Dak2b+5TlWdU2Gpm6924eAqlMt +y1KksDezzNQUlPiCUVllpin2PIjU/S+yzMWKXJA04LoVkEPfPOWjAaavLOjRumxu +MR6P2dVUg1InqzYVsJuRhKSpeexzNA5qO2BPM7/I2Iea1IoJPjogGbfXCo0r5kne +KU7a5GEa9eDHxpHTsbphQe2vpQ1239mUJrFpzAvILn6jV1tawMn5pNCXbsa8l6l2 +gtlyQPdOQECy77ZJxrgzaUBcs/RPzUGhwA/qNuvpF0whaCvZuUFMVuCTEu5LZka2 +I9Rixy+3jqBeONBgb+Fiz5phbiMX33M9JQwGONFaxdvpFTerLwPK2N1T8zcufa01 +ypzkWGheScFZemBxUwXwK4x579wjsnfrY11w0p1jtDgPTnLlXUA2mom4+7MyXPg0 +F75qh6vU1pdXaCVkruFgPVtIw+ccw2AxD50iZQ943ZERom9k165dR9+QxOVMXQ4P +VUxsFZWvK70/s8TLjsGljvSdSOa85iEUqSqh0AlCwIAxLMiDwh5s/ZgiHoIM6Xih +oCpuZyK9p0dn+DF/XkgAZ/S91PesMye3cGm6M5r0tS26aoc2Pk6X37Hha1pRALwo +MOHyaGjc/jjcXXxv6o55ALrOrzS0LQmLZ+EHuteCT15kmeY3kqYJ3og62KgiDvew +dKHENvg7d7kCDQRhAZleARAA6uD6WfdqGeKV5i170+kLsxR3QGav0qGNAbxpSJyn +iHQ8u7mQk3S+ziwN2AAopfBk1je+vCWtEGC3+DWRRfJSjLbtaBG8e6kLP3/cGA75 +qURz6glTG4nl5fcEAa6B1st0OxjVWiSLX3g/yjz8lznQb9awuRjdeHMnyx5DsJUN +d+Iu5KxGupQvKGOMKivSvC8VWk9taaQRpRF+++6stLCDk3ZtlxiopMs3X2jAp6xG +sOBbix1cv9BTsfaiL7XDL/gviqBPXYY5L42x6+jnPo5lROfnlLYkWrv6KZr7HD4k +tRXeaSwxLD2EkUyb16Jpp0be/ofvBtITGUDDLCGBiaXtx/v8d52MARjsyLJSYloj +1yiW01LfAiWHUC4z5jl2T7E7sicrlLH1M8Z6WbuqjdeaYwtfyPA2YCKr/3fn6pIo +D+pYaBSESmhA92P+XVaf5y2BZ6Qf8LveDpWwsVGdBGh9T0raA1ooe1GESLjmIjUa +z5AeQ/uXL5Md9I6bpMUUJYQiH19RPcFlJriI3phXyyf6Wlkk8oVEeCWyzcmw+x1V +deRTvE2x4WIwKGLXRNjin2j1AP7vU2HaNwlPrLijqdyi68+0irRQONoH7Qonr4ca +xWgL+pAaa3dWxf0xqK7uZFp4aTVWlr2uXtV/eaUtLmGMCU0jnjb109wg5L0F7WRT +PfEAEQEAAYkCNgQYAQoAIBYhBF/tstDqLEkG3WZx16LFC0DOPPKXBQJhAZleAhsM +AAoJEKLFC0DOPPKXAAEP/jK7ch9GkoaYlsuqY/aHtxEwVddUDOxjyn3FMDoln85L +/n8AmLQb2bcpKSqpaJwMbmfEyr5MDm8xnsBTfx3u6kgaLOWfKxjLQ6PM7kgIMdi4 +bfaRRuSEI1/R6c/hNpiGnzAeeexldH1we+eH1IVmh4crdat49S2xh7Qlv9ahvgsP +LfKl3rJ+aaX/Ok0AHzhvSfhFpPr1gAaGeaRt+rhlZsx2QyG4Ez8p2nDAcAzPiB3T +73ENoBIX6mTPfPm1UgrRyFKBqtUzAodz66j3r6ebBlWzIRg8iZenVMAxzjINAsxN +w1Bzfgsi5ZespfsSlmEaa7jJkqqDuEcLa2YuiFAue7Euqwz1aGeq1GfTicQioSCb +Ur/LGyz2Mj3ykbaP8p5mFVcUN51yQy6OcpvR/W1DfRT9SHFT/bCf9ixsjB2HlZGo +uxPJowwqmMgHd755ZzPDUM9YDgLI1yXdcYshObv3Wq537JAxnZJCGRK4Y8SwrMSh +8WRxlaM0AGWXiJFIDD4bQPIdnF3X8w0cGWE5Otkb8mMHOT+rFTVlDODwm1zF6oIG +PTwfVrpiZBwiUtfJol1exr/MzSPyGoJnYs3cRf2E3O+D1LbcR8w0LbjGuUy38Piz +ZO/vCeyJ3JZC5kE8nD+XBA4idwzh0BKEfH9t+WchQ3Up9rxyzLyQamoqt5Xby4pY +=xkM3 +-----END PGP PUBLIC KEY BLOCK----- +``` diff --git a/SystemConfig.json b/SystemConfig.json index ec966e1e..827e11b5 100644 --- a/SystemConfig.json +++ b/SystemConfig.json @@ -9,9 +9,9 @@ "L1_TX_INTRINSIC_L2_GAS": 167157, "L1_TX_INTRINSIC_PUBDATA": 88, "MAX_GAS_PER_TRANSACTION": 80000000, - "BOOTLOADER_MEMORY_FOR_TXS": 485225, + "BOOTLOADER_MEMORY_FOR_TXS": 8740224, "REFUND_GAS": 7343, "KECCAK_ROUND_COST_GAS": 40, "SHA256_ROUND_COST_GAS": 7, "ECRECOVER_COST_GAS": 1112 -} \ No newline at end of file +} diff --git a/SystemContractsHashes.json b/SystemContractsHashes.json new file mode 100644 index 00000000..e123d0e6 --- /dev/null +++ b/SystemContractsHashes.json @@ -0,0 +1,177 @@ +[ + { + "contractName": "AccountCodeStorage", + "bytecodePath": "artifacts-zk/cache-zk/solpp-generated-contracts/AccountCodeStorage.sol/AccountCodeStorage.json", + "sourceCodePath": "cache-zk/solpp-generated-contracts/AccountCodeStorage.sol", + "bytecodeHash": "0x0100009bc0511159b5ec703d0c56f87615964017739def4ab1ee606b8ec6458c", + "sourceCodeHash": "0xb7a285eceef853b5259266de51584c7120fdc0335657b457c63a331301c96d8f" + }, + { + "contractName": "BootloaderUtilities", + "bytecodePath": "artifacts-zk/cache-zk/solpp-generated-contracts/BootloaderUtilities.sol/BootloaderUtilities.json", + "sourceCodePath": "cache-zk/solpp-generated-contracts/BootloaderUtilities.sol", + "bytecodeHash": "0x010009759cab4fa9e6ca0784746e1df600ff523f0f90c1e94191755cab4b2ed0", + "sourceCodeHash": "0xf40ae3c82f6eb7b88e4d926c706c3edc3c2ce07bb60f60cd21accd228f38c212" + }, + { + "contractName": "ComplexUpgrader", + "bytecodePath": "artifacts-zk/cache-zk/solpp-generated-contracts/ComplexUpgrader.sol/ComplexUpgrader.json", + "sourceCodePath": "cache-zk/solpp-generated-contracts/ComplexUpgrader.sol", + "bytecodeHash": "0x0100005bfc0443349233459892b51e9f67e27ac828d44d9c7cba8c8285fd66bc", + "sourceCodeHash": "0xbf583b121fde4d406912afa7af7943adb440e355fcbf476f5b454c58fd07eda0" + }, + { + "contractName": "Compressor", + "bytecodePath": "artifacts-zk/cache-zk/solpp-generated-contracts/Compressor.sol/Compressor.json", + "sourceCodePath": "cache-zk/solpp-generated-contracts/Compressor.sol", + "bytecodeHash": "0x010001b72874590239af612f65d50a35975299f88de022493fe7f0a190e79496", + "sourceCodeHash": "0xba41d1e46cd62c08f61ac78b693e5adbb5428f33640e0e55ff58cbd04093cd07" + }, + { + "contractName": "ContractDeployer", + "bytecodePath": "artifacts-zk/cache-zk/solpp-generated-contracts/ContractDeployer.sol/ContractDeployer.json", + "sourceCodePath": "cache-zk/solpp-generated-contracts/ContractDeployer.sol", + "bytecodeHash": "0x010006091341955c8f76409de00549fb00b275166b5a0d0d7b82cbd629bb4212", + "sourceCodeHash": "0x660e9a188006f9e6086214f8aefa7bc9dc434ce6ff220bfec98327c42953dda4" + }, + { + "contractName": "DefaultAccount", + "bytecodePath": "artifacts-zk/cache-zk/solpp-generated-contracts/DefaultAccount.sol/DefaultAccount.json", + "sourceCodePath": "cache-zk/solpp-generated-contracts/DefaultAccount.sol", + "bytecodeHash": "0x01000651c5ae96f2aab07d720439e42491bb44c6384015e3a08e32620a4d582d", + "sourceCodeHash": "0x7356cb68b6326a6ee4871525bfb26aedf9a30c1da18461c68d10d90e1653b05c" + }, + { + "contractName": "EmptyContract", + "bytecodePath": "artifacts-zk/cache-zk/solpp-generated-contracts/EmptyContract.sol/EmptyContract.json", + "sourceCodePath": "cache-zk/solpp-generated-contracts/EmptyContract.sol", + "bytecodeHash": "0x01000007271e9710c356751295d83a25ffec94be2b4ada01ec1fa04c7cd6f2c7", + "sourceCodeHash": "0x8bb626635c3cab6c5fc3b83e2ce09f98a8193ecdf019653bbe55d6cae3138b5d" + }, + { + "contractName": "ImmutableSimulator", + "bytecodePath": "artifacts-zk/cache-zk/solpp-generated-contracts/ImmutableSimulator.sol/ImmutableSimulator.json", + "sourceCodePath": "cache-zk/solpp-generated-contracts/ImmutableSimulator.sol", + "bytecodeHash": "0x01000047a3c40e3f4eb98f14967f141452ae602d8723a10975dc33960911d8c5", + "sourceCodeHash": "0x8d1f252875fe4a8a1cd51bf7bd678b9bff7542bb468f75929cea69df4a16850d" + }, + { + "contractName": "KnownCodesStorage", + "bytecodePath": "artifacts-zk/cache-zk/solpp-generated-contracts/KnownCodesStorage.sol/KnownCodesStorage.json", + "sourceCodePath": "cache-zk/solpp-generated-contracts/KnownCodesStorage.sol", + "bytecodeHash": "0x0100008b0ca6c6f277035366e99407fbb4b01e743e80b7d24dea5a3d647b423e", + "sourceCodeHash": "0x15cb53060dad4c62e72c62777ff6a25029c6ec0ab37adacb684d0e275cec6749" + }, + { + "contractName": "L1Messenger", + "bytecodePath": "artifacts-zk/cache-zk/solpp-generated-contracts/L1Messenger.sol/L1Messenger.json", + "sourceCodePath": "cache-zk/solpp-generated-contracts/L1Messenger.sol", + "bytecodeHash": "0x01000301c943edb65f5a0b8cdd806218b8ecf25c022720fe3afe6951f202f3fa", + "sourceCodeHash": "0x11a4280dcacc9de950ee8724bc6e4f99a4268c38a0cb26ebd5f28e6ea1094463" + }, + { + "contractName": "L2EthToken", + "bytecodePath": "artifacts-zk/cache-zk/solpp-generated-contracts/L2EthToken.sol/L2EthToken.json", + "sourceCodePath": "cache-zk/solpp-generated-contracts/L2EthToken.sol", + "bytecodeHash": "0x01000139b506af2b02225838c5a33e30ace701b44b210a422eedab7dd31c28a3", + "sourceCodeHash": "0xadc69be5b5799d0f1a6fa71d56a6706b146447c8e3c6516a5191a0b23bd134e8" + }, + { + "contractName": "MsgValueSimulator", + "bytecodePath": "artifacts-zk/cache-zk/solpp-generated-contracts/MsgValueSimulator.sol/MsgValueSimulator.json", + "sourceCodePath": "cache-zk/solpp-generated-contracts/MsgValueSimulator.sol", + "bytecodeHash": "0x0100006fa1591d93fcc4a25e9340ad11d0e825904cd1842b8f7255701e1aacbb", + "sourceCodeHash": "0xe7a85dc51512cab431d12bf062847c4dcf2f1c867e7d547ff95638f6a4e8fd4e" + }, + { + "contractName": "NonceHolder", + "bytecodePath": "artifacts-zk/cache-zk/solpp-generated-contracts/NonceHolder.sol/NonceHolder.json", + "sourceCodePath": "cache-zk/solpp-generated-contracts/NonceHolder.sol", + "bytecodeHash": "0x0100012fa73fa922dd9fabb40d3275ce80396eff6ccf1b452c928c17d98bd470", + "sourceCodeHash": "0x1680f801086c654032f2331a574752e9c3b21df8a60110f4ea5fe26bb51e8095" + }, + { + "contractName": "SystemContext", + "bytecodePath": "artifacts-zk/cache-zk/solpp-generated-contracts/SystemContext.sol/SystemContext.json", + "sourceCodePath": "cache-zk/solpp-generated-contracts/SystemContext.sol", + "bytecodeHash": "0x0100023ba65021e4689dd1755f82108214a1f25150d439fe58c55cdb1f376436", + "sourceCodeHash": "0x43d1d893695361edf014acd62f66dfe030868f342fe5d0aa1b6ddb520f3a5ad4" + }, + { + "contractName": "EventWriter", + "bytecodePath": "contracts/artifacts/EventWriter.yul/EventWriter.yul.zbin", + "sourceCodePath": "contracts/EventWriter.yul", + "bytecodeHash": "0x01000019642d87621fdd82cf65aa9146486c9256d5f8849af9a37c78ef519339", + "sourceCodeHash": "0x55cfee65f174350edfd690c949bc0a29458f25da11f1d5f90b57621567df1fc3" + }, + { + "contractName": "EcAdd", + "bytecodePath": "contracts/precompiles/artifacts/EcAdd.yul/EcAdd.yul.zbin", + "sourceCodePath": "contracts/precompiles/EcAdd.yul", + "bytecodeHash": "0x010000c5a85a372f441ac693210a18e683b530bed875fdcab2f7e101b057d433", + "sourceCodeHash": "0x32645126b8765e4f7ced63c9508c70edc4ab734843d5f0f0f01d153c27206cee" + }, + { + "contractName": "EcMul", + "bytecodePath": "contracts/precompiles/artifacts/EcMul.yul/EcMul.yul.zbin", + "sourceCodePath": "contracts/precompiles/EcMul.yul", + "bytecodeHash": "0x0100013759b40792c2c3d033990e992e5508263c15252eb2d9bfbba571350675", + "sourceCodeHash": "0xdad8be6e926155a362ea05b132ba8b6c634e978a41f79bb6390b870e18049e45" + }, + { + "contractName": "Ecrecover", + "bytecodePath": "contracts/precompiles/artifacts/Ecrecover.yul/Ecrecover.yul.zbin", + "sourceCodePath": "contracts/precompiles/Ecrecover.yul", + "bytecodeHash": "0x010000114daca2ff44f27d543b8ef67d885bfed09a74ba9cb25f5912dd3d739c", + "sourceCodeHash": "0x18eac0a993afec4112da99fc8e2978891598ab12566528628896f430c855fb81" + }, + { + "contractName": "Keccak256", + "bytecodePath": "contracts/precompiles/artifacts/Keccak256.yul/Keccak256.yul.zbin", + "sourceCodePath": "contracts/precompiles/Keccak256.yul", + "bytecodeHash": "0x0100001fb52ca33668d01c230a1c3b13ede90fe2e37d77222410e9f183cb7a89", + "sourceCodeHash": "0x6415e127a4e07907fb87d0cbdf480fff8c70326c4f2f670af0cf3248862e4df4" + }, + { + "contractName": "SHA256", + "bytecodePath": "contracts/precompiles/artifacts/SHA256.yul/SHA256.yul.zbin", + "sourceCodePath": "contracts/precompiles/SHA256.yul", + "bytecodeHash": "0x010000178d93b2d7d6448866009892223caf018a8e8dbcf090c2b9053a285f8d", + "sourceCodeHash": "0x8f5a719394836111c850774e89ffb22ef825ff4d24d116ca750888be906f0109" + }, + { + "contractName": "bootloader_test", + "bytecodePath": "bootloader/build/artifacts/bootloader_test.yul/bootloader_test.yul.zbin", + "sourceCodePath": "bootloader/build/bootloader_test.yul", + "bytecodeHash": "0x01000385425e3ddcaa5a6780f2463c8aa71b844d914b61471f468173d7eaff0d", + "sourceCodeHash": "0xda28bc1ac0cd1e0a34ea99bb70cde15fd0edbacffe7491186620f46fc821c201" + }, + { + "contractName": "fee_estimate", + "bytecodePath": "bootloader/build/artifacts/fee_estimate.yul/fee_estimate.yul.zbin", + "sourceCodePath": "bootloader/build/fee_estimate.yul", + "bytecodeHash": "0x0100096bebcd3abfed25138ff97587a5783c0294c25627aa4166bd1c91913a2d", + "sourceCodeHash": "0x6732aa11175c77394065e586f123d10a844335bc57a58ef47291de32583de225" + }, + { + "contractName": "gas_test", + "bytecodePath": "bootloader/build/artifacts/gas_test.yul/gas_test.yul.zbin", + "sourceCodePath": "bootloader/build/gas_test.yul", + "bytecodeHash": "0x0100094b78d8a52b54f82e4f1007a1c0c9ae7e2d54e73321549d7a70bb320bbf", + "sourceCodeHash": "0x68f07a46c3179705047c41b63b03e157fa48b0f06427801bedc8d45e335ea7c3" + }, + { + "contractName": "playground_batch", + "bytecodePath": "bootloader/build/artifacts/playground_batch.yul/playground_batch.yul.zbin", + "sourceCodePath": "bootloader/build/playground_batch.yul", + "bytecodeHash": "0x0100097500c0f3cc64c09339b8215f35ebdf155f2c7188b4b9426cd8d58b80cc", + "sourceCodeHash": "0x5a121577cd4335105a6b9864196ecb5796890299fac95e7003d9f23bd210e907" + }, + { + "contractName": "proved_batch", + "bytecodePath": "bootloader/build/artifacts/proved_batch.yul/proved_batch.yul.zbin", + "sourceCodePath": "bootloader/build/proved_batch.yul", + "bytecodeHash": "0x010009657432df24acfe7950b2d1a0707520ca6b7acb699e58c0f378c0ed7a11", + "sourceCodeHash": "0x2469138639d133005f6d3b7fad3d7404db5b4088b2649e9f5167d2a22df3b1de" + } +] diff --git a/bootloader/bootloader.yul b/bootloader/bootloader.yul index 46f77f9c..89a2c050 100644 --- a/bootloader/bootloader.yul +++ b/bootloader/bootloader.yul @@ -3,81 +3,20 @@ object "Bootloader" { } object "Bootloader_deployed" { code { - /// @notice the address that will be the beneficiary of all the fees - let OPERATOR_ADDRESS := mload(0) - - let GAS_PRICE_PER_PUBDATA := 0 - - // Initializing batch params - { - /// @notice The hash of the previous batch - let PREV_BATCH_HASH := mload(32) - /// @notice The timestamp of the batch being processed - let NEW_BATCH_TIMESTAMP := mload(64) - /// @notice The number of the new batch being processed. - /// While this number is deterministic for each batch, we - /// still provide it here to ensure consistency between the state - /// of the VM and the state of the operator. - let NEW_BATCH_NUMBER := mload(96) - - /// @notice The gas price on L1 for ETH. In the future, a trustless value will be enforced. - /// For now, this value is trusted to be fairly provided by the operator. - let L1_GAS_PRICE := mload(128) - - /// @notice The minimal gas price that the operator agrees upon. - /// In the future, it will have an EIP1559-like lower bound. - let FAIR_L2_GAS_PRICE := mload(160) - - /// @notice The expected base fee by the operator. - /// Just like the batch number, while calculated on the bootloader side, - /// the operator still provides it to make sure that its data is in sync. - let EXPECTED_BASE_FEE := mload(192) - - validateOperatorProvidedPrices(L1_GAS_PRICE, FAIR_L2_GAS_PRICE) - - // This implementation of the bootloader relies on the correct version of the SystemContext - // and it can not be upgraded via a standard upgrade transaction, but needs to ensure - // correctness itself before any transaction is executed. - upgradeSystemContextIfNeeded() - - let baseFee := 0 - - - - // Only for the proved batch we enforce that the baseFee proposed - // by the operator is equal to the expected one. For the playground batch, we allow - // the operator to provide any baseFee the operator wants. - baseFee, GAS_PRICE_PER_PUBDATA := getBaseFee(L1_GAS_PRICE, FAIR_L2_GAS_PRICE) - if iszero(eq(baseFee, EXPECTED_BASE_FEE)) { - debugLog("baseFee", baseFee) - debugLog("EXPECTED_BASE_FEE", EXPECTED_BASE_FEE) - assertionError("baseFee inconsistent") - } - - setNewBatch(PREV_BATCH_HASH, NEW_BATCH_TIMESTAMP, NEW_BATCH_NUMBER, EXPECTED_BASE_FEE) - - - - - - baseFee, GAS_PRICE_PER_PUBDATA := getBaseFee(L1_GAS_PRICE, FAIR_L2_GAS_PRICE) - - let SHOULD_SET_NEW_BATCH := mload(224) - - switch SHOULD_SET_NEW_BATCH - case 0 { - unsafeOverrideBatch(NEW_BATCH_TIMESTAMP, NEW_BATCH_NUMBER, EXPECTED_BASE_FEE) - } - default { - setNewBatch(PREV_BATCH_HASH, NEW_BATCH_TIMESTAMP, NEW_BATCH_NUMBER, EXPECTED_BASE_FEE) - } + {{CODE_START_PLACEHOLDER}} - - } + //////////////////////////////////////////////////////////////////////////// + // Function Declarations + //////////////////////////////////////////////////////////////////////////// // While we definitely cannot control the gas price on L1, // we need to check the operator does not provide any absurd numbers there - function MAX_ALLOWED_GAS_PRICE() -> ret { + function MAX_ALLOWED_L1_GAS_PRICE() -> ret { + // 100k gwei + ret := 100000000000000 + } + + function MAX_ALLOWED_FAIR_L2_GAS_PRICE() -> ret { // 10k gwei ret := 10000000000000 } @@ -85,11 +24,11 @@ object "Bootloader" { /// @dev This method ensures that the prices provided by the operator /// are not absurdly high function validateOperatorProvidedPrices(l1GasPrice, fairL2GasPrice) { - if gt(l1GasPrice, MAX_ALLOWED_GAS_PRICE()) { + if gt(l1GasPrice, MAX_ALLOWED_L1_GAS_PRICE()) { assertionError("L1 gas price too high") } - if gt(fairL2GasPrice, MAX_ALLOWED_GAS_PRICE()) { + if gt(fairL2GasPrice, MAX_ALLOWED_FAIR_L2_GAS_PRICE()) { assertionError("L2 fair gas price too high") } } @@ -143,12 +82,6 @@ object "Bootloader" { ret := {{MAX_GAS_PER_TRANSACTION}} } - /// @dev The maximum number of pubdata bytes that can be published with one - /// L1 batch - function MAX_PUBDATA_PER_BATCH() -> ret { - ret := {{MAX_PUBDATA_PER_BATCH}} - } - /// @dev The number of L1 gas needed to be spent for /// L1 byte. While a single pubdata byte costs `16` gas, /// we demand at least 17 to cover up for the costs of additional @@ -383,9 +316,47 @@ object "Bootloader" { ret := mul(COMPRESSED_BYTECODES_END_SLOT(), 32) } + /// @dev Slots needed to store priority txs L1 data (`chainedPriorityTxsHash` and `numberOfLayer1Txs`). + function PRIORITY_TXS_L1_DATA_RESERVED_SLOTS() -> ret { + ret := 2 + } + + /// @dev Slot from which storing of the priority txs L1 data begins. + function PRIORITY_TXS_L1_DATA_BEGIN_SLOT() -> ret { + ret := add(COMPRESSED_BYTECODES_BEGIN_SLOT(), COMPRESSED_BYTECODES_SLOTS()) + } + + /// @dev The byte from which storing of the priority txs L1 data begins. + function PRIORITY_TXS_L1_DATA_BEGIN_BYTE() -> ret { + ret := mul(PRIORITY_TXS_L1_DATA_BEGIN_SLOT(), 32) + } + + /// @dev Slot from which storing of the L1 Messenger pubdata begins. + function OPERATOR_PROVIDED_L1_MESSENGER_PUBDATA_BEGIN_SLOT() -> ret { + ret := add(PRIORITY_TXS_L1_DATA_BEGIN_SLOT(), PRIORITY_TXS_L1_DATA_RESERVED_SLOTS()) + } + + /// @dev The byte storing of the L1 Messenger pubdata begins. + function OPERATOR_PROVIDED_L1_MESSENGER_PUBDATA_BEGIN_BYTE() -> ret { + ret := mul(OPERATOR_PROVIDED_L1_MESSENGER_PUBDATA_BEGIN_SLOT(), 32) + } + + /// @dev Slots needed to store L1 Messenger pubdata. + /// @dev Note that are many more these than the maximal pubdata in batch, since + /// it needs to also accomodate uncompressed state diffs that are required for the state diff + /// compression verification. + function OPERATOR_PROVIDED_L1_MESSENGER_PUBDATA_SLOTS() -> ret { + ret := {{OPERATOR_PROVIDED_L1_MESSENGER_PUBDATA_SLOTS}} + } + + /// @dev The slot right after the last slot of the L1 Messenger pubdata memory area. + function OPERATOR_PROVIDED_L1_MESSENGER_PUBDATA_END_SLOT() -> ret { + ret := add(OPERATOR_PROVIDED_L1_MESSENGER_PUBDATA_BEGIN_SLOT(), OPERATOR_PROVIDED_L1_MESSENGER_PUBDATA_SLOTS()) + } + /// @dev The slot from which the bootloader transactions' descriptions begin function TX_DESCRIPTION_BEGIN_SLOT() -> ret { - ret := COMPRESSED_BYTECODES_END_SLOT() + ret := OPERATOR_PROVIDED_L1_MESSENGER_PUBDATA_END_SLOT() } /// @dev The byte from which the bootloader transactions' descriptions begin @@ -517,6 +488,10 @@ object "Bootloader" { ret := 0x000000000000000000000000000000000000800e } + function L1_MESSENGER_ADDR() -> ret { + ret := 0x0000000000000000000000000000000000008008 + } + /// @dev The minimal allowed distance in bytes between the pointer to the compressed data /// and the end of the area dedicated for the compressed bytecodes. /// In fact, only distance of 192 should be sufficient: there it would be possible to insert @@ -550,123 +525,6 @@ object "Bootloader" { ret := 1000000 } - // Now, we iterate over all transactions, processing each of them - // one by one. - // Here, the `resultPtr` is the pointer to the memory slot, where we will write - // `true` or `false` based on whether the tx execution was successful, - - // The position at which the tx offset of the transaction should be placed - let currentExpectedTxOffset := add(TXS_IN_BATCH_LAST_PTR(), mul(MAX_POSTOP_SLOTS(), 32)) - - let txPtr := TX_DESCRIPTION_BEGIN_BYTE() - - // At the COMPRESSED_BYTECODES_BEGIN_BYTE() the pointer to the newest bytecode to be published - // is stored. - mstore(COMPRESSED_BYTECODES_BEGIN_BYTE(), add(COMPRESSED_BYTECODES_BEGIN_BYTE(), 0x20)) - - // Iterating through transaction descriptions - let transactionIndex := 0 - for { - let resultPtr := RESULT_START_PTR() - } lt(txPtr, TXS_IN_BATCH_LAST_PTR()) { - txPtr := add(txPtr, TX_DESCRIPTION_SIZE()) - resultPtr := add(resultPtr, 32) - transactionIndex := add(transactionIndex, 1) - } { - let execute := mload(txPtr) - - debugLog("txPtr", txPtr) - debugLog("execute", execute) - - if iszero(execute) { - // We expect that all transactions that are executed - // are continuous in the array. - break - } - - let txDataOffset := mload(add(txPtr, 0x20)) - - // We strongly enforce the positions of transactions - if iszero(eq(currentExpectedTxOffset, txDataOffset)) { - debugLog("currentExpectedTxOffset", currentExpectedTxOffset) - debugLog("txDataOffset", txDataOffset) - - assertionError("Tx data offset is incorrect") - } - - currentExpectedTxOffset := validateAbiEncoding(txDataOffset) - - // Checking whether the last slot of the transaction's description - // does not go out of bounds. - if gt(sub(currentExpectedTxOffset, 32), LAST_FREE_SLOT()) { - debugLog("currentExpectedTxOffset", currentExpectedTxOffset) - debugLog("LAST_FREE_SLOT", LAST_FREE_SLOT()) - - assertionError("currentExpectedTxOffset too high") - } - - validateTypedTxStructure(add(txDataOffset, 0x20)) - - - { - debugLog("ethCall", 0) - processTx(txDataOffset, resultPtr, transactionIndex, 0, GAS_PRICE_PER_PUBDATA) - } - - - { - let txMeta := mload(txPtr) - let processFlags := getWordByte(txMeta, 31) - debugLog("flags", processFlags) - - - // `processFlags` argument denotes which parts of execution should be done: - // Possible values: - // 0x00: validate & execute (normal mode) - // 0x02: perform ethCall (i.e. use mimicCall to simulate the call) - - let isETHCall := eq(processFlags, 0x02) - debugLog("ethCall", isETHCall) - processTx(txDataOffset, resultPtr, transactionIndex, isETHCall, GAS_PRICE_PER_PUBDATA) - } - - // Signal to the vm that the transaction execution is complete - setHook(VM_HOOK_TX_HAS_ENDED()) - // Increment tx index within the system. - considerNewTx() - } - - // The bootloader doesn't have to pay anything - setPricePerPubdataByte(0) - - // Resetting tx.origin and gasPrice to 0, so we don't pay for - // publishing them on-chain. - setTxOrigin(0) - setGasPrice(0) - - // Transferring all the ETH received in the batch to the operator - directETHTransfer( - selfbalance(), - OPERATOR_ADDRESS - ) - - // Hook that notifies that the operator should provide final information for the batch - setHook(VM_HOOK_FINAL_L2_STATE_INFO()) - - // Each batch typically ends with a special block which contains no transactions. - // So we need to have this method to reflect it in the system contracts too. - // - // The reason is that as of now our node requires that each storage write (event, etc) belongs to a particular - // L2 block. In case a batch is sealed by timeout (i.e. the resources of the batch have not been exhaused, but we need - // to seal it to assure timely finality), we need to process sending funds to the operator *after* the last - // non-empty L2 block has been already sealed. We can not override old L2 blocks, so we need to create a new empty "fictive" block for it. - // - // The other reason why we need to set this block is so that in case of empty batch (i.e. the one which has no transactions), - // the virtual block number as well as miniblock number are incremented. - setL2Block(transactionIndex) - - publishBatchDataToL1() - /// @dev Ceil division of integers function ceilDiv(x, y) -> ret { switch or(eq(x, 0), eq(y, 0)) @@ -702,7 +560,7 @@ object "Bootloader" { // We set the L2 block info for this particular transaction setL2Block(transactionIndex) - let innerTxDataOffset := add(txDataOffset, 0x20) + let innerTxDataOffset := add(txDataOffset, 32) // By default we assume that the transaction has failed. mstore(resultPtr, 0) @@ -724,11 +582,17 @@ object "Bootloader" { assertionError("Protocol upgrade tx not first") } - processL1Tx(txDataOffset, resultPtr, transactionIndex, userProvidedPubdataPrice) + // This is to be called in the event that the L1 Transaction is a protocol upgrade txn. + // Since this is upgrade transactions, we are okay that the gasUsed by the transaction will + // not cover this additional hash computation + let canonicalL1TxHash := getCanonicalL1TxHash(txDataOffset) + sendToL1Native(true, protocolUpgradeTxHashKey(), canonicalL1TxHash) + + processL1Tx(txDataOffset, resultPtr, transactionIndex, userProvidedPubdataPrice, false) } case 255 { // This is an L1->L2 transaction. - processL1Tx(txDataOffset, resultPtr, transactionIndex, userProvidedPubdataPrice) + processL1Tx(txDataOffset, resultPtr, transactionIndex, userProvidedPubdataPrice, true) } default { // The user has not agreed to this pubdata price @@ -770,45 +634,15 @@ object "Bootloader" { } } - /// @dev Checks whether the code hash of the system context contract is correct and updates it if needed. - /// @dev The bootloader implementation strictly relies of the ability of the system context contract to work with the - /// L2 blocks. However, the old system context did not support the correspodning interface at all. Usually we upgrade system context - /// via an upgrade transaction, but in this case the transaction won't be even processed, because of failure to create an L2 block. - function upgradeSystemContextIfNeeded() { - let expectedCodeHash := {{SYSTEM_CONTEXT_EXPECTED_CODE_HASH}} - - let actualCodeHash := extcodehash(SYSTEM_CONTEXT_ADDR()) - if iszero(eq(expectedCodeHash, actualCodeHash)) { - // Preparing the calldata to upgrade the SystemContext contract - {{UPGRADE_SYSTEM_CONTEXT_CALLDATA}} - - // We'll use a mimicCall to simulate the correct sender. - let success := mimicCallOnlyResult( - CONTRACT_DEPLOYER_ADDR(), - FORCE_DEPLOYER(), - 0, - 0, - 0, - 0, - 0, - 0 - ) - - if iszero(success) { - assertionError("system context upgrade fail") - } - } - } - /// @dev Calculates the canonical hash of the L1->L2 transaction that will be /// sent to L1 as a message to the L1 contract that a certain operation has been processed. function getCanonicalL1TxHash(txDataOffset) -> ret { // Putting the correct value at the `txDataOffset` just in case, since // the correctness of this value is not part of the system invariants. // Note, that the correct ABI encoding of the Transaction structure starts with 0x20 - mstore(txDataOffset, 0x20) + mstore(txDataOffset, 32) - let innerTxDataOffset := add(txDataOffset, 0x20) + let innerTxDataOffset := add(txDataOffset, 32) let dataLength := safeAdd(32, getDataLength(innerTxDataOffset), "qev") debugLog("HASH_OFFSET", innerTxDataOffset) @@ -823,7 +657,7 @@ object "Bootloader" { /// The operator will be paid at the end of the batch. function ensurePayment(txDataOffset, gasPrice) { // Skipping the first 0x20 byte in the encoding of the transaction. - let innerTxDataOffset := add(txDataOffset, 0x20) + let innerTxDataOffset := add(txDataOffset, 32) let from := getFrom(innerTxDataOffset) let requiredETH := safeMul(getGasLimit(innerTxDataOffset), gasPrice, "lal") @@ -942,7 +776,7 @@ object "Bootloader" { // 0x20 || context_len || context_bytes... let returnlen := returndatasize() // The minimal allowed returndatasize is 64: magicValue || offset - if lt(returnlen, 0x40) { + if lt(returnlen, 64) { revertWithReason( PAYMASTER_RETURNED_INVALID_CONTEXT(), 0 @@ -954,7 +788,7 @@ object "Bootloader" { // but it is so in fee estimation and we want to preserve as many operations as // in the original operation. { - returndatacopy(0, 0, 0x20) + returndatacopy(0, 0, 32) let magic := mload(0) let isMagicCorrect := eq(magic, {{SUCCESSFUL_PAYMASTER_VALIDATION_MAGIC_VALUE}}) @@ -1011,14 +845,14 @@ object "Bootloader" { ) } - if gt(add(returnedContextOffset, add(0x20, returnedContextLen)), returnlen) { + if gt(add(returnedContextOffset, add(32, returnedContextLen)), returnlen) { revertWithReason( PAYMASTER_RETURNED_INVALID_CONTEXT(), 0 ) } - returndatacopy(PAYMASTER_CONTEXT_BEGIN_BYTE(), returnedContextOffset, add(0x20, returnedContextLen)) + returndatacopy(PAYMASTER_CONTEXT_BEGIN_BYTE(), returnedContextOffset, add(32, returnedContextLen)) } /// @dev The function responsible for processing L1->L2 transactions. @@ -1026,12 +860,14 @@ object "Bootloader" { /// @param resultPtr The pointer at which the result of the execution of this transaction /// @param transactionIndex The index of the transaction /// @param gasPerPubdata The price per pubdata to be used + /// @param isPriorityOp Whether the transaction is a priority one /// should be stored. function processL1Tx( txDataOffset, resultPtr, transactionIndex, gasPerPubdata, + isPriorityOp ) { // For L1->L2 transactions we always use the pubdata price provided by the transaction. // This is needed to ensure DDoS protection. All the excess expenditure @@ -1039,7 +875,7 @@ object "Bootloader" { setPricePerPubdataByte(gasPerPubdata) // Skipping the first formal 0x20 byte - let innerTxDataOffset := add(txDataOffset, 0x20) + let innerTxDataOffset := add(txDataOffset, 32) let gasLimitForTx, reservedGas := getGasLimitForTx( innerTxDataOffset, @@ -1081,11 +917,9 @@ object "Bootloader" { // In case the operator provided smaller refund than the one calculated // by the bootloader, we return the refund calculated by the bootloader. - refundGas := max(getOperatorRefundForTx(transactionIndex), potentialRefund) + refundGas := max(getOperatorRefundForTx(transactionIndex), safeAdd(potentialRefund, reservedGas, "iop")) } - refundGas := add(refundGas, reservedGas) - if gt(refundGas, gasLimit) { assertionError("L1: refundGas > gasLimit") } @@ -1103,10 +937,14 @@ object "Bootloader" { let toRefundRecipient switch success case 0 { + if iszero(isPriorityOp) { + // Upgrade transactions must always succeed + assertionError("Upgrade tx failed") + } + // If the transaction reverts, then minting the msg.value to the user has been reverted // as well, so we can simply mint everything that the user has deposited to // the refund recipient - toRefundRecipient := safeSub(getReserved0(innerTxDataOffset), payToOperator, "vji") } default { @@ -1127,10 +965,17 @@ object "Bootloader" { mstore(resultPtr, success) debugLog("Send message to L1", success) - - // Sending the L2->L1 to notify the L1 contracts that the priority - // operation has been processed. - sendToL1(true, canonicalL1TxHash, success) + + // Sending the L2->L1 log so users will be able to prove transaction execution result on L1. + sendL2LogUsingL1Messenger(true, canonicalL1TxHash, success) + + if isPriorityOp { + // Update priority txs L1 data + mstore(0, mload(PRIORITY_TXS_L1_DATA_BEGIN_BYTE())) + mstore(32, canonicalL1TxHash) + mstore(PRIORITY_TXS_L1_DATA_BEGIN_BYTE(), keccak256(0, 64)) + mstore(add(PRIORITY_TXS_L1_DATA_BEGIN_BYTE(), 32), add(mload(add(PRIORITY_TXS_L1_DATA_BEGIN_BYTE(), 32)), 1)) + } } function getExecuteL1TxAndGetRefund(txDataOffset, gasForExecution) -> potentialRefund, success { @@ -1160,7 +1005,7 @@ object "Bootloader" { /// @return canonicalL1TxHash The hash of processed L1->L2 transaction /// @return gasUsedOnPreparation The number of L2 gas used in the preparation stage function l1TxPreparation(txDataOffset) -> canonicalL1TxHash, gasUsedOnPreparation { - let innerTxDataOffset := add(txDataOffset, 0x20) + let innerTxDataOffset := add(txDataOffset, 32) let gasBeforePreparation := gas() debugLog("gasBeforePreparation", gasBeforePreparation) @@ -1305,7 +1150,7 @@ object "Bootloader" { totalGasLimit := operatorTrustedGasLimit } - let txEncodingLen := safeAdd(0x20, getDataLength(innerTxDataOffset), "lsh") + let txEncodingLen := safeAdd(32, getDataLength(innerTxDataOffset), "lsh") let operatorOverheadForTransaction := getVerifiedOperatorOverheadForTx( transactionIndex, @@ -1335,7 +1180,7 @@ object "Bootloader" { /// @param txDataOffset The offset to the ABI-encoded Transaction struct. /// @param gasLimitForTx The L2 gas limit for the transaction validation & execution. /// @param gasPrice The L2 gas price that should be used by the transaction. - /// @return ergsLeft The ergs left after the validation step. + /// @return gasLeft The gas left after the validation step. function l2TxValidation( txDataOffset, gasLimitForTx, @@ -1387,9 +1232,9 @@ object "Bootloader" { /// @dev The function responsible for the execution step of the L2 transaction. /// @param txDataOffset The offset to the ABI-encoded Transaction struct. - /// @param ergsLeft The ergs left after the validation step. + /// @param gasLeft The gas left after the validation step. /// @return success Whether or not the execution step was successful. - /// @return ergsSpentOnExecute The ergs spent on the transaction execution. + /// @return gasSpentOnExecute The gas spent on the transaction execution. function l2TxExecution( txDataOffset, gasLeft, @@ -1419,7 +1264,7 @@ object "Bootloader" { default { // Note, that since gt(gasLeft, gasSpentOnFactoryDeps) = true // sub(gasLeft, gasSpentOnFactoryDeps) > 0, which is important - // because a nearCall with 0 ergs passes on all the ergs of the parent frame. + // because a nearCall with 0 gas passes on all the gas of the parent frame. gasLeft := sub(gasLeft, gasSpentOnFactoryDeps) let executeABI := getNearCallABI(gasLeft) @@ -1452,7 +1297,7 @@ object "Bootloader" { setGasPrice(gasPrice) // Skipping the first 0x20 word of the ABI-encoding - let innerTxDataOffset := add(txDataOffset, 0x20) + let innerTxDataOffset := add(txDataOffset, 32) debugLog("Starting validation", 0) accountValidateTx(txDataOffset) @@ -1473,7 +1318,7 @@ object "Bootloader" { txDataOffset ) -> success { // Skipping the first word of the ABI-encoding encoding - let innerTxDataOffset := add(txDataOffset, 0x20) + let innerTxDataOffset := add(txDataOffset, 32) let from := getFrom(innerTxDataOffset) debugLog("Executing L2 tx", 0) @@ -1569,7 +1414,7 @@ object "Bootloader" { finalRefund := 0 - let innerTxDataOffset := add(txDataOffset, 0x20) + let innerTxDataOffset := add(txDataOffset, 32) let paymaster := getPaymaster(innerTxDataOffset) let refundRecipient := 0 @@ -1582,6 +1427,7 @@ object "Bootloader" { refundRecipient := paymaster if gt(gasLeft, 0) { + checkEnoughGas(gasLeft) let nearCallAbi := getNearCallABI(gasLeft) let gasBeforePostOp := gas() pop(ZKSYNC_NEAR_CALL_callPostOp( @@ -1590,7 +1436,9 @@ object "Bootloader" { paymaster, txDataOffset, success, - gasLeft + // Since the paymaster will be refunded with reservedGas, + // it should know about it + safeAdd(gasLeft, reservedGas, "jkl") )) let gasSpentByPostOp := sub(gasBeforePostOp, gas()) @@ -1750,7 +1598,7 @@ object "Bootloader" { /// @dev Get checked for overcharged operator's overhead for the transaction. /// @param transactionIndex The index of the transaction in the batch /// @param txTotalGasLimit The total gass limit of the transaction (including the overhead). - /// @param gasPerPubdataByte The price for pubdata byte in ergs. + /// @param gasPerPubdataByte The price for pubdata byte in gas. /// @param txEncodeLen The length of the ABI-encoding of the transaction function getVerifiedOperatorOverheadForTx( transactionIndex, @@ -1791,7 +1639,7 @@ object "Bootloader" { txDataOffset ) -> success { // Skipping the first word of the ABI encoding of the struct - let innerTxDataOffset := add(txDataOffset, 0x20) + let innerTxDataOffset := add(txDataOffset, 32) let from := getFrom(innerTxDataOffset) let gasPrice := getMaxFeePerGas(innerTxDataOffset) @@ -1863,7 +1711,7 @@ object "Bootloader" { txDataOffset, resultPtr ) { - let innerTxDataOffset := add(txDataOffset, 0x20) + let innerTxDataOffset := add(txDataOffset, 32) let to := getTo(innerTxDataOffset) let from := getFrom(innerTxDataOffset) @@ -1910,6 +1758,37 @@ object "Bootloader" { } + /// @dev Given the callee and the data to be called with, + /// this function returns whether the mimicCall should use the `isSystem` flag. + /// This flag should only be used for contract deployments and nothing else. + /// @param to The callee of the call. + /// @param dataPtr The pointer to the calldata of the transaction. + function shouldMsgValueMimicCallBeSystem(to, dataPtr) -> ret { + let dataLen := mload(dataPtr) + // Note, that this point it is not fully known whether it is indeed the selector + // of the calldata (it might not be the case if the `dataLen` < 4), but it will be checked later on + let selector := shr(224, mload(add(dataPtr, 32))) + + let isSelectorCreate := or( + eq(selector, {{CREATE_SELECTOR}}), + eq(selector, {{CREATE_ACCOUNT_SELECTOR}}) + ) + let isSelectorCreate2 := or( + eq(selector, {{CREATE2_SELECTOR}}), + eq(selector, {{CREATE2_ACCOUNT_SELECTOR}}) + ) + + // Firstly, ensure that the selector is a valid deployment function + ret := or( + isSelectorCreate, + isSelectorCreate2 + ) + // Secondly, ensure that the callee is ContractDeployer + ret := and(ret, eq(to, CONTRACT_DEPLOYER_ADDR())) + // Thirdly, ensure that the calldata is long enough to contain the selector + ret := and(ret, gt(dataLen, 3)) + } + /// @dev Given the pointer to the calldata, the value and to /// performs the call through the msg.value simulator. /// @param to Which contract to call @@ -1919,7 +1798,7 @@ object "Bootloader" { /// the length of the calldata and the calldata itself right afterwards. function msgValueSimulatorMimicCall(to, from, value, dataPtr) -> success { // Only calls to the deployer system contract are allowed to be system - let isSystem := eq(to, CONTRACT_DEPLOYER_ADDR()) + let isSystem := shouldMsgValueMimicCallBeSystem(to, dataPtr) success := mimicCallOnlyResult( MSG_VALUE_SIMULATOR_ADDR(), @@ -1981,7 +1860,7 @@ object "Bootloader" { /// 2. Overhead for taking up the bootloader memory. The bootloader memory has a cap on its length, mainly enforced to keep the RAM requirements /// for the node smaller. That is, the user needs to pay a share proportional to the length of the ABI encoding of the transaction. /// 3. Overhead for taking up a slot for the transaction. Since each batch has the limited number of transactions in it, the user must pay - /// at least 1/MAX_TRANSACTIONS_IN_BLOCK part of the overhead. + /// at least 1/MAX_TRANSACTIONS_IN_BATCH part of the overhead. function getTransactionUpfrontOverhead( txGasLimit, gasPerPubdataByte, @@ -2062,6 +1941,11 @@ object "Bootloader" { } } + /// @dev Returns constant that is equal to `keccak256("")` + function EMPTY_STRING_KECCAK() -> ret { + ret := 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 + } + /// @dev Returns whether x <= y function lte(x, y) -> ret { ret := or(lt(x,y), eq(x,y)) @@ -2092,6 +1976,7 @@ object "Bootloader" { ) } + // This method returns AccountAbstractVersion enum. // Currently only two versions are supported: 1 or 0, which basically // mean whether the contract is an account or not. if iszero(supportedVersion) { @@ -2171,7 +2056,7 @@ object "Bootloader" { mstore(add(txDataWithHashesOffset, 64), 96) let calldataPtr := prependSelector(txDataWithHashesOffset, selector) - let innerTxDataOffst := add(txDataOffset, 0x20) + let innerTxDataOffst := add(txDataOffset, 32) let len := getDataLength(innerTxDataOffst) @@ -2195,7 +2080,7 @@ object "Bootloader" { /// @dev Calculates and saves the explorer hash and the suggested signed hash for the transaction. function saveTxHashes(txDataOffset) { let calldataPtr := prependSelector(txDataOffset, {{GET_TX_HASHES_SELECTOR}}) - let innerTxDataOffst := add(txDataOffset, 0x20) + let innerTxDataOffst := add(txDataOffset, 32) let len := getDataLength(innerTxDataOffst) @@ -2260,7 +2145,7 @@ object "Bootloader" { // The length of selector + the first 7 fields (with context len) + context itself. let preTxLen := add(228, paddedContextLen) - let innerTxDataOffset := add(txDataOffset, 0x20) + let innerTxDataOffset := add(txDataOffset, 32) let calldataPtr := sub(innerTxDataOffset, preTxLen) { @@ -2344,7 +2229,7 @@ object "Bootloader" { /// this method also enforces that the nonce has been marked as used. function accountValidateTx(txDataOffset) { // Skipping the first 0x20 word of the ABI-encoding of the struct - let innerTxDataOffst := add(txDataOffset, 0x20) + let innerTxDataOffst := add(txDataOffset, 32) let from := getFrom(innerTxDataOffst) ensureAccount(from) @@ -2390,7 +2275,7 @@ object "Bootloader" { // `SHOULD_ENSURE_CORRECT_RETURNED_MAGIC` is false. It is never false in production // but it is so in fee estimation and we want to preserve as many operations as // in the original operation. - returndatacopy(0, 0, 0x20) + returndatacopy(0, 0, 32) let returnedValue := mload(0) let isMagicCorrect := eq(returnedValue, {{SUCCESSFUL_ACCOUNT_VALIDATION_MAGIC_VALUE}}) @@ -2521,7 +2406,7 @@ object "Bootloader" { isConstructorCall, isSystemCall ) -> ret { - let dataStart := add(dataPtr, 0x20) + let dataStart := add(dataPtr, 32) let dataLength := mload(dataPtr) // Skip dataOffset and memoryPage, because they are always zeros @@ -2580,25 +2465,130 @@ object "Bootloader" { - /// @dev Sends an L2->L1 log. + /// @dev Sends a L2->L1 log using L1Messengers' `sendL2ToL1Log`. /// @param isService The isService flag of the call. /// @param key The `key` parameter of the log. /// @param value The `value` parameter of the log. - function sendToL1(isService, key, value) { - verbatim_3i_0o("to_l1", isService, key, value) - } - - /// @dev Increment the number of txs in the batch - function considerNewTx() { - verbatim_0i_0o("increment_tx_counter") - } + function sendL2LogUsingL1Messenger(isService, key, value) { + mstore(0, {{RIGHT_PADDED_SEND_L2_TO_L1_LOG_SELECTOR}}) + mstore(4, isService) + mstore(36, key) + mstore(68, value) - /// @dev Set the new price per pubdata byte - function setPricePerPubdataByte(newPrice) { - verbatim_1i_0o("set_pubdata_price", newPrice) - } + let success := call( + gas(), + L1_MESSENGER_ADDR(), + 0, + 0, + 100, + 0, + 0 + ) - /// @dev Set the new value for the tx origin context value + if iszero(success) { + debugLog("Failed to send L1Messenger L2Log", key) + debugLog("Failed to send L1Messenger L2Log", value) + + revertWithReason(L1_MESSENGER_LOG_SENDING_FAILED_ERR_CODE(), 1) + } + } + + /// @dev Sends a native (VM) L2->L1 log. + /// @param isService The isService flag of the call. + /// @param key The `key` parameter of the log. + /// @param value The `value` parameter of the log. + function sendToL1Native(isService, key, value) { + verbatim_3i_0o("to_l1", isService, key, value) + } + + /// @notice Performs L1 Messenger pubdata "publishing" call. + /// @dev Expected to be used at the end of the batch. + function l1MessengerPublishingCall() { + let ptr := OPERATOR_PROVIDED_L1_MESSENGER_PUBDATA_BEGIN_BYTE() + debugLog("Publishing batch data to L1", 0) + // First slot (only last 4 bytes) -- selector + mstore(ptr, {{PUBLISH_PUBDATA_SELECTOR}}) + // Second slot -- offset + mstore(add(ptr, 32), 32) + setHook(VM_HOOK_PUBDATA_REQUESTED()) + // Third slot -- length of pubdata + let len := mload(add(ptr, 64)) + // 4 bytes for selector, 32 bytes for array offset and 32 bytes for array length + let fullLen := add(len, 68) + + // ptr + 28 because the function selector only takes up the last 4 bytes in the first slot. + let success := call( + gas(), + L1_MESSENGER_ADDR(), + 0, + add(ptr, 28), + fullLen, + 0, + 0 + ) + + if iszero(success) { + debugLog("Failed to publish L2Logs data", 0) + + revertWithReason(L1_MESSENGER_PUBLISHING_FAILED_ERR_CODE(), 1) + } + } + + function publishTimestampDataToL1() { + debugLog("Publishing timestamp data to L1", 0) + + mstore(0, {{RIGHT_PADDED_PUBLISH_TIMESTAMP_DATA_TO_L1_SELECTOR}}) + let success := call( + gas(), + SYSTEM_CONTEXT_ADDR(), + 0, + 0, + 4, + 0, + 0 + ) + + if iszero(success) { + debugLog("Failed publish timestamp to L1", 0) + revertWithReason(FAILED_TO_PUBLISH_TIMESTAMP_DATA_TO_L1(), 1) + } + } + + /// @notice Performs a call of a System Context + /// method that have no input parameters + function callSystemContext(paddedSelector) { + mstore(0, paddedSelector) + + let success := call( + gas(), + SYSTEM_CONTEXT_ADDR(), + 0, + 0, + 4, + 0, + 0 + ) + + if iszero(success) { + debugLog("Failed to call System Context", 0) + + revertWithReason(FAILED_TO_CALL_SYSTEM_CONTEXT_ERR_CODE(), 1) + } + } + + /// @dev Increment the number of txs in the batch + function considerNewTx() { + verbatim_0i_0o("increment_tx_counter") + + callSystemContext({{RIGHT_PADDED_INCREMENT_TX_NUMBER_IN_BLOCK_SELECTOR}}) + } + + /// @dev Set the new price per pubdata byte + function setPricePerPubdataByte(newPrice) { + verbatim_1i_0o("set_pubdata_price", newPrice) + } + + /// @dev Set the new value for the tx origin context value function setTxOrigin(newTxOrigin) { let success := setContextVal({{RIGHT_PADDED_SET_TX_ORIGIN}}, newTxOrigin) @@ -2729,26 +2719,6 @@ object "Bootloader" { nearCallPanic() } } - } - - function publishBatchDataToL1() { - debugLog("Publishing batch data to L1", 0) - - mstore(0, {{RIGHT_PADDED_PUBLISH_BATCH_DATA_TO_L1_SELECTOR}}) - let success := call( - gas(), - SYSTEM_CONTEXT_ADDR(), - 0, - 0, - 4, - 0, - 0 - ) - - if iszero(success) { - debugLog("Failed publish batch data to L1", 0) - revertWithReason(FAILED_TO_PUBLISH_BATCH_DATA_TO_L1(), 1) - } } @@ -2897,13 +2867,20 @@ object "Bootloader" { if gt(reservedDynamicLength, 0) { assertionError("non-empty reservedDynamic") } - let txType := getTxType(innerTxDataOffset) switch txType case 0 { let maxFeePerGas := getMaxFeePerGas(innerTxDataOffset) let maxPriorityFeePerGas := getMaxPriorityFeePerGas(innerTxDataOffset) assertEq(maxFeePerGas, maxPriorityFeePerGas, "EIP1559 params wrong") + + + + let from := getFrom(innerTxDataOffset) + let iseoa := isEOA(from) + assertEq(iseoa, true, "Only EIP-712 can use non-EOA") + + // Here, for type 0 transactions the reserved0 field is used as a marker // whether the transaction should include chainId in its encoding. @@ -2924,7 +2901,15 @@ object "Bootloader" { let maxFeePerGas := getMaxFeePerGas(innerTxDataOffset) let maxPriorityFeePerGas := getMaxPriorityFeePerGas(innerTxDataOffset) assertEq(maxFeePerGas, maxPriorityFeePerGas, "EIP1559 params wrong") + + + + let from := getFrom(innerTxDataOffset) + let iseoa := isEOA(from) + assertEq(iseoa, true, "Only EIP-712 can use non-EOA") + + assertEq(lte(getGasPerPubdataByteLimit(innerTxDataOffset), MAX_L2_GAS_PER_PUBDATA()), 1, "Gas per pubdata is wrong") assertEq(getPaymaster(innerTxDataOffset), 0, "paymaster non zero") @@ -2943,6 +2928,14 @@ object "Bootloader" { assertEq(lte(getGasPerPubdataByteLimit(innerTxDataOffset), MAX_L2_GAS_PER_PUBDATA()), 1, "Gas per pubdata is wrong") assertEq(getPaymaster(innerTxDataOffset), 0, "paymaster non zero") + + + let from := getFrom(innerTxDataOffset) + let iseoa := isEOA(from) + assertEq(iseoa, true, "Only EIP-712 can use non-EOA") + + + assertEq(gt(getFrom(innerTxDataOffset), MAX_SYSTEM_CONTRACT_ADDR()), 1, "from in kernel space") @@ -2957,6 +2950,12 @@ object "Bootloader" { case 113 { let paymaster := getPaymaster(innerTxDataOffset) assertEq(or(gt(paymaster, MAX_SYSTEM_CONTRACT_ADDR()), iszero(paymaster)), 1, "paymaster in kernel space") + + if iszero(paymaster) { + // Double checking that the paymasterInput is 0 if the paymaster is 0 + assertEq(getPaymasterInputBytesLength(innerTxDataOffset), 0, "paymasterInput non zero") + } + assertEq(gt(getFrom(innerTxDataOffset), MAX_SYSTEM_CONTRACT_ADDR()), 1, "from in kernel space") @@ -2969,6 +2968,8 @@ object "Bootloader" { // Upgrade transaction, no need to validate as it is validated on L1. } case 255 { + // Double-check that the operator doesn't try to do an upgrade transaction via L1 -> L2 transaction. + assertEq(gt(getFrom(innerTxDataOffset), MAX_SYSTEM_CONTRACT_ADDR()), 1, "from in kernel space") // L1 transaction, no need to validate as it is validated on L1. } default { @@ -3091,11 +3092,11 @@ object "Bootloader" { /// This method checks that the transaction's structure is correct /// and tightly packed function validateAbiEncoding(txDataOffset) -> ret { - if iszero(eq(mload(txDataOffset), 0x20)) { + if iszero(eq(mload(txDataOffset), 32)) { assertionError("Encoding offset") } - let innerTxDataOffset := add(txDataOffset, 0x20) + let innerTxDataOffset := add(txDataOffset, 32) let fromValue := getFrom(innerTxDataOffset) if iszero(validateAddress(fromValue)) { @@ -3288,7 +3289,7 @@ object "Bootloader" { } } - /// @dev Returns the addition of two unsigned integers, reverting on overflow. + /// @dev Returns the subtraction of two unsigned integers, reverting on underflow. function safeSub(x, y, errMsg) -> ret { if gt(y, x) { assertionError(errMsg) @@ -3352,7 +3353,7 @@ object "Bootloader" { /// Since the slot after the transaction is not touched, /// this slot can be used in the in-circuit VM out of box. function askOperatorForRefund(gasLeft) { - storeVmHookParam(0, nonOptimized(gasLeft)) + storeVmHookParam(0, nonOptimized(gasLeft)) setHook(VM_HOOK_ASK_OPERATOR_FOR_REFUND()) } @@ -3464,10 +3465,22 @@ object "Bootloader" { ret := 25 } - function FAILED_TO_PUBLISH_BATCH_DATA_TO_L1() -> ret { + function FAILED_TO_PUBLISH_TIMESTAMP_DATA_TO_L1() -> ret { ret := 26 } + function L1_MESSENGER_PUBLISHING_FAILED_ERR_CODE() -> ret { + ret := 27 + } + + function L1_MESSENGER_LOG_SENDING_FAILED_ERR_CODE() -> ret { + ret := 28 + } + + function FAILED_TO_CALL_SYSTEM_CONTEXT_ERR_CODE() -> ret { + ret := 29 + } + /// @dev Accepts a 1-word literal and returns its length in bytes /// @param str A string literal function getStrLen(str) -> len { @@ -3601,6 +3614,11 @@ object "Bootloader" { ret := 11 } + /// @norice The id of the VM hook that use used to notify the operator that it needs to insert the pubdata. + function VM_HOOK_PUBDATA_REQUESTED() -> ret { + ret := 12 + } + // Need to prevent the compiler from optimizing out similar operations, // which may have different meaning for the offline debugging function unoptimized(val) -> ret { @@ -3623,6 +3641,221 @@ object "Bootloader" { let offset := add(VM_HOOK_PARAMS_OFFSET(), mul(32, paramId)) mstore(offset, unoptimized(value)) } + + /// @dev Log key used by Executor.sol for processing. See Constants.sol::SystemLogKey enum + function chainedPriorityTxnHashLogKey() -> ret { + ret := 5 + } + + /// @dev Log key used by Executor.sol for processing. See Constants.sol::SystemLogKey enum + function numberOfLayer1TxsLogKey() -> ret { + ret := 6 + } + + /// @dev Log key used by Executor.sol for processing. See Constants.sol::SystemLogKey enum + function protocolUpgradeTxHashKey() -> ret { + ret := 7 + } + + //////////////////////////////////////////////////////////////////////////// + // Main Transaction Processing + //////////////////////////////////////////////////////////////////////////// + + /// @notice the address that will be the beneficiary of all the fees + let OPERATOR_ADDRESS := mload(0) + + let GAS_PRICE_PER_PUBDATA := 0 + + // Initializing block params + { + /// @notice The hash of the previous batch + let PREV_BATCH_HASH := mload(32) + /// @notice The timestamp of the batch being processed + let NEW_BATCH_TIMESTAMP := mload(64) + /// @notice The number of the new batch being processed. + /// While this number is deterministic for each batch, we + /// still provide it here to ensure consistency between the state + /// of the VM and the state of the operator. + let NEW_BATCH_NUMBER := mload(96) + + /// @notice The gas price on L1 for ETH. In the future, a trustless value will be enforced. + /// For now, this value is trusted to be fairly provided by the operator. + let L1_GAS_PRICE := mload(128) + + /// @notice The minimal gas price that the operator agrees upon. + /// In the future, it will have an EIP1559-like lower bound. + let FAIR_L2_GAS_PRICE := mload(160) + + /// @notice The expected base fee by the operator. + /// Just like the batch number, while calculated on the bootloader side, + /// the operator still provides it to make sure that its data is in sync. + let EXPECTED_BASE_FEE := mload(192) + + validateOperatorProvidedPrices(L1_GAS_PRICE, FAIR_L2_GAS_PRICE) + + let baseFee := 0 + + + + // Only for the proved batch we enforce that the baseFee proposed + // by the operator is equal to the expected one. For the playground batch, we allow + // the operator to provide any baseFee the operator wants. + baseFee, GAS_PRICE_PER_PUBDATA := getBaseFee(L1_GAS_PRICE, FAIR_L2_GAS_PRICE) + if iszero(eq(baseFee, EXPECTED_BASE_FEE)) { + debugLog("baseFee", baseFee) + debugLog("EXPECTED_BASE_FEE", EXPECTED_BASE_FEE) + assertionError("baseFee inconsistent") + } + + setNewBatch(PREV_BATCH_HASH, NEW_BATCH_TIMESTAMP, NEW_BATCH_NUMBER, EXPECTED_BASE_FEE) + + + + + + baseFee, GAS_PRICE_PER_PUBDATA := getBaseFee(L1_GAS_PRICE, FAIR_L2_GAS_PRICE) + + let SHOULD_SET_NEW_BATCH := mload(224) + + switch SHOULD_SET_NEW_BATCH + case 0 { + unsafeOverrideBatch(NEW_BATCH_TIMESTAMP, NEW_BATCH_NUMBER, EXPECTED_BASE_FEE) + } + default { + setNewBatch(PREV_BATCH_HASH, NEW_BATCH_TIMESTAMP, NEW_BATCH_NUMBER, EXPECTED_BASE_FEE) + } + + + } + + // Now, we iterate over all transactions, processing each of them + // one by one. + // Here, the `resultPtr` is the pointer to the memory slot, where we will write + // `true` or `false` based on whether the tx execution was successful, + + // The position at which the tx offset of the transaction should be placed + let currentExpectedTxOffset := add(TXS_IN_BATCH_LAST_PTR(), mul(MAX_POSTOP_SLOTS(), 32)) + + let txPtr := TX_DESCRIPTION_BEGIN_BYTE() + + // At the COMPRESSED_BYTECODES_BEGIN_BYTE() the pointer to the newest bytecode to be published + // is stored. + mstore(COMPRESSED_BYTECODES_BEGIN_BYTE(), add(COMPRESSED_BYTECODES_BEGIN_BYTE(), 32)) + + // At start storing keccak256("") as `chainedPriorityTxsHash` and 0 as `numberOfLayer1Txs` + mstore(PRIORITY_TXS_L1_DATA_BEGIN_BYTE(), EMPTY_STRING_KECCAK()) + mstore(add(PRIORITY_TXS_L1_DATA_BEGIN_BYTE(), 32), 0) + + // Iterating through transaction descriptions + let transactionIndex := 0 + for { + let resultPtr := RESULT_START_PTR() + } lt(txPtr, TXS_IN_BATCH_LAST_PTR()) { + txPtr := add(txPtr, TX_DESCRIPTION_SIZE()) + resultPtr := add(resultPtr, 32) + transactionIndex := add(transactionIndex, 1) + } { + let execute := mload(txPtr) + + debugLog("txPtr", txPtr) + debugLog("execute", execute) + + if iszero(execute) { + // We expect that all transactions that are executed + // are continuous in the array. + break + } + + let txDataOffset := mload(add(txPtr, 32)) + + // We strongly enforce the positions of transactions + if iszero(eq(currentExpectedTxOffset, txDataOffset)) { + debugLog("currentExpectedTxOffset", currentExpectedTxOffset) + debugLog("txDataOffset", txDataOffset) + + assertionError("Tx data offset is incorrect") + } + + currentExpectedTxOffset := validateAbiEncoding(txDataOffset) + + // Checking whether the last slot of the transaction's description + // does not go out of bounds. + if gt(sub(currentExpectedTxOffset, 32), LAST_FREE_SLOT()) { + debugLog("currentExpectedTxOffset", currentExpectedTxOffset) + debugLog("LAST_FREE_SLOT", LAST_FREE_SLOT()) + + assertionError("currentExpectedTxOffset too high") + } + + validateTypedTxStructure(add(txDataOffset, 32)) + + + { + debugLog("ethCall", 0) + processTx(txDataOffset, resultPtr, transactionIndex, 0, GAS_PRICE_PER_PUBDATA) + } + + + { + let txMeta := mload(txPtr) + let processFlags := getWordByte(txMeta, 31) + debugLog("flags", processFlags) + + + // `processFlags` argument denotes which parts of execution should be done: + // Possible values: + // 0x00: validate & execute (normal mode) + // 0x02: perform ethCall (i.e. use mimicCall to simulate the call) + + let isETHCall := eq(processFlags, 0x02) + debugLog("ethCall", isETHCall) + processTx(txDataOffset, resultPtr, transactionIndex, isETHCall, GAS_PRICE_PER_PUBDATA) + } + + // Signal to the vm that the transaction execution is complete + setHook(VM_HOOK_TX_HAS_ENDED()) + // Increment tx index within the system. + considerNewTx() + } + + // The bootloader doesn't have to pay anything + setPricePerPubdataByte(0) + + // Resetting tx.origin and gasPrice to 0, so we don't pay for + // publishing them on-chain. + setTxOrigin(0) + setGasPrice(0) + + // Transfering all the ETH received in the block to the operator + directETHTransfer( + selfbalance(), + OPERATOR_ADDRESS + ) + + // Hook that notifies that the operator should provide final information for the batch + setHook(VM_HOOK_FINAL_L2_STATE_INFO()) + + // Each batch typically ends with a special block which contains no transactions. + // So we need to have this method to reflect it in the system contracts too. + // + // The reason is that as of now our node requires that each storage write (event, etc) belongs to a particular + // L2 block. In case a batch is sealed by timeout (i.e. the resources of the batch have not been exhaused, but we need + // to seal it to assure timely finality), we need to process sending funds to the operator *after* the last + // non-empty L2 block has been already sealed. We can not override old L2 blocks, so we need to create a new empty "fictive" block for it. + // + // The other reason why we need to set this block is so that in case of empty batch (i.e. the one which has no transactions), + // the virtual block number as well as miniblock number are incremented. + setL2Block(transactionIndex) + + callSystemContext({{RIGHT_PADDED_RESET_TX_NUMBER_IN_BLOCK_SELECTOR}}) + + publishTimestampDataToL1() + + // Sending system logs (to be processed on L1) + sendToL1Native(true, chainedPriorityTxnHashLogKey(), mload(PRIORITY_TXS_L1_DATA_BEGIN_BYTE())) + sendToL1Native(true, numberOfLayer1TxsLogKey(), mload(add(PRIORITY_TXS_L1_DATA_BEGIN_BYTE(), 32))) + + l1MessengerPublishingCall() } } } diff --git a/bootloader/test_infra/Cargo.lock b/bootloader/test_infra/Cargo.lock new file mode 100644 index 00000000..c3d586f0 --- /dev/null +++ b/bootloader/test_infra/Cargo.lock @@ -0,0 +1,5418 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addchain" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2e69442aa5628ea6951fa33e24efe8313f4321a91bd729fc2f75bdfc858570" +dependencies = [ + "num-bigint 0.3.3", + "num-integer", + "num-traits", +] + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "aes" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" +dependencies = [ + "aes-soft", + "aesni", + "cipher", +] + +[[package]] +name = "aes-ctr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7729c3cde54d67063be556aeac75a81330d802f0259500ca40cb52967f975763" +dependencies = [ + "aes-soft", + "aesni", + "cipher", + "ctr", +] + +[[package]] +name = "aes-soft" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" +dependencies = [ + "cipher", + "opaque-debug", +] + +[[package]] +name = "aesni" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" +dependencies = [ + "cipher", + "opaque-debug", +] + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.10", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if 1.0.0", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" +dependencies = [ + "memchr", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" + +[[package]] +name = "arr_macro" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a105bfda48707cf19220129e78fca01e9639433ffaef4163546ed8fb04120a5" +dependencies = [ + "arr_macro_impl", + "proc-macro-hack", +] + +[[package]] +name = "arr_macro_impl" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0609c78bd572f4edc74310dfb63a01f5609d53fa8b4dd7c4d98aef3b3e8d72d1" +dependencies = [ + "proc-macro-hack", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "arrayref" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" + +[[package]] +name = "arrayvec" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd9fd44efafa8690358b7408d253adf110036b88f55672a933f01d616ad9b1b9" +dependencies = [ + "nodrop", +] + +[[package]] +name = "arrayvec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + +[[package]] +name = "async-trait" +version = "0.1.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.31", +] + +[[package]] +name = "atoi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616896e05fc0e2649463a93a15183c6a16bf03413a7af88ef1285ddedfa9cda5" +dependencies = [ + "num-traits", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + +[[package]] +name = "autocfg" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" +dependencies = [ + "autocfg 1.1.0", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if 1.0.0", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base16ct" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bellman_ce" +version = "0.3.2" +source = "git+https://github.com/matter-labs/bellman?branch=dev#bbac0559fdc440b2331eca1c347a30559a3dd969" +dependencies = [ + "arrayvec 0.7.4", + "bit-vec", + "blake2s_const", + "blake2s_simd", + "byteorder", + "cfg-if 1.0.0", + "crossbeam 0.7.3", + "futures", + "hex", + "lazy_static", + "num_cpus", + "pairing_ce", + "rand 0.4.6", + "serde", + "smallvec", + "tiny-keccak 1.5.0", +] + +[[package]] +name = "bigdecimal" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1e50562e37200edf7c6c43e54a08e64a5553bfb59d9c297d5572512aa517256" +dependencies = [ + "num-bigint 0.3.3", + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bindgen" +version = "0.65.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfdf7b466f9a4903edc73f95d6d2bcd5baf8ae620638762244d3f60143643cc5" +dependencies = [ + "bitflags 1.3.2", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "peeking_take_while", + "prettyplease", + "proc-macro2 1.0.66", + "quote 1.0.33", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.31", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" + +[[package]] +name = "bitvec" +version = "0.20.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848" +dependencies = [ + "funty 1.1.0", + "radium 0.6.2", + "tap", + "wyz 0.2.0", +] + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty 2.0.0", + "radium 0.7.0", + "tap", + "wyz 0.5.1", +] + +[[package]] +name = "blake2" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a4e37d16930f5459780f5621038b6382b9bb37c19016f39fb6b5808d831f174" +dependencies = [ + "crypto-mac 0.8.0", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "blake2-rfc_bellman_edition" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc60350286c7c3db13b98e91dbe5c8b6830a6821bc20af5b0c310ce94d74915" +dependencies = [ + "arrayvec 0.4.12", + "byteorder", + "constant_time_eq", +] + +[[package]] +name = "blake2s_const" +version = "0.6.0" +source = "git+https://github.com/matter-labs/bellman?branch=dev#bbac0559fdc440b2331eca1c347a30559a3dd969" +dependencies = [ + "arrayref", + "arrayvec 0.5.2", + "constant_time_eq", +] + +[[package]] +name = "blake2s_simd" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e461a7034e85b211a4acb57ee2e6730b32912b06c08cc242243c39fc21ae6a2" +dependencies = [ + "arrayref", + "arrayvec 0.5.2", + "constant_time_eq", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "block-padding", + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-modes" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" +dependencies = [ + "block-padding", + "cipher", +] + +[[package]] +name = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + +[[package]] +name = "bumpalo" +version = "3.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "bytecount" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "camino" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4acbb09d9ee8e23699b9634375c72795d095bf268439da88562cf9b501f181fa" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", +] + +[[package]] +name = "cc" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "jobserver", + "libc", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd4e7873dbddba6c7c91e199c7fcb946abc4a6a4ac3195400bcfb01b5de877" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-targets", +] + +[[package]] +name = "cipher" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +dependencies = [ + "generic-array", +] + +[[package]] +name = "circuit_testing" +version = "0.1.0" +source = "git+https://github.com/matter-labs/era-circuit_testing.git?branch=main#164c0adac85be39ee44bd9456b2b91cdede5af80" +dependencies = [ + "bellman_ce", +] + +[[package]] +name = "clang-sys" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "clap" +version = "2.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +dependencies = [ + "ansi_term", + "atty", + "bitflags 1.3.2", + "strsim 0.8.0", + "textwrap", + "unicode-width", + "vec_map", +] + +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "codegen" +version = "0.1.0" +source = "git+https://github.com/matter-labs/solidity_plonk_verifier.git?branch=dev#07954802c13fb087efb5874c2ce521f843d614fd" +dependencies = [ + "ethereum-types 0.14.1", + "franklin-crypto", + "handlebars", + "hex", + "paste", + "rescue_poseidon", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "codegen" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff61280aed771c3070e7dcc9e050c66f1eb1e3b96431ba66f9f74641d02fc41d" +dependencies = [ + "indexmap 1.9.3", +] + +[[package]] +name = "colored" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" +dependencies = [ + "is-terminal", + "lazy_static", + "windows-sys", +] + +[[package]] +name = "const-oid" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + +[[package]] +name = "cpufeatures" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49fc9a695bca7f35f5f4c15cddc84415f66a74ea78eef08e90c5024f2b540e23" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccaeedb56da03b09f598226e25e80088cb4cd25f316e6e4df7d695f0feeb1403" + +[[package]] +name = "crossbeam" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69323bff1fb41c635347b8ead484a5ca6c3f11914d784170b158d8449ab07f8e" +dependencies = [ + "cfg-if 0.1.10", + "crossbeam-channel 0.4.4", + "crossbeam-deque 0.7.4", + "crossbeam-epoch 0.8.2", + "crossbeam-queue 0.2.3", + "crossbeam-utils 0.7.2", +] + +[[package]] +name = "crossbeam" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-channel 0.5.8", + "crossbeam-deque 0.8.3", + "crossbeam-epoch 0.9.15", + "crossbeam-queue 0.3.8", + "crossbeam-utils 0.8.16", +] + +[[package]] +name = "crossbeam-channel" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" +dependencies = [ + "crossbeam-utils 0.7.2", + "maybe-uninit", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils 0.8.16", +] + +[[package]] +name = "crossbeam-deque" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20ff29ded3204c5106278a81a38f4b482636ed4fa1e6cfbeef193291beb29ed" +dependencies = [ + "crossbeam-epoch 0.8.2", + "crossbeam-utils 0.7.2", + "maybe-uninit", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-epoch 0.9.15", + "crossbeam-utils 0.8.16", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" +dependencies = [ + "autocfg 1.1.0", + "cfg-if 0.1.10", + "crossbeam-utils 0.7.2", + "lazy_static", + "maybe-uninit", + "memoffset 0.5.6", + "scopeguard", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +dependencies = [ + "autocfg 1.1.0", + "cfg-if 1.0.0", + "crossbeam-utils 0.8.16", + "memoffset 0.9.0", + "scopeguard", +] + +[[package]] +name = "crossbeam-queue" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" +dependencies = [ + "cfg-if 0.1.10", + "crossbeam-utils 0.7.2", + "maybe-uninit", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils 0.8.16", +] + +[[package]] +name = "crossbeam-utils" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +dependencies = [ + "autocfg 1.1.0", + "cfg-if 0.1.10", + "lazy_static", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "crypto-mac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "cs_derive" +version = "0.1.0" +source = "git+https://github.com/matter-labs/era-sync_vm.git?branch=v1.3.3#e819d15b107a06a746299f98bbd9802e26eeb348" +dependencies = [ + "proc-macro-error", + "proc-macro2 1.0.66", + "quote 1.0.33", + "serde", + "syn 1.0.109", +] + +[[package]] +name = "ctr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" +dependencies = [ + "cipher", +] + +[[package]] +name = "darling" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2 1.0.66", + "quote 1.0.33", + "strsim 0.10.0", + "syn 1.0.109", +] + +[[package]] +name = "darling_macro" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" +dependencies = [ + "darling_core", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if 1.0.0", + "hashbrown 0.14.0", + "lock_api", + "once_cell", + "parking_lot_core 0.9.8", +] + +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "serde", + "uuid", +] + +[[package]] +name = "der" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "convert_case", + "proc-macro2 1.0.66", + "quote 1.0.33", + "rustc_version", + "syn 1.0.109", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "crypto-common", + "subtle", +] + +[[package]] +name = "dirs" +version = "4.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "dotenv" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" + +[[package]] +name = "dtoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" + +[[package]] +name = "ecdsa" +version = "0.14.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" +dependencies = [ + "der", + "elliptic-curve", + "rfc6979", + "signature", +] + +[[package]] +name = "either" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +dependencies = [ + "serde", +] + +[[package]] +name = "elliptic-curve" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" +dependencies = [ + "base16ct", + "crypto-bigint", + "der", + "digest 0.10.7", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "elsa" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714f766f3556b44e7e4776ad133fcc3445a489517c25c704ace411bb14790194" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "encoding_rs" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "env_logger" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "envy" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f47e0157f2cb54f5ae1bd371b30a2ae4311e1c028f575cd4e81de7353215965" +dependencies = [ + "serde", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "error-chain" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" +dependencies = [ + "version_check", +] + +[[package]] +name = "ethabi" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" +dependencies = [ + "ethereum-types 0.14.1", + "hex", + "once_cell", + "regex", + "serde", + "serde_json", + "sha3 0.10.6", + "thiserror", + "uint", +] + +[[package]] +name = "ethbloom" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfb684ac8fa8f6c5759f788862bb22ec6fe3cb392f6bfd08e3c64b603661e3f8" +dependencies = [ + "crunchy", + "fixed-hash 0.7.0", + "impl-rlp", + "impl-serde 0.3.2", + "tiny-keccak 2.0.2", +] + +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash 0.8.0", + "impl-rlp", + "impl-serde 0.4.0", + "tiny-keccak 2.0.2", +] + +[[package]] +name = "ethereum-types" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05136f7057fe789f06e6d41d07b34e6f70d8c86e5693b60f97aaa6553553bdaf" +dependencies = [ + "ethbloom 0.11.1", + "fixed-hash 0.7.0", + "impl-rlp", + "impl-serde 0.3.2", + "primitive-types 0.10.1", + "uint", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom 0.13.0", + "fixed-hash 0.8.0", + "impl-rlp", + "impl-serde 0.4.0", + "primitive-types 0.12.1", + "uint", +] + +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "fastrand" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" + +[[package]] +name = "ff" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "ff_ce" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b538e4231443a5b9c507caee3356f016d832cf7393d2d90f03ea3180d4e3fbc" +dependencies = [ + "byteorder", + "ff_derive_ce", + "hex", + "rand 0.4.6", + "serde", +] + +[[package]] +name = "ff_derive_ce" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b96fbccd88dbb1fac4ee4a07c2fcc4ca719a74ffbd9d2b9d41d8c8eb073d8b20" +dependencies = [ + "num-bigint 0.4.4", + "num-integer", + "num-traits", + "proc-macro2 1.0.66", + "quote 1.0.33", + "serde", + "syn 1.0.109", +] + +[[package]] +name = "findshlibs" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40b9e59cd0f7e0806cca4be089683ecb6434e602038df21fe6bf6711b2f07f64" +dependencies = [ + "cc", + "lazy_static", + "libc", + "winapi", +] + +[[package]] +name = "finl_unicode" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" + +[[package]] +name = "fixed-hash" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" +dependencies = [ + "byteorder", + "rand 0.8.5", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand 0.8.5", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "franklin-crypto" +version = "0.0.5" +source = "git+https://github.com/matter-labs/franklin-crypto?branch=dev#5922873d25ecec827cd60420ca8cd84a188bb965" +dependencies = [ + "arr_macro", + "bellman_ce", + "bit-vec", + "blake2 0.9.2", + "blake2-rfc_bellman_edition", + "blake2s_simd", + "byteorder", + "digest 0.9.0", + "hex", + "indexmap 1.9.3", + "itertools", + "lazy_static", + "num-bigint 0.4.4", + "num-derive 0.2.5", + "num-integer", + "num-traits", + "rand 0.4.6", + "serde", + "sha2 0.9.9", + "sha3 0.9.1", + "smallvec", + "splitmut", + "tiny-keccak 1.5.0", +] + +[[package]] +name = "fuchsia-cprng" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" + +[[package]] +name = "funty" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-executor" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", + "num_cpus", +] + +[[package]] +name = "futures-intrusive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a604f7a68fbf8103337523b1fadc8ade7361ee3f112f7c680ad179651616aed5" +dependencies = [ + "futures-core", + "lock_api", + "parking_lot 0.11.2", +] + +[[package]] +name = "futures-io" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + +[[package]] +name = "futures-macro" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.31", +] + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-timer" +version = "3.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "gimli" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "group" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "h2" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 1.9.3", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "handlebars" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39b3bc2a8f715298032cf5087e58573809374b08160aa7d750582bdb82d2683" +dependencies = [ + "log", + "pest", + "pest_derive", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash 0.7.6", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + +[[package]] +name = "hashlink" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf" +dependencies = [ + "hashbrown 0.11.2", +] + +[[package]] +name = "headers" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" +dependencies = [ + "base64 0.21.3", + "bytes", + "headers-core", + "http", + "httpdate", + "mime", + "sha1", +] + +[[package]] +name = "headers-core" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" +dependencies = [ + "http", +] + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hkdf" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +dependencies = [ + "hmac 0.12.1", +] + +[[package]] +name = "hmac" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" +dependencies = [ + "crypto-mac 0.10.1", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi", +] + +[[package]] +name = "http" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + +[[package]] +name = "hyper" +version = "0.14.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2 0.4.9", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +dependencies = [ + "futures-util", + "http", + "hyper", + "rustls", + "tokio", + "tokio-rustls", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "impl-codec" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "161ebdfec3c8e3b52bf61c4f3550a1eea4f9579d10dc1b936f3171ebdcd6c443" +dependencies = [ + "parity-scale-codec 2.3.1", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec 3.6.5", +] + +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg 1.1.0", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "ipnet" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" + +[[package]] +name = "ipnetwork" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02c3eaab3ac0ede60ffa41add21970a7df7d91772c03383aac6c2c3d53cc716b" + +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi 0.3.2", + "rustix", + "windows-sys", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" + +[[package]] +name = "jobserver" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "jsonrpc-core" +version = "18.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14f7f76aef2d054868398427f6c54943cf3d1caa9a7ec7d0c38d69df97a965eb" +dependencies = [ + "futures", + "futures-executor", + "futures-util", + "log", + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "k256" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" +dependencies = [ + "cfg-if 1.0.0", + "ecdsa", + "elliptic-curve", + "sha2 0.10.6", +] + +[[package]] +name = "keccak" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + +[[package]] +name = "libc" +version = "0.2.147" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" + +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if 1.0.0", + "winapi", +] + +[[package]] +name = "librocksdb-sys" +version = "0.11.0+8.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3386f101bcb4bd252d8e9d2fb41ec3b0862a15a62b478c355b2982efa469e3e" +dependencies = [ + "bindgen", + "bzip2-sys", + "cc", + "glob", + "libc", + "libz-sys", +] + +[[package]] +name = "libz-sys" +version = "1.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linkme" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f948366ad5bb46b5514ba7a7a80643726eef08b06632592699676748c8bc33b" +dependencies = [ + "linkme-impl", +] + +[[package]] +name = "linkme-impl" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc28438cad73dcc90ff3466fc329a9252b1b8ba668eb0d5668ba97088cf4eef0" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.31", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" + +[[package]] +name = "lock_api" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +dependencies = [ + "autocfg 1.1.0", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" + +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" + +[[package]] +name = "md-5" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "memchr" +version = "2.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" + +[[package]] +name = "memoffset" +version = "0.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" +dependencies = [ + "autocfg 1.1.0", +] + +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg 1.1.0", +] + +[[package]] +name = "metrics" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fde3af1a009ed76a778cb84fdef9e7dbbdf5775ae3e4cc1f434a6a307f6f76c5" +dependencies = [ + "ahash 0.8.3", + "metrics-macros", + "portable-atomic", +] + +[[package]] +name = "metrics-macros" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddece26afd34c31585c74a4db0630c376df271c285d682d1e55012197830b6df" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.31", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mini-moka" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23e0b72e7c9042467008b10279fc732326bd605459ae03bda88825909dd19b56" +dependencies = [ + "crossbeam-channel 0.5.8", + "crossbeam-utils 0.8.16", + "dashmap", + "skeptic", + "smallvec", + "tagptr", + "triomphe", +] + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +dependencies = [ + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys", +] + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "nodrop" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b7a8e9be5e039e2ff869df49155f1c06bd01ade2117ec783e56ab0932b67a8f" +dependencies = [ + "num-bigint 0.3.3", + "num-complex 0.3.1", + "num-integer", + "num-iter", + "num-rational 0.3.2", + "num-traits", +] + +[[package]] +name = "num" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +dependencies = [ + "num-bigint 0.4.4", + "num-complex 0.4.4", + "num-integer", + "num-iter", + "num-rational 0.4.1", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" +dependencies = [ + "autocfg 1.1.0", + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg 1.1.0", + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "num-complex" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5" +dependencies = [ + "num-traits", + "serde", +] + +[[package]] +name = "num-complex" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-derive" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eafd0b45c5537c3ba526f79d3e75120036502bebacbb3f3220914067ce39dbf2" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "syn 0.15.44", +] + +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg 1.1.0", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg 1.1.0", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" +dependencies = [ + "autocfg 1.1.0", + "num-bigint 0.3.3", + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg 1.1.0", + "num-bigint 0.4.4", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +dependencies = [ + "autocfg 1.1.0", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi 0.3.2", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" +dependencies = [ + "proc-macro-crate", + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.31", +] + +[[package]] +name = "object" +version = "0.32.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "openssl" +version = "0.10.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +dependencies = [ + "bitflags 2.4.0", + "cfg-if 1.0.0", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.31", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.93" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "os_info" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "006e42d5b888366f1880eda20371fedde764ed2213dc8496f49622fa0c99cd5e" +dependencies = [ + "log", + "serde", + "winapi", +] + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "pairing_ce" +version = "0.28.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db007b21259660d025918e653508f03050bf23fb96a88601f9936329faadc597" +dependencies = [ + "byteorder", + "cfg-if 1.0.0", + "ff_ce", + "rand 0.4.6", + "serde", +] + +[[package]] +name = "parity-crypto" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b92ea9ddac0d6e1db7c49991e7d397d34a9fd814b4c93cda53788e8eef94e35" +dependencies = [ + "aes", + "aes-ctr", + "block-modes", + "digest 0.9.0", + "ethereum-types 0.12.1", + "hmac 0.10.1", + "lazy_static", + "pbkdf2 0.7.5", + "ripemd160", + "rustc-hex", + "scrypt", + "secp256k1 0.20.3", + "sha2 0.9.9", + "subtle", + "tiny-keccak 2.0.2", + "zeroize", +] + +[[package]] +name = "parity-scale-codec" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "373b1a4c1338d9cd3d1fa53b3a11bdab5ab6bd80a20f7f7becd76953ae2be909" +dependencies = [ + "arrayvec 0.7.4", + "bitvec 0.20.4", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive 2.3.1", + "serde", +] + +[[package]] +name = "parity-scale-codec" +version = "3.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dec8a8073036902368c2cdc0387e85ff9a37054d7e7c98e592145e0c92cd4fb" +dependencies = [ + "arrayvec 0.7.4", + "bitvec 1.0.1", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive 3.6.5", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1557010476e0595c9b568d16dcfb81b93cdeb157612726f5170d31aa707bed27" +dependencies = [ + "proc-macro-crate", + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "312270ee71e1cd70289dacf597cab7b207aa107d2f28191c2ae45b2ece18a260" +dependencies = [ + "proc-macro-crate", + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.6", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.8", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if 1.0.0", + "instant", + "libc", + "redox_syscall 0.2.16", + "smallvec", + "winapi", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall 0.3.5", + "smallvec", + "windows-targets", +] + +[[package]] +name = "password-hash" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54986aa4bfc9b98c6a5f40184223658d187159d7b3c6af33f2b2aa25ae1db0fa" +dependencies = [ + "base64ct", + "rand_core 0.6.4", +] + +[[package]] +name = "paste" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" + +[[package]] +name = "pbkdf2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3b8c0d71734018084da0c0354193a5edfb81b20d2d57a92c5b154aefc554a4a" +dependencies = [ + "crypto-mac 0.10.1", +] + +[[package]] +name = "pbkdf2" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf916dd32dd26297907890d99dc2740e33f6bd9073965af4ccff2967962f5508" +dependencies = [ + "base64ct", + "crypto-mac 0.10.1", + "hmac 0.10.1", + "password-hash", + "sha2 0.9.9", +] + +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + +[[package]] +name = "percent-encoding" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" + +[[package]] +name = "pest" +version = "2.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7a4d085fd991ac8d5b05a147b437791b4260b76326baf0fc60cf7c9c27ecd33" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2bee7be22ce7918f641a33f08e3f43388c7656772244e2bbb2477f44cc9021a" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1511785c5e98d79a05e8a6bc34b4ac2168a0e3e92161862030ad84daa223141" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.31", +] + +[[package]] +name = "pest_meta" +version = "2.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42f0394d3123e33353ca5e1e89092e533d2cc490389f2bd6131c43c634ebc5f" +dependencies = [ + "once_cell", + "pest", + "sha2 0.10.6", +] + +[[package]] +name = "pin-project" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.31", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" + +[[package]] +name = "portable-atomic" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31114a898e107c51bb1609ffaf55a0e011cf6a4d7f1170d0015a165082c0338b" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" + +[[package]] +name = "prettyplease" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +dependencies = [ + "proc-macro2 1.0.66", + "syn 2.0.31", +] + +[[package]] +name = "primitive-types" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05e4722c697a58a99d5d06a08c30821d7c082a4632198de1eaa5a6c22ef42373" +dependencies = [ + "fixed-hash 0.7.0", + "impl-codec 0.5.1", + "impl-rlp", + "impl-serde 0.3.2", + "uint", +] + +[[package]] +name = "primitive-types" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" +dependencies = [ + "fixed-hash 0.8.0", + "impl-codec 0.6.0", + "impl-rlp", + "impl-serde 0.4.0", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "version_check", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.20+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" + +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "proc-macro2" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prometheus-client" +version = "0.21.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c99afa9a01501019ac3a14d71d9f94050346f55ca471ce90c799a15c58f61e2" +dependencies = [ + "dtoa", + "itoa", + "parking_lot 0.12.1", + "prometheus-client-derive-encode", +] + +[[package]] +name = "prometheus-client-derive-encode" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.31", +] + +[[package]] +name = "pulldown-cmark" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998" +dependencies = [ + "bitflags 1.3.2", + "memchr", + "unicase", +] + +[[package]] +name = "quote" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +dependencies = [ + "proc-macro2 0.4.30", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2 1.0.66", +] + +[[package]] +name = "radium" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" +dependencies = [ + "fuchsia-cprng", + "libc", + "rand_core 0.3.1", + "rdrand", + "winapi", +] + +[[package]] +name = "rand" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca" +dependencies = [ + "autocfg 0.1.8", + "libc", + "rand_chacha 0.1.1", + "rand_core 0.4.2", + "rand_hc 0.1.0", + "rand_isaac", + "rand_jitter", + "rand_os", + "rand_pcg", + "rand_xorshift", + "winapi", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc 0.2.0", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "556d3a1ca6600bfcbab7c7c91ccb085ac7fbbcd70e008a98742e7847f4f7bcef" +dependencies = [ + "autocfg 0.1.8", + "rand_core 0.3.1", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" +dependencies = [ + "rand_core 0.4.2", +] + +[[package]] +name = "rand_core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.10", +] + +[[package]] +name = "rand_hc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_isaac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "rand_jitter" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" +dependencies = [ + "libc", + "rand_core 0.4.2", + "winapi", +] + +[[package]] +name = "rand_os" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" +dependencies = [ + "cloudabi", + "fuchsia-cprng", + "libc", + "rand_core 0.4.2", + "rdrand", + "winapi", +] + +[[package]] +name = "rand_pcg" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" +dependencies = [ + "autocfg 0.1.8", + "rand_core 0.4.2", +] + +[[package]] +name = "rand_xorshift" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "rayon" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +dependencies = [ + "crossbeam-channel 0.5.8", + "crossbeam-deque 0.8.3", + "crossbeam-utils 0.8.16", + "num_cpus", +] + +[[package]] +name = "rdrand" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" +dependencies = [ + "rand_core 0.3.1", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_users" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +dependencies = [ + "getrandom 0.2.10", + "redox_syscall 0.2.16", + "thiserror", +] + +[[package]] +name = "regex" +version = "1.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.3.8", + "regex-syntax 0.7.5", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.7.5", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" + +[[package]] +name = "reqwest" +version = "0.11.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" +dependencies = [ + "base64 0.21.3", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-rustls", + "hyper-tls", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tokio-rustls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "winreg", +] + +[[package]] +name = "rescue_poseidon" +version = "0.4.1" +source = "git+https://github.com/matter-labs/rescue-poseidon#f611a3353e48cf42153e44d89ed90da9bc5934e8" +dependencies = [ + "addchain", + "arrayvec 0.7.4", + "blake2 0.10.6", + "byteorder", + "franklin-crypto", + "num-bigint 0.3.3", + "num-integer", + "num-iter", + "num-traits", + "rand 0.4.6", + "serde", + "sha3 0.9.1", + "smallvec", +] + +[[package]] +name = "rfc6979" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" +dependencies = [ + "crypto-bigint", + "hmac 0.12.1", + "zeroize", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "ripemd160" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eca4ecc81b7f313189bf73ce724400a07da2a6dac19588b03c8bd76a2dcc251" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rustc-hex", +] + +[[package]] +name = "rocksdb" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb6f170a4041d50a0ce04b0d2e14916d6ca863ea2e422689a5b694395d299ffe" +dependencies = [ + "libc", + "librocksdb-sys", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "0.38.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0c3dde1fc030af041adc40e79c0e7fbcf431dd24870053d187d7c66e4b87453" +dependencies = [ + "bitflags 2.4.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "rustls" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +dependencies = [ + "log", + "ring", + "rustls-webpki", + "sct", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +dependencies = [ + "base64 0.21.3", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + +[[package]] +name = "salsa20" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "399f290ffc409596022fce5ea5d4138184be4784f2b28c62c59f0d8389059a15" +dependencies = [ + "cipher", +] + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "scrypt" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da492dab03f925d977776a0b7233d7b934d6dc2b94faead48928e2e9bacedb9" +dependencies = [ + "base64 0.13.1", + "hmac 0.10.1", + "pbkdf2 0.6.0", + "rand 0.7.3", + "rand_core 0.5.1", + "salsa20", + "sha2 0.9.9", + "subtle", +] + +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "sec1" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "secp256k1" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d03ceae636d0fed5bae6a7f4f664354c5f4fcedf6eef053fef17e49f837d0a" +dependencies = [ + "rand 0.6.5", + "secp256k1-sys 0.4.2", +] + +[[package]] +name = "secp256k1" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" +dependencies = [ + "secp256k1-sys 0.8.1", +] + +[[package]] +name = "secp256k1-sys" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957da2573cde917463ece3570eab4a0b3f19de6f1646cde62e6fd3868f566036" +dependencies = [ + "cc", +] + +[[package]] +name = "secp256k1-sys" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e" +dependencies = [ + "cc", +] + +[[package]] +name = "security-framework" +version = "2.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +dependencies = [ + "serde", +] + +[[package]] +name = "sentry" +version = "0.31.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e95efd0cefa32028cdb9766c96de71d96671072f9fb494dc9fb84c0ef93e52b" +dependencies = [ + "httpdate", + "native-tls", + "reqwest", + "sentry-backtrace", + "sentry-contexts", + "sentry-core", + "sentry-debug-images", + "sentry-panic", + "sentry-tracing", + "tokio", + "ureq", +] + +[[package]] +name = "sentry-backtrace" +version = "0.31.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ac2bac6f310c4c4c4bb094d1541d32ae497f8c5c23405e85492cefdfe0971a9" +dependencies = [ + "backtrace", + "once_cell", + "regex", + "sentry-core", +] + +[[package]] +name = "sentry-contexts" +version = "0.31.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c3e17295cecdbacf66c5bd38d6e1147e09e1e9d824d2d5341f76638eda02a3a" +dependencies = [ + "hostname", + "libc", + "os_info", + "rustc_version", + "sentry-core", + "uname", +] + +[[package]] +name = "sentry-core" +version = "0.31.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8339474f587f36cb110fa1ed1b64229eea6d47b0b886375579297b7e47aeb055" +dependencies = [ + "once_cell", + "rand 0.8.5", + "sentry-types", + "serde", + "serde_json", +] + +[[package]] +name = "sentry-debug-images" +version = "0.31.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c11e7d2b809b06497a18a2e60f513206462ae2db27081dfb7be9ade1f329cc8" +dependencies = [ + "findshlibs", + "once_cell", + "sentry-core", +] + +[[package]] +name = "sentry-panic" +version = "0.31.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "875b69f506da75bd664029eafb05f8934297d2990192896d17325f066bd665b7" +dependencies = [ + "sentry-backtrace", + "sentry-core", +] + +[[package]] +name = "sentry-tracing" +version = "0.31.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89feead9bdd116f8035e89567651340fc382db29240b6c55ef412078b08d1aa3" +dependencies = [ + "sentry-backtrace", + "sentry-core", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "sentry-types" +version = "0.31.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99dc599bd6646884fc403d593cdcb9816dd67c50cff3271c01ff123617908dcd" +dependencies = [ + "debugid", + "getrandom 0.2.10", + "hex", + "serde", + "serde_json", + "thiserror", + "time", + "url", + "uuid", +] + +[[package]] +name = "serde" +version = "1.0.188" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.188" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.31", +] + +[[package]] +name = "serde_json" +version = "1.0.105" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" +dependencies = [ + "base64 0.13.1", + "serde", + "serde_with_macros", +] + +[[package]] +name = "serde_with_macros" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" +dependencies = [ + "darling", + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "sha-1" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha1" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha3" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81199417d4e5de3f04b1e871023acea7389672c4135918f05aa9cbf2f2fa809" +dependencies = [ + "block-buffer 0.9.0", + "digest 0.9.0", + "keccak", + "opaque-debug", +] + +[[package]] +name = "sha3" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" +dependencies = [ + "digest 0.10.7", + "keccak", +] + +[[package]] +name = "sharded-slab" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + +[[package]] +name = "signature" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +dependencies = [ + "digest 0.10.7", + "rand_core 0.6.4", +] + +[[package]] +name = "skeptic" +version = "0.13.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d23b015676c90a0f01c197bfdc786c20342c73a0afdda9025adb0bc42940a8" +dependencies = [ + "bytecount", + "cargo_metadata", + "error-chain", + "glob", + "pulldown-cmark", + "tempfile", + "walkdir", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg 1.1.0", +] + +[[package]] +name = "smallvec" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" + +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "socket2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "splitmut" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c85070f382340e8b23a75808e83573ddf65f9ad9143df9573ca37c1ed2ee956a" + +[[package]] +name = "sqlformat" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4b7922be017ee70900be125523f38bdd644f4f06a1b16e8fa5a8ee8c34bffd4" +dependencies = [ + "itertools", + "nom", + "unicode_categories", +] + +[[package]] +name = "sqlx" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "551873805652ba0d912fec5bbb0f8b4cdd96baf8e2ebf5970e5671092966019b" +dependencies = [ + "sqlx-core", + "sqlx-macros", +] + +[[package]] +name = "sqlx-core" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48c61941ccf5ddcada342cd59e3e5173b007c509e1e8e990dafc830294d9dc5" +dependencies = [ + "ahash 0.7.6", + "atoi", + "base64 0.13.1", + "bigdecimal", + "bitflags 1.3.2", + "byteorder", + "bytes", + "chrono", + "crc", + "crossbeam-queue 0.3.8", + "dirs", + "either", + "event-listener", + "futures-channel", + "futures-core", + "futures-intrusive", + "futures-util", + "hashlink", + "hex", + "hkdf", + "hmac 0.12.1", + "indexmap 1.9.3", + "ipnetwork", + "itoa", + "libc", + "log", + "md-5", + "memchr", + "num-bigint 0.3.3", + "once_cell", + "paste", + "percent-encoding", + "rand 0.8.5", + "serde", + "serde_json", + "sha-1", + "sha2 0.10.6", + "smallvec", + "sqlformat", + "sqlx-rt", + "stringprep", + "thiserror", + "tokio-stream", + "url", + "whoami", +] + +[[package]] +name = "sqlx-macros" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc0fba2b0cae21fc00fe6046f8baa4c7fcb49e379f0f592b04696607f69ed2e1" +dependencies = [ + "dotenv", + "either", + "heck 0.4.1", + "hex", + "once_cell", + "proc-macro2 1.0.66", + "quote 1.0.33", + "serde", + "serde_json", + "sha2 0.10.6", + "sqlx-core", + "sqlx-rt", + "syn 1.0.109", + "url", +] + +[[package]] +name = "sqlx-rt" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4db708cd3e459078f85f39f96a00960bd841f66ee2a669e90bf36907f5a79aae" +dependencies = [ + "native-tls", + "once_cell", + "tokio", + "tokio-native-tls", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "stringprep" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" +dependencies = [ + "finl_unicode", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "structopt" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" +dependencies = [ + "clap", + "lazy_static", + "structopt-derive", +] + +[[package]] +name = "structopt-derive" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" +dependencies = [ + "heck 0.3.3", + "proc-macro-error", + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "strum" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.24.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +dependencies = [ + "heck 0.4.1", + "proc-macro2 1.0.66", + "quote 1.0.33", + "rustversion", + "syn 1.0.109", +] + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "syn" +version = "0.15.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "unicode-xid", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "unicode-ident", +] + +[[package]] +name = "sync_vm" +version = "1.3.3" +source = "git+https://github.com/matter-labs/era-sync_vm.git?branch=v1.3.3#e819d15b107a06a746299f98bbd9802e26eeb348" +dependencies = [ + "arrayvec 0.7.4", + "cs_derive", + "derivative", + "franklin-crypto", + "hex", + "itertools", + "num-bigint 0.4.4", + "num-derive 0.3.3", + "num-integer", + "num-traits", + "once_cell", + "rand 0.4.6", + "rescue_poseidon", + "serde", + "sha2 0.10.6", + "sha3 0.10.6", + "smallvec", + "zk_evm", + "zkevm_opcode_defs", +] + +[[package]] +name = "tagptr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +dependencies = [ + "cfg-if 1.0.0", + "fastrand", + "redox_syscall 0.3.5", + "rustix", + "windows-sys", +] + +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "test-log" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9601d162c1d77e62c1ea0bc8116cd1caf143ce3af947536c3c9052a1677fe0c" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 1.0.109", +] + +[[package]] +name = "test_infra" +version = "0.1.0" +dependencies = [ + "colored", + "hex", + "once_cell", + "serde", + "serde_json", + "tracing", + "tracing-subscriber", + "vlog", + "vm", + "zksync_contracts", + "zksync_state", + "zksync_types", + "zksync_utils", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "thiserror" +version = "1.0.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.48" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.31", +] + +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if 1.0.0", + "once_cell", +] + +[[package]] +name = "time" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" +dependencies = [ + "deranged", + "itoa", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" + +[[package]] +name = "time-macros" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" +dependencies = [ + "time-core", +] + +[[package]] +name = "tiny-keccak" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d8a021c69bb74a44ccedb824a046447e2c84a01df9e5c20779750acb38e11b2" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "num_cpus", + "parking_lot 0.12.1", + "pin-project-lite", + "signal-hook-registry", + "socket2 0.5.3", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.31", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.0.0", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if 1.0.0", + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.31", +] + +[[package]] +name = "tracing-core" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "time", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", +] + +[[package]] +name = "triomphe" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee8098afad3fb0c54a9007aab6804558410503ad676d4633f9c2559a00ac0f" + +[[package]] +name = "try-lock" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" + +[[package]] +name = "typenum" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" + +[[package]] +name = "ucd-trie" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "uname" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b72f89f0ca32e4db1c04e2a72f5345d59796d4866a1ee0609084569f73683dc8" +dependencies = [ + "libc", +] + +[[package]] +name = "unicase" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + +[[package]] +name = "unicode-ident" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" + +[[package]] +name = "unicode_categories" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "ureq" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b11c96ac7ee530603dcdf68ed1557050f374ce55a5a07193ebf8cbc9f8927e9" +dependencies = [ + "base64 0.21.3", + "log", + "native-tls", + "once_cell", + "url", +] + +[[package]] +name = "url" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "uuid" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +dependencies = [ + "getrandom 0.2.10", + "serde", +] + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "vise" +version = "0.1.0" +source = "git+https://github.com/matter-labs/vise.git?rev=9d097ab747b037b6e62504df1db5b975425b6bdd#9d097ab747b037b6e62504df1db5b975425b6bdd" +dependencies = [ + "elsa", + "linkme", + "once_cell", + "prometheus-client", + "vise-macros", +] + +[[package]] +name = "vise-macros" +version = "0.1.0" +source = "git+https://github.com/matter-labs/vise.git?rev=9d097ab747b037b6e62504df1db5b975425b6bdd#9d097ab747b037b6e62504df1db5b975425b6bdd" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.31", +] + +[[package]] +name = "vlog" +version = "0.1.0" +source = "git+https://github.com/matter-labs/zksync-era.git?branch=boojum-integration#d2ca29bf20b4ec2d9ec9e327b4ba6b281d9793de" +dependencies = [ + "chrono", + "sentry", + "serde_json", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "vm" +version = "0.1.0" +source = "git+https://github.com/matter-labs/zksync-era.git?branch=boojum-integration#d2ca29bf20b4ec2d9ec9e327b4ba6b281d9793de" +dependencies = [ + "anyhow", + "hex", + "itertools", + "once_cell", + "thiserror", + "tracing", + "vise", + "zk_evm", + "zksync_config", + "zksync_contracts", + "zksync_state", + "zksync_types", + "zksync_utils", +] + +[[package]] +name = "walkdir" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +dependencies = [ + "cfg-if 1.0.0", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.31", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +dependencies = [ + "cfg-if 1.0.0", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +dependencies = [ + "quote 1.0.33", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +dependencies = [ + "proc-macro2 1.0.66", + "quote 1.0.33", + "syn 2.0.31", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" + +[[package]] +name = "web-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web3" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5388522c899d1e1c96a4c307e3797e0f697ba7c77dd8e0e625ecba9dd0342937" +dependencies = [ + "arrayvec 0.7.4", + "base64 0.21.3", + "bytes", + "derive_more", + "ethabi", + "ethereum-types 0.14.1", + "futures", + "futures-timer", + "headers", + "hex", + "idna", + "jsonrpc-core", + "log", + "once_cell", + "parking_lot 0.12.1", + "pin-project", + "reqwest", + "rlp", + "secp256k1 0.27.0", + "serde", + "serde_json", + "tiny-keccak 2.0.2", + "url", +] + +[[package]] +name = "webpki-roots" +version = "0.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" + +[[package]] +name = "whoami" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "winnow" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if 1.0.0", + "windows-sys", +] + +[[package]] +name = "wyz" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85e60b0d1b5f99db2556934e21937020776a5d31520bf169e851ac44e6420214" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "zeroize" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" + +[[package]] +name = "zk_evm" +version = "1.3.3" +source = "git+https://github.com/matter-labs/era-zk_evm.git?branch=v1.3.3#fe8215a7047d24430ad470cf15a19bedb4d6ba0b" +dependencies = [ + "anyhow", + "lazy_static", + "num 0.4.1", + "serde", + "serde_json", + "static_assertions", + "zk_evm_abstractions", + "zkevm_opcode_defs", +] + +[[package]] +name = "zk_evm_abstractions" +version = "0.1.0" +source = "git+https://github.com/matter-labs/era-zk_evm_abstractions.git#7502a661d7d38906d849dcd3e7a15e5848af6581" +dependencies = [ + "anyhow", + "serde", + "static_assertions", + "zkevm_opcode_defs", +] + +[[package]] +name = "zkevm-assembly" +version = "1.3.2" +source = "git+https://github.com/matter-labs/era-zkEVM-assembly.git?branch=v1.3.2#3c61d450cbe6548068be8f313ed02f1bd229a865" +dependencies = [ + "env_logger", + "hex", + "lazy_static", + "log", + "nom", + "num-bigint 0.4.4", + "num-traits", + "sha3 0.10.6", + "smallvec", + "structopt", + "thiserror", + "zkevm_opcode_defs", +] + +[[package]] +name = "zkevm_opcode_defs" +version = "1.3.2" +source = "git+https://github.com/matter-labs/era-zkevm_opcode_defs.git?branch=v1.3.2#c7ab62f4c60b27dfc690c3ab3efb5fff1ded1a25" +dependencies = [ + "bitflags 2.4.0", + "blake2 0.10.6", + "ethereum-types 0.14.1", + "k256", + "lazy_static", + "sha2 0.10.6", + "sha3 0.10.6", +] + +[[package]] +name = "zkevm_test_harness" +version = "1.3.3" +source = "git+https://github.com/matter-labs/era-zkevm_test_harness.git?branch=v1.3.3#5fe3b73dba7c98e724358428ae10723c4758dfb5" +dependencies = [ + "bincode", + "circuit_testing", + "codegen 0.2.0", + "crossbeam 0.8.2", + "derivative", + "env_logger", + "hex", + "num-bigint 0.4.4", + "num-integer", + "num-traits", + "rayon", + "serde", + "serde_json", + "smallvec", + "structopt", + "sync_vm", + "test-log", + "tracing", + "zk_evm", + "zkevm-assembly", +] + +[[package]] +name = "zksync_basic_types" +version = "0.1.0" +source = "git+https://github.com/matter-labs/zksync-era.git?branch=boojum-integration#d2ca29bf20b4ec2d9ec9e327b4ba6b281d9793de" +dependencies = [ + "serde", + "serde_json", + "web3", +] + +[[package]] +name = "zksync_config" +version = "0.1.0" +source = "git+https://github.com/matter-labs/zksync-era.git?branch=boojum-integration#d2ca29bf20b4ec2d9ec9e327b4ba6b281d9793de" +dependencies = [ + "anyhow", + "bigdecimal", + "envy", + "hex", + "num 0.3.1", + "once_cell", + "serde", + "serde_json", + "url", + "zksync_basic_types", + "zksync_contracts", + "zksync_utils", +] + +[[package]] +name = "zksync_contracts" +version = "0.1.0" +source = "git+https://github.com/matter-labs/zksync-era.git?branch=boojum-integration#d2ca29bf20b4ec2d9ec9e327b4ba6b281d9793de" +dependencies = [ + "envy", + "ethabi", + "hex", + "once_cell", + "serde", + "serde_json", + "zksync_utils", +] + +[[package]] +name = "zksync_crypto" +version = "0.1.0" +source = "git+https://github.com/matter-labs/zksync-era.git?branch=boojum-integration#d2ca29bf20b4ec2d9ec9e327b4ba6b281d9793de" +dependencies = [ + "base64 0.13.1", + "blake2 0.10.6", + "hex", + "once_cell", + "serde", + "sha2 0.9.9", + "thiserror", + "zksync_basic_types", +] + +[[package]] +name = "zksync_dal" +version = "0.1.0" +source = "git+https://github.com/matter-labs/zksync-era.git?branch=boojum-integration#d2ca29bf20b4ec2d9ec9e327b4ba6b281d9793de" +dependencies = [ + "anyhow", + "bigdecimal", + "bincode", + "hex", + "itertools", + "num 0.3.1", + "once_cell", + "serde", + "serde_json", + "sqlx", + "strum", + "thiserror", + "tokio", + "tracing", + "vise", + "zksync_config", + "zksync_contracts", + "zksync_health_check", + "zksync_types", + "zksync_utils", +] + +[[package]] +name = "zksync_health_check" +version = "0.1.0" +source = "git+https://github.com/matter-labs/zksync-era.git?branch=boojum-integration#d2ca29bf20b4ec2d9ec9e327b4ba6b281d9793de" +dependencies = [ + "async-trait", + "futures", + "serde", + "serde_json", + "tokio", + "tracing", +] + +[[package]] +name = "zksync_mini_merkle_tree" +version = "0.1.0" +source = "git+https://github.com/matter-labs/zksync-era.git?branch=boojum-integration#d2ca29bf20b4ec2d9ec9e327b4ba6b281d9793de" +dependencies = [ + "once_cell", + "zksync_basic_types", + "zksync_crypto", +] + +[[package]] +name = "zksync_state" +version = "0.1.0" +source = "git+https://github.com/matter-labs/zksync-era.git?branch=boojum-integration#d2ca29bf20b4ec2d9ec9e327b4ba6b281d9793de" +dependencies = [ + "anyhow", + "metrics", + "mini-moka", + "tokio", + "tracing", + "vise", + "zksync_dal", + "zksync_storage", + "zksync_types", + "zksync_utils", +] + +[[package]] +name = "zksync_storage" +version = "0.1.0" +source = "git+https://github.com/matter-labs/zksync-era.git?branch=boojum-integration#d2ca29bf20b4ec2d9ec9e327b4ba6b281d9793de" +dependencies = [ + "num_cpus", + "once_cell", + "rocksdb", + "tracing", + "vise", +] + +[[package]] +name = "zksync_types" +version = "0.1.0" +source = "git+https://github.com/matter-labs/zksync-era.git?branch=boojum-integration#d2ca29bf20b4ec2d9ec9e327b4ba6b281d9793de" +dependencies = [ + "blake2 0.10.6", + "chrono", + "codegen 0.1.0", + "ethereum-types 0.12.1", + "num 0.3.1", + "num_enum", + "once_cell", + "parity-crypto", + "rlp", + "serde", + "serde_json", + "serde_with", + "strum", + "thiserror", + "zk_evm", + "zkevm_test_harness", + "zksync_basic_types", + "zksync_config", + "zksync_contracts", + "zksync_mini_merkle_tree", + "zksync_utils", +] + +[[package]] +name = "zksync_utils" +version = "0.1.0" +source = "git+https://github.com/matter-labs/zksync-era.git?branch=boojum-integration#d2ca29bf20b4ec2d9ec9e327b4ba6b281d9793de" +dependencies = [ + "anyhow", + "bigdecimal", + "futures", + "hex", + "itertools", + "metrics", + "num 0.3.1", + "reqwest", + "serde", + "thiserror", + "tokio", + "tracing", + "vlog", + "zk_evm", + "zksync_basic_types", +] diff --git a/bootloader/test_infra/Cargo.toml b/bootloader/test_infra/Cargo.toml new file mode 100644 index 00000000..e78bcf65 --- /dev/null +++ b/bootloader/test_infra/Cargo.toml @@ -0,0 +1,23 @@ +[package] +name = "test_infra" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] + +vm = { git = "https://github.com/matter-labs/zksync-era.git", branch = "boojum-integration" } +zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", branch = "boojum-integration" } +zksync_contracts = { git = "https://github.com/matter-labs/zksync-era.git", branch = "boojum-integration" } +zksync_utils = { git = "https://github.com/matter-labs/zksync-era.git", branch = "boojum-integration" } +zksync_state = { git = "https://github.com/matter-labs/zksync-era.git", branch = "boojum-integration" } +vlog = { git = "https://github.com/matter-labs/zksync-era.git", branch = "boojum-integration" } + +colored = "2.0" +hex = "0.4" +once_cell = "1.7" +tracing = { version = "0.1.26", features = ["log"] } +tracing-subscriber = { version = "0.3", features = ["fmt", "env-filter", "time", "json"] } +serde_json = "1.0.67" +serde = { version = "1.0", features = ["derive"] } diff --git a/bootloader/test_infra/README.md b/bootloader/test_infra/README.md new file mode 100644 index 00000000..f66ea39e --- /dev/null +++ b/bootloader/test_infra/README.md @@ -0,0 +1,15 @@ +# Testing infrastructure for bootloader + +This crate allows you to run the unittests against the bootloader code. + +You should put your tests in `../tests/bootloader/bootloader_test.yul`, then compile the yul with: + +```shell +yarn build +``` + +And afterwards run the testing infrastructure: + +```shell +cargo run +``` diff --git a/bootloader/test_infra/src/hook.rs b/bootloader/test_infra/src/hook.rs new file mode 100644 index 00000000..1cb23ddf --- /dev/null +++ b/bootloader/test_infra/src/hook.rs @@ -0,0 +1,129 @@ +use vm::{ + constants::{BOOTLOADER_HEAP_PAGE, VM_HOOK_PARAMS_START_POSITION}, + HistoryMode, SimpleMemory, +}; + +use zksync_types::{ + zkevm_test_harness::zk_evm::{ + aux_structures::MemoryPage, + tracing::{BeforeExecutionData, VmLocalStateData}, + zkevm_opcode_defs::{FatPointer, Opcode, UMAOpcode}, + }, + U256, +}; +use zksync_utils::u256_to_h256; + +#[derive(Clone, Debug)] +pub(crate) enum TestVmHook { + NoHook, + TestLog(String, String), + AssertEqFailed(String, String, String), + RequestedAssert(String), + // Testing framework reporting the number of tests. + TestCount(u32), + // 104 - test start. + TestStart(String), +} + +// Number of 32-bytes slots that are reserved for test hooks (passing information between bootloader test code and the VM). +const TEST_HOOKS: u32 = 5; +const TEST_HOOK_ENUM_POSITON: u32 = VM_HOOK_PARAMS_START_POSITION - 1; +const TEST_HOOK_START: u32 = TEST_HOOK_ENUM_POSITON - TEST_HOOKS; + +pub fn get_vm_hook_params(memory: &SimpleMemory) -> Vec { + memory.dump_page_content_as_u256_words( + BOOTLOADER_HEAP_PAGE, + TEST_HOOK_START..TEST_HOOK_ENUM_POSITON, + ) +} + +fn strip_trailing_zeros(input: &[u8]) -> &[u8] { + // Find the position of the last non-zero byte. + let end = input + .iter() + .rposition(|&byte| byte != 0) + .map(|pos| pos + 1) + .unwrap_or(0); + + // Return the byte slice up to the position found. + &input[..end] +} + +fn test_hook_as_string(hook_param: U256) -> String { + let msg = u256_to_h256(hook_param).as_bytes().to_vec(); + + String::from_utf8(strip_trailing_zeros(&msg).to_vec()).expect("Invalid debug message") +} + +fn test_hook_as_int_or_hex(hook_param: U256) -> String { + // For long data, it is better to use hex-encoding for greater readibility + if hook_param > U256::from(u64::max_value()) { + let mut bytes = [0u8; 32]; + hook_param.to_big_endian(&mut bytes); + format!("0x{}", hex::encode(bytes)) + } else { + hook_param.to_string() + } +} + +const fn heap_page_from_base(base: MemoryPage) -> MemoryPage { + MemoryPage(base.0 + 2) +} + +impl TestVmHook { + pub(crate) fn from_opcode_memory( + state: &VmLocalStateData<'_>, + data: &BeforeExecutionData, + memory: &SimpleMemory, + ) -> Self { + let opcode_variant = data.opcode.variant; + let heap_page = + heap_page_from_base(state.vm_local_state.callstack.current.base_memory_page).0; + + let src0_value = data.src0_value.value; + + let fat_ptr = FatPointer::from_u256(src0_value); + + let value = data.src1_value.value; + + // Only UMA opcodes in the bootloader serve for vm hooks + if !matches!(opcode_variant.opcode, Opcode::UMA(UMAOpcode::HeapWrite)) + || heap_page != BOOTLOADER_HEAP_PAGE + || fat_ptr.offset != TEST_HOOK_ENUM_POSITON * 32 + { + return Self::NoHook; + } + let vm_hook_params: Vec = get_vm_hook_params(memory); + + match value.as_u32() { + 100 => Self::TestLog( + test_hook_as_string(vm_hook_params[0]), + test_hook_as_int_or_hex(vm_hook_params[1]), + ), + 101 => Self::AssertEqFailed( + test_hook_as_int_or_hex(vm_hook_params[0]), + test_hook_as_int_or_hex(vm_hook_params[1]), + test_hook_as_string(vm_hook_params[2]), + ), + 102 => Self::RequestedAssert(test_hook_as_string(vm_hook_params[0])), + 103 => Self::TestCount(vm_hook_params[0].as_u32()), + 104 => Self::TestStart(test_hook_as_string(vm_hook_params[0])), + + _ => Self::NoHook, + } + } +} + +#[cfg(test)] +mod tests { + use zksync_types::U256; + + use crate::hook::test_hook_as_string; + + #[test] + fn test_to_string() { + let data: U256 = + U256::from("0x77696c6c4661696c000000000000000000000000000000000000000000000000"); + assert_eq!("willFail", test_hook_as_string(data)); + } +} diff --git a/bootloader/test_infra/src/main.rs b/bootloader/test_infra/src/main.rs new file mode 100644 index 00000000..e49e009d --- /dev/null +++ b/bootloader/test_infra/src/main.rs @@ -0,0 +1,179 @@ +use crate::{test_count_tracer::TestCountTracer, tracer::BootloaderTestTracer}; +use colored::Colorize; +use once_cell::sync::OnceCell; +use std::process; +use std::{env, sync::Arc}; +use tracing_subscriber::fmt; +use tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt; +use tracing_subscriber::util::SubscriberInitExt; +use vm::{ + HistoryDisabled, L1BatchEnv, L2BlockEnv, SystemEnv, TxExecutionMode, Vm, VmExecutionMode, + VmTracer, +}; +use zksync_contracts::{ + read_zbin_bytecode, BaseSystemContracts, ContractLanguage, SystemContractCode, + SystemContractsRepo, +}; +use zksync_state::{ + InMemoryStorage, StoragePtr, StorageView, IN_MEMORY_STORAGE_DEFAULT_NETWORK_ID, +}; +use zksync_types::system_contracts::get_system_smart_contracts_from_dir; +use zksync_types::{block::legacy_miniblock_hash, Address, L1BatchNumber, MiniblockNumber, U256}; +use zksync_types::{L2ChainId, Transaction}; +use zksync_utils::bytecode::hash_bytecode; +use zksync_utils::{bytes_to_be_words, u256_to_h256}; + +mod hook; +mod test_count_tracer; +mod tracer; + +// Executes bootloader unittests. +fn execute_internal_bootloader_test() { + let test_location = env::current_dir() + .unwrap() + .join("../build/artifacts/bootloader_test.yul/bootloader_test.yul.zbin"); + println!("Current dir is {:?}", test_location); + let bytecode = read_zbin_bytecode(test_location.as_path()); + let hash = hash_bytecode(&bytecode); + let bootloader = SystemContractCode { + code: bytes_to_be_words(bytecode), + hash, + }; + + let repo = SystemContractsRepo { + root: env::current_dir().unwrap().join("../../"), + }; + + let bytecode = repo.read_sys_contract_bytecode("", "DefaultAccount", ContractLanguage::Sol); + let hash = hash_bytecode(&bytecode); + let default_aa = SystemContractCode { + code: bytes_to_be_words(bytecode), + hash, + }; + + let base_system_contract = BaseSystemContracts { + bootloader, + default_aa, + }; + + let system_env = SystemEnv { + zk_porter_available: false, + version: zksync_types::ProtocolVersionId::latest(), + base_system_smart_contracts: base_system_contract, + gas_limit: u32::MAX, + execution_mode: TxExecutionMode::VerifyExecute, + default_validation_computational_gas_limit: u32::MAX, + chain_id: zksync_types::L2ChainId::from(299), + }; + + let mut l1_batch_env = L1BatchEnv { + previous_batch_hash: None, + number: L1BatchNumber::from(1), + timestamp: 14, + l1_gas_price: 250_000_000, + fair_l2_gas_price: 250_000_000, + fee_account: Address::default(), + + enforced_base_fee: None, + first_l2_block: L2BlockEnv { + number: 1, + timestamp: 15, + prev_block_hash: legacy_miniblock_hash(MiniblockNumber(0)), + max_virtual_blocks_to_create: 1, + }, + }; + + // First - get the number of tests. + let test_count = { + let storage: StoragePtr> = + StorageView::new(InMemoryStorage::with_custom_system_contracts_and_chain_id( + L2ChainId::from(IN_MEMORY_STORAGE_DEFAULT_NETWORK_ID), + hash_bytecode, + get_system_smart_contracts_from_dir(env::current_dir().unwrap().join("../../")), + )) + .to_rc_ptr(); + + let mut vm = Vm::new( + l1_batch_env.clone(), + system_env.clone(), + storage.clone(), + HistoryDisabled, + ); + + let test_count = Arc::new(OnceCell::default()); + let custom_tracers = vec![Box::new(TestCountTracer::new(test_count.clone())) + as Box, HistoryDisabled>>]; + + // We're using a TestCountTracer (and passing 0 as fee account) - this should cause the bootloader + // test framework to report number of tests via VM hook. + vm.inspect(custom_tracers, VmExecutionMode::Bootloader); + + test_count.get().unwrap().clone() + }; + println!(" ==== Running {} tests ====", test_count); + + let mut tests_failed: u32 = 0; + + // Now we iterate over the tests. + for test_id in 1..=test_count { + println!("\n === Running test {}", test_id); + + let storage: StoragePtr> = + StorageView::new(InMemoryStorage::with_custom_system_contracts_and_chain_id( + L2ChainId::from(IN_MEMORY_STORAGE_DEFAULT_NETWORK_ID), + hash_bytecode, + get_system_smart_contracts_from_dir(env::current_dir().unwrap().join("../../")), + )) + .to_rc_ptr(); + + // We are passing id of the test in location (0) where we normally put the operator. + // This is then picked up by the testing framework. + l1_batch_env.fee_account = zksync_types::H160::from(u256_to_h256(U256::from(test_id))); + let mut vm = Vm::new( + l1_batch_env.clone(), + system_env.clone(), + storage.clone(), + HistoryDisabled, + ); + let test_result = Arc::new(OnceCell::default()); + + let custom_tracers = vec![Box::new(BootloaderTestTracer::new(test_result.clone())) + as Box, HistoryDisabled>>]; + + // Let's insert transactions into slots. They are not executed, but the tests can run functions against them. + let json_str = include_str!("test_transactions/0.json"); + let tx: Transaction = serde_json::from_str(json_str).unwrap(); + vm.push_transaction(tx); + + vm.inspect(custom_tracers, VmExecutionMode::Bootloader); + + let test_result = test_result.get().unwrap(); + match &test_result.result { + Ok(_) => println!("{} {}", "[PASS]".green(), test_result.test_name), + Err(error_info) => { + tests_failed += 1; + println!( + "{} {} {}", + "[FAIL]".red(), + test_result.test_name, + error_info + ) + } + } + } + if tests_failed > 0 { + println!("{}", format!("{} tests failed.", tests_failed).red()); + process::exit(1); + } else { + println!("{}", "ALL tests passed.".green()) + } +} + +fn main() { + tracing_subscriber::registry() + .with(fmt::Layer::default()) + .with(tracing_subscriber::EnvFilter::from_default_env()) + .init(); + + execute_internal_bootloader_test(); +} diff --git a/bootloader/test_infra/src/test_count_tracer.rs b/bootloader/test_infra/src/test_count_tracer.rs new file mode 100644 index 00000000..7e5adc5a --- /dev/null +++ b/bootloader/test_infra/src/test_count_tracer.rs @@ -0,0 +1,50 @@ +use std::sync::Arc; + +use once_cell::sync::OnceCell; +use vm::{ + DynTracer, ExecutionEndTracer, ExecutionProcessing, HistoryMode, SimpleMemory, + VmExecutionResultAndLogs, VmTracer, +}; +use zksync_state::{StoragePtr, WriteStorage}; +use zksync_types::zkevm_test_harness::zk_evm::tracing::{BeforeExecutionData, VmLocalStateData}; + +use crate::hook::TestVmHook; + +/// Tracer that returns number of tests in the bootloader test file. +pub struct TestCountTracer { + /// Returns number of tests in the yul file. + pub test_count: Arc>, +} + +impl TestCountTracer { + /// Creates the tracer that should also report the amount of tests in a file. + pub fn new(test_count_result: Arc>) -> Self { + TestCountTracer { + test_count: test_count_result, + } + } +} + +impl DynTracer for TestCountTracer { + fn before_execution( + &mut self, + state: VmLocalStateData<'_>, + data: BeforeExecutionData, + memory: &SimpleMemory, + _storage: StoragePtr, + ) { + if let TestVmHook::TestCount(test_count) = + TestVmHook::from_opcode_memory(&state, &data, memory) + { + self.test_count.set(test_count).unwrap(); + } + } +} + +impl ExecutionEndTracer for TestCountTracer {} + +impl ExecutionProcessing for TestCountTracer {} + +impl VmTracer for TestCountTracer { + fn save_results(&mut self, _result: &mut VmExecutionResultAndLogs) {} +} diff --git a/bootloader/test_infra/src/test_transactions/0.json b/bootloader/test_infra/src/test_transactions/0.json new file mode 100644 index 00000000..0edb7a92 --- /dev/null +++ b/bootloader/test_infra/src/test_transactions/0.json @@ -0,0 +1,46 @@ +{ + "common_data": { + "L2": { + "nonce": 1, + "fee": { + "gas_limit": "0xfd617", + "max_fee_per_gas": "0xee6b280", + "max_priority_fee_per_gas": "0x0", + "gas_per_pubdata_limit": "0xc350" + }, + "initiatorAddress": "0x36615cf349d7f6344891b1e7ca7c72883f5dc049", + "signature": [ + 132, 90, 248, 214, 198, 24, 213, 194, 29, 253, 36, 112, 77, 245, 167, 245, 245, 120, 200, 225, 31, 40, 16, 76, + 182, 155, 102, 8, 166, 115, 59, 80, 92, 183, 251, 203, 109, 202, 149, 230, 132, 173, 160, 72, 234, 181, 177, 31, + 224, 177, 28, 52, 251, 76, 107, 79, 160, 132, 47, 135, 199, 146, 71, 193, 28 + ], + "transactionType": "EIP712Transaction", + "input": { + "hash": "0xf415e63408ab712fa72f7931ba8e1f21f9d5e86a2a76fb6857fe7efb84ac8ed4", + "data": [ + 113, 248, 236, 1, 128, 132, 14, 230, 178, 128, 131, 15, 214, 23, 148, 17, 28, 62, 137, 206, 128, 230, 46, 232, + 131, 24, 194, 128, 73, 32, 212, 201, 111, 146, 187, 128, 184, 100, 164, 19, 104, 98, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 75, 105, 108, 108, 101, 114, 32, 99, 111, 109, + 98, 111, 32, 49, 52, 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 130, 1, 4, 128, 128, 130, 1, 4, 148, + 54, 97, 92, 243, 73, 215, 246, 52, 72, 145, 177, 231, 202, 124, 114, 136, 63, 93, 192, 73, 130, 195, 80, 192, + 184, 65, 132, 90, 248, 214, 198, 24, 213, 194, 29, 253, 36, 112, 77, 245, 167, 245, 245, 120, 200, 225, 31, + 40, 16, 76, 182, 155, 102, 8, 166, 115, 59, 80, 92, 183, 251, 203, 109, 202, 149, 230, 132, 173, 160, 72, 234, + 181, 177, 31, 224, 177, 28, 52, 251, 76, 107, 79, 160, 132, 47, 135, 199, 146, 71, 193, 28, 192 + ] + }, + "paymasterParams": { + "paymaster": "0x0000000000000000000000000000000000000000", + "paymasterInput": [] + } + } + }, + "execute": { + "contractAddress": "0x111c3e89ce80e62ee88318c2804920d4c96f92bb", + "calldata": "0xa4136862000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000104b696c6c657220636f6d626f2031343400000000000000000000000000000000", + "value": "0x0", + "factoryDeps": [] + }, + "received_timestamp_ms": 1695015132601, + "raw_bytes": "0x71f8ec0180840ee6b280830fd61794111c3e89ce80e62ee88318c2804920d4c96f92bb80b864a4136862000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000104b696c6c657220636f6d626f203134340000000000000000000000000000000082010480808201049436615cf349d7f6344891b1e7ca7c72883f5dc04982c350c0b841845af8d6c618d5c21dfd24704df5a7f5f578c8e11f28104cb69b6608a6733b505cb7fbcb6dca95e684ada048eab5b11fe0b11c34fb4c6b4fa0842f87c79247c11cc0" +} diff --git a/bootloader/test_infra/src/test_transactions/README.md b/bootloader/test_infra/src/test_transactions/README.md new file mode 100644 index 00000000..ee6c1178 --- /dev/null +++ b/bootloader/test_infra/src/test_transactions/README.md @@ -0,0 +1,8 @@ +# Test Transactions + +This directory contains JSON serialized 'Transaction' objects that are inserted into bootloader memory during +unittesting. + +Please add files with consecutive numbers (0.json, 1.json) - and insert into bootloader in the same order. + +Then, they can be accessed in the unittest, by calling `testing_txDataOffset(x)`. diff --git a/bootloader/test_infra/src/tracer.rs b/bootloader/test_infra/src/tracer.rs new file mode 100644 index 00000000..942389f2 --- /dev/null +++ b/bootloader/test_infra/src/tracer.rs @@ -0,0 +1,138 @@ +use std::sync::Arc; + +use colored::Colorize; + +use once_cell::sync::OnceCell; +use vm::{ + DynTracer, ExecutionEndTracer, ExecutionProcessing, Halt, HistoryMode, SimpleMemory, + TracerExecutionStatus, TracerExecutionStopReason, VmExecutionResultAndLogs, VmTracer, +}; +use zksync_state::{StoragePtr, WriteStorage}; +use zksync_types::zkevm_test_harness::zk_evm::tracing::{BeforeExecutionData, VmLocalStateData}; + +use crate::hook::TestVmHook; + +#[derive(Debug)] +pub struct TestResult { + pub test_name: String, + pub result: Result<(), String>, +} + +/// Bootloader test tracer that is executing while the bootloader tests are running. +/// It can check the assers, return information about the running tests (and amount of tests) etc. +pub struct BootloaderTestTracer { + /// Set if the currently running test has failed. + test_result: Arc>, + /// Set, if the currently running test should fail with a given assert. + requested_assert: Option, + + test_name: Option, +} + +impl BootloaderTestTracer { + pub fn new(test_result: Arc>) -> Self { + BootloaderTestTracer { + test_result, + requested_assert: None, + test_name: None, + } + } +} + +impl DynTracer for BootloaderTestTracer { + fn before_execution( + &mut self, + state: VmLocalStateData<'_>, + data: BeforeExecutionData, + memory: &SimpleMemory, + _storage: StoragePtr, + ) { + let hook = TestVmHook::from_opcode_memory(&state, &data, memory); + + if let TestVmHook::TestLog(msg, data_str) = &hook { + println!("{} {} {}", "Test log".bold(), msg, data_str); + } + if let TestVmHook::AssertEqFailed(a, b, msg) = &hook { + let result = format!("Assert failed: {} is not equal to {}: {}", a, b, msg); + + self.test_result + .set(TestResult { + test_name: self.test_name.clone().unwrap_or("".to_owned()), + result: Err(result.clone()), + }) + .unwrap(); + } + if let TestVmHook::RequestedAssert(requested_assert) = &hook { + self.requested_assert = Some(requested_assert.clone()) + } + + if let TestVmHook::TestStart(test_name) = &hook { + self.test_name = Some(test_name.clone()); + } + } +} + +impl ExecutionEndTracer for BootloaderTestTracer { + fn should_stop_execution(&self) -> TracerExecutionStatus { + if let Some(TestResult { + test_name: _, + result: Err(_), + }) = self.test_result.get() + { + return TracerExecutionStatus::Stop(TracerExecutionStopReason::Finish); + } + return TracerExecutionStatus::Continue; + } +} + +impl ExecutionProcessing for BootloaderTestTracer {} + +impl VmTracer for BootloaderTestTracer { + fn save_results(&mut self, result: &mut VmExecutionResultAndLogs) { + let r = if let Some(requested_assert) = &self.requested_assert { + match &result.result { + vm::ExecutionResult::Success { .. } => Err(format!( + "Should have failed with {}, but run succesfully.", + requested_assert + )), + vm::ExecutionResult::Revert { output } => Err(format!( + "Should have failed with {}, but run reverted with {}.", + requested_assert, + output.to_user_friendly_string() + )), + vm::ExecutionResult::Halt { reason } => { + if let Halt::UnexpectedVMBehavior(reason) = reason { + let reason = reason.strip_prefix("Assertion error: ").unwrap(); + if reason == requested_assert { + Ok(()) + } else { + Err(format!( + "Should have failed with `{}`, but failed with different assert `{}`", + requested_assert, reason + )) + } + } else { + Err(format!( + "Should have failed with `{}`, but halted with`{}`", + requested_assert, reason + )) + } + } + } + } else { + match &result.result { + vm::ExecutionResult::Success { .. } => Ok(()), + vm::ExecutionResult::Revert { output } => Err(output.to_user_friendly_string()), + vm::ExecutionResult::Halt { reason } => Err(reason.to_string()), + } + }; + if self.test_result.get().is_none() { + self.test_result + .set(TestResult { + test_name: self.test_name.clone().unwrap_or("".to_owned()), + result: r, + }) + .unwrap(); + } + } +} diff --git a/bootloader/tests/README.md b/bootloader/tests/README.md new file mode 100644 index 00000000..31acb0ec --- /dev/null +++ b/bootloader/tests/README.md @@ -0,0 +1,23 @@ +# Testing + +## Full tests + +`dummy.yul` and `transfer_tests.yul` are full Yul files, which are replacing the bootloader, and are used in +`zksync-era` crate. + +## Unittests + +Please put bootloader unittests in `bootloader/bootloader_test.yul` file, and any testing utility functions in +`utils/test_utils.yul`. + +To execute tests, you should first run yarn to prepare the source code: + +```shell +yarn preprocess && yarn compile-yul +``` + +And then run the test framework: + +```shell +cd test_infa && cargo run +``` diff --git a/bootloader/tests/bootloader/bootloader_test.yul b/bootloader/tests/bootloader/bootloader_test.yul new file mode 100644 index 00000000..cd41c45d --- /dev/null +++ b/bootloader/tests/bootloader/bootloader_test.yul @@ -0,0 +1,52 @@ +function TEST_safeSub() { + testing_assertEq(safeSub(10, 7, "err"), 3, "Failed to subtract 7") + testing_assertEq(safeSub(10, 8, "err"), 2, "Failed to subtract 8") +} + +function TEST_safeDiv() { + testing_assertEq(safeDiv(4, 2, "err"), 2, "Simple division") + testing_assertEq(safeDiv(5, 2, "err"), 2, "Rouding") + testing_assertEq(safeDiv(5, 3, "err"), 1, "Rouding down") + testing_assertEq(safeDiv(4, 3, "err"), 1, "Rouding down") + testing_assertEq(safeDiv(0, 3, "err"), 0, "Rouding down") +} +function TEST_safeDivAssert() { + testing_testWillFailWith("divByZero") + safeDiv(4, 0, "divByZero") +} + +function TEST_asserts() { + testing_testWillFailWith("willFail") + safeSub(10, 12, "willFail") +} + +function TEST_safeMul() { + testing_assertEq(safeMul(4, 2, "err"), 8, "Simple") + testing_assertEq(safeMul(0, 2, "err"), 0, "With zero") + testing_assertEq(safeMul(0, 0, "err"), 0, "With zero") + testing_assertEq(safeMul(2, 0, "err"), 0, "With zero") +} + +function TEST_safeMulAssert() { + testing_testWillFailWith("overflow") + let left := shl(129, 1) + testing_log("left", left) + safeMul(left, left, "overflow") +} + +// function TEST_should ignore + +function TEST_strLen() { + testing_assertEq(getStrLen("abcd"), 4, "short string") + testing_assertEq(getStrLen("00"), 2, "0 filled string") + testing_assertEq(getStrLen(""), 0, "empty string") + testing_assertEq(getStrLen("12345678901234567890123456789012"), 32, "max length") + testing_assertEq(getStrLen("1234567890123456789012345678901234"), 0, "over max length") +} + +function TEST_simple_transaction() { + // We'll test the transaction from 0.json + let txDataOffset := testing_txDataOffset(0) + let innerTxDataOffset := add(txDataOffset, 0x20) + testing_assertEq(getGasPerPubdataByteLimit(innerTxDataOffset), 0xc350, "Invalid pubdata limit") +} diff --git a/bootloader/tests/utils/test_utils.yul b/bootloader/tests/utils/test_utils.yul new file mode 100644 index 00000000..561a4679 --- /dev/null +++ b/bootloader/tests/utils/test_utils.yul @@ -0,0 +1,55 @@ + + +// We're locating the test hooks 'before' the last free slot. +function TEST_HOOK_PTR() -> ret { + ret := LAST_FREE_SLOT() +} + +function TEST_HOOK_PARAMS_OFFSET() -> ret { + ret := sub(TEST_HOOK_PTR(), mul(5, 32)) +} + +function setTestHook(hook) { + mstore(TEST_HOOK_PTR(), unoptimized(hook)) +} + +function storeTestHookParam(paramId, value) { + let offset := add(TEST_HOOK_PARAMS_OFFSET(), mul(32, paramId)) + mstore(offset, unoptimized(value)) +} + + +function testing_log(msg, data) { + storeTestHookParam(0, nonOptimized(msg)) + storeTestHookParam(1, nonOptimized(data)) + setTestHook(nonOptimized(100)) +} + +function testing_start(test_name) { + storeTestHookParam(0, nonOptimized(test_name)) + setTestHook(nonOptimized(104)) +} + +function testing_assertEq(a, b, message) { + if iszero(eq(a, b)) { + storeTestHookParam(0, nonOptimized(a)) + storeTestHookParam(1, nonOptimized(b)) + storeTestHookParam(2, nonOptimized(message)) + setTestHook(nonOptimized(101)) + } +} + +function testing_testWillFailWith(message) { + storeTestHookParam(0, unoptimized(message)) + setTestHook(nonOptimized(102)) +} +function testing_totalTests(tests) { + storeTestHookParam(0, unoptimized(tests)) + setTestHook(nonOptimized(103)) +} + +// Returns txDataOffset for the index transaction. +function testing_txDataOffset(index) -> txDataOffset { + let txPtr := add(TX_DESCRIPTION_BEGIN_BYTE(), mul(index, TX_DESCRIPTION_SIZE())) + txDataOffset := mload(add(txPtr, 0x20)) +} diff --git a/contracts/AccountCodeStorage.sol b/contracts/AccountCodeStorage.sol index 1dbdcabe..d5027f2f 100644 --- a/contracts/AccountCodeStorage.sol +++ b/contracts/AccountCodeStorage.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; import "./interfaces/IAccountCodeStorage.sol"; import "./libraries/Utils.sol"; @@ -8,6 +8,7 @@ import {DEPLOYER_SYSTEM_CONTRACT, NONCE_HOLDER_SYSTEM_CONTRACT, CURRENT_MAX_PREC /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice The storage of this contract serves as a mapping for the code hashes of the 32-byte account addresses. * @dev Code hash is not strictly a hash, it's a structure where the first byte denotes the version of the hash, * the second byte denotes whether the contract is constructed, and the next two bytes denote the length in 32-byte words. @@ -44,7 +45,7 @@ contract AccountCodeStorage is IAccountCodeStorage { /// but checks whether the bytecode hash corresponds to the constructed smart contract. function storeAccountConstructedCodeHash(address _address, bytes32 _hash) external override onlyDeployer { // Check that code hash corresponds to the deploying smart contract - require(Utils.isContractConstructed(_hash), "Code hash is not for a contract on constructor"); + require(Utils.isContractConstructed(_hash), "Code hash is not for a constructed contract"); _storeCodeHash(_address, _hash); } diff --git a/contracts/BootloaderUtilities.sol b/contracts/BootloaderUtilities.sol index ad5f13da..49467bdc 100644 --- a/contracts/BootloaderUtilities.sol +++ b/contracts/BootloaderUtilities.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; import "./interfaces/IBootloaderUtilities.sol"; import "./libraries/TransactionHelper.sol"; @@ -9,6 +9,7 @@ import "./libraries/EfficientCall.sol"; /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice A contract that provides some utility methods for the bootloader * that is very hard to write in Yul. */ diff --git a/contracts/BytecodeCompressor.sol b/contracts/BytecodeCompressor.sol deleted file mode 100644 index b406ecb1..00000000 --- a/contracts/BytecodeCompressor.sol +++ /dev/null @@ -1,92 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8.0; - -import "./interfaces/IBytecodeCompressor.sol"; -import "./Constants.sol"; -import "./libraries/Utils.sol"; -import "./libraries/UnsafeBytesCalldata.sol"; - -/** - * @author Matter Labs - * @notice Simple implementation of the compression algorithm specialized for zkEVM bytecode. - * @dev Every deployed bytecode in zkEVM should be publicly restorable from the L1 data availability. - * For this reason, the user may request the sequencer to publish the original bytecode and mark it as known. - * Or the user may compress the bytecode and publish it instead (fewer data onchain!). - */ -contract BytecodeCompressor is IBytecodeCompressor { - using UnsafeBytesCalldata for bytes; - - modifier onlyBootloader() { - require(msg.sender == BOOTLOADER_FORMAL_ADDRESS, "Callable only by the bootloader"); - _; - } - - /// @notice Verify the compressed bytecode and publish it on the L1. - /// @param _bytecode The original bytecode to be verified against. - /// @param _rawCompressedData The compressed bytecode in a format of: - /// - 2 bytes: the length of the dictionary - /// - N bytes: the dictionary - /// - M bytes: the encoded data - /// @dev The dictionary is a sequence of 8-byte chunks, each of them has the associated index. - /// @dev The encoded data is a sequence of 2-byte chunks, each of them is an index of the dictionary. - /// @dev The compression algorithm works as follows: - /// 1. The original bytecode is split into 8-byte chunks. - /// Since the bytecode size is always a multiple of 32, this is always possible. - /// 2. For each 8-byte chunk in the original bytecode: - /// * If the chunk is not already in the dictionary, it is added to the dictionary array. - /// * If the dictionary becomes overcrowded (2^16 + 1 elements), the compression process will fail. - /// * The 2-byte index of the chunk in the dictionary is added to the encoded data. - /// @dev Currently, the method may be called only from the bootloader because the server is not ready to publish bytecodes - /// in internal transactions. However, in the future, we will allow everyone to publish compressed bytecodes. - function publishCompressedBytecode( - bytes calldata _bytecode, - bytes calldata _rawCompressedData - ) external payable onlyBootloader returns (bytes32 bytecodeHash) { - unchecked { - (bytes calldata dictionary, bytes calldata encodedData) = _decodeRawBytecode(_rawCompressedData); - - require(dictionary.length % 8 == 0, "Dictionary length should be a multiple of 8"); - require(dictionary.length <= 2 ** 16 * 8, "Dictionary is too big"); - require( - encodedData.length * 4 == _bytecode.length, - "Encoded data length should be 4 times shorter than the original bytecode" - ); - - for (uint256 encodedDataPointer = 0; encodedDataPointer < encodedData.length; encodedDataPointer += 2) { - uint256 indexOfEncodedChunk = uint256(encodedData.readUint16(encodedDataPointer)) * 8; - require(indexOfEncodedChunk < dictionary.length, "Encoded chunk index is out of bounds"); - - uint64 encodedChunk = dictionary.readUint64(indexOfEncodedChunk); - uint64 realChunk = _bytecode.readUint64(encodedDataPointer * 4); - - require(encodedChunk == realChunk, "Encoded chunk does not match the original bytecode"); - } - } - - bytecodeHash = Utils.hashL2Bytecode(_bytecode); - - bytes32 rawCompressedDataHash = L1_MESSENGER_CONTRACT.sendToL1(_rawCompressedData); - KNOWN_CODE_STORAGE_CONTRACT.markBytecodeAsPublished( - bytecodeHash, - rawCompressedDataHash, - _rawCompressedData.length - ); - } - - /// @notice Decode the raw compressed data into the dictionary and the encoded data. - /// @param _rawCompressedData The compressed bytecode in a format of: - /// - 2 bytes: the bytes length of the dictionary - /// - N bytes: the dictionary - /// - M bytes: the encoded data - function _decodeRawBytecode( - bytes calldata _rawCompressedData - ) internal pure returns (bytes calldata dictionary, bytes calldata encodedData) { - unchecked { - // The dictionary length can't be more than 2^16, so it fits into 2 bytes. - uint256 dictionaryLen = uint256(_rawCompressedData.readUint16(0)); - dictionary = _rawCompressedData[2:2 + dictionaryLen * 8]; - encodedData = _rawCompressedData[2 + dictionaryLen * 8:]; - } - } -} diff --git a/contracts/ComplexUpgrader.sol b/contracts/ComplexUpgrader.sol index 0968b5fd..2f4d886c 100644 --- a/contracts/ComplexUpgrader.sol +++ b/contracts/ComplexUpgrader.sol @@ -1,26 +1,24 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; -import "./interfaces/IComplexUpgrader.sol"; +import {IComplexUpgrader} from "./interfaces/IComplexUpgrader.sol"; import {FORCE_DEPLOYER} from "./Constants.sol"; /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice Upgrader which should be used to perform complex multistep upgrades on L2. In case some custom logic for an upgrade is needed * this logic should be deployed into the user space and then this contract will delegatecall to the deployed contract. */ contract ComplexUpgrader is IComplexUpgrader { /// @notice Executes an upgrade process by delegating calls to another contract. - /// @dev This function allows only the `FORCE_DEPLOYER` to initiate the upgrade. + /// @dev This function allows only the `FORCE_DEPLOYER` to initiate the upgrade. /// If the delegate call fails, the function will revert the transaction, returning the error message /// provided by the delegated contract. /// @param _delegateTo the address of the contract to which the calls will be delegated /// @param _calldata the calldata to be delegate called in the `_delegateTo` contract - function upgrade( - address _delegateTo, - bytes calldata _calldata - ) external payable { + function upgrade(address _delegateTo, bytes calldata _calldata) external payable { require(msg.sender == FORCE_DEPLOYER, "Can only be called by FORCE_DEPLOYER"); require(_delegateTo.code.length > 0, "Delegatee is an EOA"); diff --git a/contracts/Compressor.sol b/contracts/Compressor.sol new file mode 100644 index 00000000..24aac725 --- /dev/null +++ b/contracts/Compressor.sol @@ -0,0 +1,250 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.20; + +import {ICompressor, OPERATION_BITMASK, LENGTH_BITS_OFFSET, MAX_ENUMERATION_INDEX_SIZE} from "./interfaces/ICompressor.sol"; +import {ISystemContract} from "./interfaces/ISystemContract.sol"; +import {Utils} from "./libraries/Utils.sol"; +import {UnsafeBytesCalldata} from "./libraries/UnsafeBytesCalldata.sol"; +import {EfficientCall} from "./libraries/EfficientCall.sol"; +import {L1_MESSENGER_CONTRACT, INITIAL_WRITE_STARTING_POSITION, COMPRESSED_INITIAL_WRITE_SIZE, STATE_DIFF_ENTRY_SIZE, STATE_DIFF_ENUM_INDEX_OFFSET, STATE_DIFF_FINAL_VALUE_OFFSET, STATE_DIFF_DERIVED_KEY_OFFSET, DERIVED_KEY_LENGTH, VALUE_LENGTH, ENUM_INDEX_LENGTH, KNOWN_CODE_STORAGE_CONTRACT} from "./Constants.sol"; + +/** + * @author Matter Labs + * @custom:security-contact security@matterlabs.dev + * @notice Contract with code pertaining to compression for zkEVM; at the moment this is used for bytecode compression + * and state diff compression validation. + * @dev Every deployed bytecode/published state diffs in zkEVM should be publicly restorable from the L1 data availability. + * For this reason, the user may request the sequencer to publish the original bytecode and mark it as known. + * Or the user may compress the bytecode and publish it instead (fewer data onchain!). At the end of every L1 Batch + * we publish pubdata, part of which contains the state diffs that occurred within the batch. + */ +contract Compressor is ICompressor, ISystemContract { + using UnsafeBytesCalldata for bytes; + + /// @notice Verify the compressed bytecode and publish it on the L1. + /// @param _bytecode The original bytecode to be verified against. + /// @param _rawCompressedData The compressed bytecode in a format of: + /// - 2 bytes: the length of the dictionary + /// - N bytes: the dictionary + /// - M bytes: the encoded data + /// @dev The dictionary is a sequence of 8-byte chunks, each of them has the associated index. + /// @dev The encoded data is a sequence of 2-byte chunks, each of them is an index of the dictionary. + /// @dev The compression algorithm works as follows: + /// 1. The original bytecode is split into 8-byte chunks. + /// Since the bytecode size is always a multiple of 32, this is always possible. + /// 2. For each 8-byte chunk in the original bytecode: + /// * If the chunk is not already in the dictionary, it is added to the dictionary array. + /// * If the dictionary becomes overcrowded (2^16 + 1 elements), the compression process will fail. + /// * The 2-byte index of the chunk in the dictionary is added to the encoded data. + /// @dev Currently, the method may be called only from the bootloader because the server is not ready to publish bytecodes + /// in internal transactions. However, in the future, we will allow everyone to publish compressed bytecodes. + function publishCompressedBytecode( + bytes calldata _bytecode, + bytes calldata _rawCompressedData + ) external payable onlyCallFromBootloader returns (bytes32 bytecodeHash) { + unchecked { + (bytes calldata dictionary, bytes calldata encodedData) = _decodeRawBytecode(_rawCompressedData); + + require(dictionary.length % 8 == 0, "Dictionary length should be a multiple of 8"); + require(dictionary.length <= 2 ** 16 * 8, "Dictionary is too big"); + require( + encodedData.length * 4 == _bytecode.length, + "Encoded data length should be 4 times shorter than the original bytecode" + ); + + for (uint256 encodedDataPointer = 0; encodedDataPointer < encodedData.length; encodedDataPointer += 2) { + uint256 indexOfEncodedChunk = uint256(encodedData.readUint16(encodedDataPointer)) * 8; + require(indexOfEncodedChunk < dictionary.length, "Encoded chunk index is out of bounds"); + + uint64 encodedChunk = dictionary.readUint64(indexOfEncodedChunk); + uint64 realChunk = _bytecode.readUint64(encodedDataPointer * 4); + + require(encodedChunk == realChunk, "Encoded chunk does not match the original bytecode"); + } + } + + bytecodeHash = Utils.hashL2Bytecode(_bytecode); + L1_MESSENGER_CONTRACT.sendToL1(_rawCompressedData); + KNOWN_CODE_STORAGE_CONTRACT.markBytecodeAsPublished(bytecodeHash); + } + + /// @notice Verifies that the compression of state diffs has been done correctly for the {_stateDiffs} param. + /// @param _numberOfStateDiffs The number of state diffs being checked. + /// @param _enumerationIndexSize Number of bytes used to represent an enumeration index for repeated writes. + /// @param _stateDiffs Encoded full state diff structs. See the first dev comment below for encoding. + /// @param _compressedStateDiffs The compressed state diffs + /// @dev We don't verify that the size of {_stateDiffs} is equivalent to {_numberOfStateDiffs} * STATE_DIFF_ENTRY_SIZE since that check is + /// done within the L1Messenger calling contract. + /// @return stateDiffHash Hash of the encoded (uncompressed) state diffs to be committed to via system log. + /// @dev This check assumes that the ordering of state diffs are sorted by (address, key) for the encoded state diffs and + /// then the compressed are sorted the same but with all the initial writes coming before the repeated writes. + /// @dev state diff: [20bytes address][32bytes key][32bytes derived key][8bytes enum index][32bytes initial value][32bytes final value] + /// @dev The compression format: + /// - 2 bytes: number of initial writes + /// - N bytes initial writes + /// - 32 bytes derived key + /// - 1 byte metadata: + /// - first 5 bits: length in bytes of compressed value + /// - last 3 bits: operation + /// - 0 -> Nothing (32 bytes) + /// - 1 -> Add + /// - 2 -> Subtract + /// - 3 -> Transform (< 32 bytes) + /// - Len Bytes: Compressed Value + /// - M bytes repeated writes + /// - {_enumerationIndexSize} bytes for enumeration index + /// - 1 byte metadata: + /// - first 5 bits: length in bytes of compressed value + /// - last 3 bits: operation + /// - 0 -> Nothing (32 bytes) + /// - 1 -> Add + /// - 2 -> Subtract + /// - 3 -> Transform (< 32 bytes) + /// - Len Bytes: Compressed Value + function verifyCompressedStateDiffs( + uint256 _numberOfStateDiffs, + uint256 _enumerationIndexSize, + bytes calldata _stateDiffs, + bytes calldata _compressedStateDiffs + ) external payable onlyCallFrom(address(L1_MESSENGER_CONTRACT)) returns (bytes32 stateDiffHash) { + // We do not enforce the operator to use the optimal, i.e. the minimally possible _enumerationIndexSize. + // We do enforce however, that the _enumerationIndexSize is not larger than 8 bytes long, which is the + // maximal ever possible size for enumeration index. + require(_enumerationIndexSize <= MAX_ENUMERATION_INDEX_SIZE, "enumeration index size is too large"); + + uint256 numberOfInitialWrites = uint256(_compressedStateDiffs.readUint16(0)); + + uint256 stateDiffPtr = 2; + uint256 numInitialWritesProcessed = 0; + + // Process initial writes + for (uint256 i = 0; i < _numberOfStateDiffs * STATE_DIFF_ENTRY_SIZE; i += STATE_DIFF_ENTRY_SIZE) { + bytes calldata stateDiff = _stateDiffs[i:i + STATE_DIFF_ENTRY_SIZE]; + uint64 enumIndex = stateDiff.readUint64(84); + if (enumIndex != 0) { + // It is a repeated write, so we skip it. + continue; + } + + numInitialWritesProcessed++; + + bytes32 derivedKey = stateDiff.readBytes32(52); + uint256 initValue = stateDiff.readUint256(92); + uint256 finalValue = stateDiff.readUint256(124); + require(derivedKey == _compressedStateDiffs.readBytes32(stateDiffPtr), "iw: initial key mismatch"); + stateDiffPtr += 32; + + uint8 metadata = uint8(bytes1(_compressedStateDiffs[stateDiffPtr])); + stateDiffPtr++; + uint8 operation = metadata & OPERATION_BITMASK; + uint8 len = operation == 0 ? 32 : metadata >> LENGTH_BITS_OFFSET; + _verifyValueCompression( + initValue, + finalValue, + operation, + _compressedStateDiffs[stateDiffPtr:stateDiffPtr + len] + ); + stateDiffPtr += len; + } + + require(numInitialWritesProcessed == numberOfInitialWrites, "Incorrect number of initial storage diffs"); + + // Process repeated writes + for (uint256 i = 0; i < _numberOfStateDiffs * STATE_DIFF_ENTRY_SIZE; i += STATE_DIFF_ENTRY_SIZE) { + bytes calldata stateDiff = _stateDiffs[i:i + STATE_DIFF_ENTRY_SIZE]; + uint64 enumIndex = stateDiff.readUint64(84); + if (enumIndex == 0) { + continue; + } + + uint256 initValue = stateDiff.readUint256(92); + uint256 finalValue = stateDiff.readUint256(124); + uint256 compressedEnumIndex = _sliceToUint256( + _compressedStateDiffs[stateDiffPtr:stateDiffPtr + _enumerationIndexSize] + ); + require(enumIndex == compressedEnumIndex, "rw: enum key mismatch"); + stateDiffPtr += _enumerationIndexSize; + + uint8 metadata = uint8(bytes1(_compressedStateDiffs[stateDiffPtr])); + stateDiffPtr += 1; + uint8 operation = metadata & OPERATION_BITMASK; + uint8 len = operation == 0 ? 32 : metadata >> LENGTH_BITS_OFFSET; + _verifyValueCompression( + initValue, + finalValue, + operation, + _compressedStateDiffs[stateDiffPtr:stateDiffPtr + len] + ); + stateDiffPtr += len; + } + + require(stateDiffPtr == _compressedStateDiffs.length, "Extra data in _compressedStateDiffs"); + + stateDiffHash = EfficientCall.keccak(_stateDiffs); + } + + /// @notice Decode the raw compressed data into the dictionary and the encoded data. + /// @param _rawCompressedData The compressed bytecode in a format of: + /// - 2 bytes: the bytes length of the dictionary + /// - N bytes: the dictionary + /// - M bytes: the encoded data + function _decodeRawBytecode( + bytes calldata _rawCompressedData + ) internal pure returns (bytes calldata dictionary, bytes calldata encodedData) { + unchecked { + // The dictionary length can't be more than 2^16, so it fits into 2 bytes. + uint256 dictionaryLen = uint256(_rawCompressedData.readUint16(0)); + dictionary = _rawCompressedData[2:2 + dictionaryLen * 8]; + encodedData = _rawCompressedData[2 + dictionaryLen * 8:]; + } + } + + /// @notice Verify value compression was done correct given initial value, final value, operation, and compressed value + /// @param _initialValue Previous value of key/enumeration index. + /// @param _finalValue Updated value of key/enumeration index. + /// @param _operation The operation that was performed on value. + /// @param _compressedValue The slice of calldata with compressed value either representing the final + /// value or difference between initial and final value. It should be of arbitrary length less than or equal to 32 bytes. + /// @dev It is the responsibility of the caller of this function to ensure that the `_compressedValue` has length no longer than 32 bytes. + /// @dev Operation id mapping: + /// 0 -> Nothing (32 bytes) + /// 1 -> Add + /// 2 -> Subtract + /// 3 -> Transform (< 32 bytes) + function _verifyValueCompression( + uint256 _initialValue, + uint256 _finalValue, + uint256 _operation, + bytes calldata _compressedValue + ) internal pure { + uint256 convertedValue = _sliceToUint256(_compressedValue); + + unchecked { + if (_operation == 0 || _operation == 3) { + require(convertedValue == _finalValue, "transform or no compression: compressed and final mismatch"); + } else if (_operation == 1) { + require( + _initialValue + convertedValue == _finalValue, + "add: initial plus converted not equal to final" + ); + } else if (_operation == 2) { + require( + _initialValue - convertedValue == _finalValue, + "sub: initial minus converted not equal to final" + ); + } else { + revert("unsupported operation"); + } + } + } + + /// @notice Converts a calldata slice into uint256. It is the responsibility of the caller to ensure that + /// the _calldataSlice has length no longer than 32 bytes + /// @param _calldataSlice The calldata slice to convert to uint256 + /// @return number The uint256 representation of the calldata slice + function _sliceToUint256(bytes calldata _calldataSlice) internal pure returns (uint256 number) { + number = uint256(bytes32(_calldataSlice)); + number >>= (256 - (_calldataSlice.length * 8)); + } +} diff --git a/contracts/Constants.sol b/contracts/Constants.sol index 048f9b54..f0896710 100644 --- a/contracts/Constants.sol +++ b/contracts/Constants.sol @@ -1,18 +1,18 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; - -import "./interfaces/IAccountCodeStorage.sol"; -import "./interfaces/INonceHolder.sol"; -import "./interfaces/IContractDeployer.sol"; -import "./interfaces/IKnownCodesStorage.sol"; -import "./interfaces/IImmutableSimulator.sol"; -import "./interfaces/IEthToken.sol"; -import "./interfaces/IL1Messenger.sol"; -import "./interfaces/ISystemContext.sol"; -import "./interfaces/IBytecodeCompressor.sol"; -import "./interfaces/IComplexUpgrader.sol"; -import "./BootloaderUtilities.sol"; +pragma solidity 0.8.20; + +import {IAccountCodeStorage} from "./interfaces/IAccountCodeStorage.sol"; +import {INonceHolder} from "./interfaces/INonceHolder.sol"; +import {IContractDeployer} from "./interfaces/IContractDeployer.sol"; +import {IKnownCodesStorage} from "./interfaces/IKnownCodesStorage.sol"; +import {IImmutableSimulator} from "./interfaces/IImmutableSimulator.sol"; +import {IEthToken} from "./interfaces/IEthToken.sol"; +import {IL1Messenger} from "./interfaces/IL1Messenger.sol"; +import {ISystemContext} from "./interfaces/ISystemContext.sol"; +import {ICompressor} from "./interfaces/ICompressor.sol"; +import {IComplexUpgrader} from "./interfaces/IComplexUpgrader.sol"; +import {IBootloaderUtilities} from "./interfaces/IBootloaderUtilities.sol"; /// @dev All the system contracts introduced by zkSync have their addresses /// started from 2^15 in order to avoid collision with Ethereum precompiles. @@ -24,13 +24,13 @@ uint160 constant MAX_SYSTEM_CONTRACT_ADDRESS = 0xffff; // 2^16 - 1 address constant ECRECOVER_SYSTEM_CONTRACT = address(0x01); address constant SHA256_SYSTEM_CONTRACT = address(0x02); +address constant ECADD_SYSTEM_CONTRACT = address(0x06); +address constant ECMUL_SYSTEM_CONTRACT = address(0x07); -/// @dev The current maximum deployed precompile address. -/// Note: currently only two precompiles are deployed: -/// 0x01 - ecrecover -/// 0x02 - sha256 -/// Important! So the constant should be updated if more precompiles are deployed. -uint256 constant CURRENT_MAX_PRECOMPILE_ADDRESS = uint256(uint160(SHA256_SYSTEM_CONTRACT)); +/// @dev The maximal possible address of an L1-like precompie. These precompiles maintain the following properties: +/// - Their extcodehash is EMPTY_STRING_KECCAK +/// - Their extcodesize is 0 despite having a bytecode formally deployed there. +uint256 constant CURRENT_MAX_PRECOMPILE_ADDRESS = 0xff; address payable constant BOOTLOADER_FORMAL_ADDRESS = payable(address(SYSTEM_CONTRACTS_OFFSET + 0x01)); IAccountCodeStorage constant ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT = IAccountCodeStorage( @@ -55,17 +55,13 @@ address constant KECCAK256_SYSTEM_CONTRACT = address(SYSTEM_CONTRACTS_OFFSET + 0 ISystemContext constant SYSTEM_CONTEXT_CONTRACT = ISystemContext(payable(address(SYSTEM_CONTRACTS_OFFSET + 0x0b))); -BootloaderUtilities constant BOOTLOADER_UTILITIES = BootloaderUtilities(address(SYSTEM_CONTRACTS_OFFSET + 0x0c)); +IBootloaderUtilities constant BOOTLOADER_UTILITIES = IBootloaderUtilities(address(SYSTEM_CONTRACTS_OFFSET + 0x0c)); address constant EVENT_WRITER_CONTRACT = address(SYSTEM_CONTRACTS_OFFSET + 0x0d); -IBytecodeCompressor constant BYTECODE_COMPRESSOR_CONTRACT = IBytecodeCompressor( - address(SYSTEM_CONTRACTS_OFFSET + 0x0e) -); +ICompressor constant COMPRESSOR_CONTRACT = ICompressor(address(SYSTEM_CONTRACTS_OFFSET + 0x0e)); -IComplexUpgrader constant COMPLEX_UPGRADER_CONTRACT = IComplexUpgrader( - address(SYSTEM_CONTRACTS_OFFSET + 0x0f) -); +IComplexUpgrader constant COMPLEX_UPGRADER_CONTRACT = IComplexUpgrader(address(SYSTEM_CONTRACTS_OFFSET + 0x0f)); /// @dev If the bitwise AND of the extraAbi[2] param when calling the MSG_VALUE_SIMULATOR /// is non-zero, the call will be assumed to be a system one. @@ -80,3 +76,49 @@ bytes32 constant CREATE2_PREFIX = 0x2020dba91b30cc0006188af794c2fb30dd8520db7e2c /// @dev Prefix used during derivation of account addresses using CREATE /// @dev keccak256("zksyncCreate") bytes32 constant CREATE_PREFIX = 0x63bae3a9951d38e8a3fbb7b70909afc1200610fc5bc55ade242f815974674f23; + +/// @dev Each state diff consists of 156 bytes of actual data and 116 bytes of unused padding, needed for circuit efficiency. +uint256 constant STATE_DIFF_ENTRY_SIZE = 272; + +/// @dev While the "real" amount of pubdata that can be sent rarely exceeds the 110k - 120k, it is better to +/// allow the operator to provide any reasonably large value in order to avoid unneeded constraints on the operator. +uint256 constant MAX_ALLOWED_PUBDATA_PER_BATCH = 520000; + +enum SystemLogKey { + L2_TO_L1_LOGS_TREE_ROOT_KEY, + TOTAL_L2_TO_L1_PUBDATA_KEY, + STATE_DIFF_HASH_KEY, + PACKED_BATCH_AND_L2_BLOCK_TIMESTAMP_KEY, + PREV_BATCH_HASH_KEY, + CHAINED_PRIORITY_TXN_HASH_KEY, + NUMBER_OF_LAYER_1_TXS_KEY, + EXPECTED_SYSTEM_CONTRACT_UPGRADE_TX_HASH_KEY +} + +/// @dev The number of leaves in the L2->L1 log Merkle tree. +/// While formally a tree of any length is acceptable, the node supports only a constant length of 2048 leaves. +uint256 constant L2_TO_L1_LOGS_MERKLE_TREE_LEAVES = 2048; + +/// @dev The length of the derived key in bytes inside compressed state diffs. +uint256 constant DERIVED_KEY_LENGTH = 32; +/// @dev The length of the enum index in bytes inside compressed state diffs. +uint256 constant ENUM_INDEX_LENGTH = 8; +/// @dev The length of value in bytes inside compressed state diffs. +uint256 constant VALUE_LENGTH = 32; + +/// @dev The length of the compressed initial storage write in bytes. +uint256 constant COMPRESSED_INITIAL_WRITE_SIZE = DERIVED_KEY_LENGTH + VALUE_LENGTH; +/// @dev The length of the compressed repeated storage write in bytes. +uint256 constant COMPRESSED_REPEATED_WRITE_SIZE = ENUM_INDEX_LENGTH + VALUE_LENGTH; + +/// @dev The position from which the initial writes start in the compressed state diffs. +uint256 constant INITIAL_WRITE_STARTING_POSITION = 4; + +/// @dev Each storage diffs consists of the following elements: +/// [20bytes address][32bytes key][32bytes derived key][8bytes enum index][32bytes initial value][32bytes final value] +/// @dev The offset of the deriived key in a storage diff. +uint256 constant STATE_DIFF_DERIVED_KEY_OFFSET = 52; +/// @dev The offset of the enum index in a storage diff. +uint256 constant STATE_DIFF_ENUM_INDEX_OFFSET = 84; +/// @dev The offset of the final value in a storage diff. +uint256 constant STATE_DIFF_FINAL_VALUE_OFFSET = 124; diff --git a/contracts/ContractDeployer.sol b/contracts/ContractDeployer.sol index 029e48d9..50af9742 100644 --- a/contracts/ContractDeployer.sol +++ b/contracts/ContractDeployer.sol @@ -1,18 +1,19 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; import {ImmutableData} from "./interfaces/IImmutableSimulator.sol"; -import "./interfaces/IContractDeployer.sol"; -import {CREATE2_PREFIX, CREATE_PREFIX, NONCE_HOLDER_SYSTEM_CONTRACT, ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT, FORCE_DEPLOYER, MAX_SYSTEM_CONTRACT_ADDRESS, KNOWN_CODE_STORAGE_CONTRACT, ETH_TOKEN_SYSTEM_CONTRACT, IMMUTABLE_SIMULATOR_SYSTEM_CONTRACT, COMPLEX_UPGRADER_CONTRACT} from "./Constants.sol"; +import {IContractDeployer} from "./interfaces/IContractDeployer.sol"; +import {CREATE2_PREFIX, CREATE_PREFIX, NONCE_HOLDER_SYSTEM_CONTRACT, ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT, FORCE_DEPLOYER, MAX_SYSTEM_CONTRACT_ADDRESS, KNOWN_CODE_STORAGE_CONTRACT, ETH_TOKEN_SYSTEM_CONTRACT, IMMUTABLE_SIMULATOR_SYSTEM_CONTRACT, COMPLEX_UPGRADER_CONTRACT, KECCAK256_SYSTEM_CONTRACT} from "./Constants.sol"; -import "./libraries/Utils.sol"; -import "./libraries/EfficientCall.sol"; +import {Utils} from "./libraries/Utils.sol"; +import {EfficientCall} from "./libraries/EfficientCall.sol"; import {SystemContractHelper} from "./libraries/SystemContractHelper.sol"; -import "./interfaces/ISystemContract.sol"; +import {ISystemContract} from "./interfaces/ISystemContract.sol"; /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice System smart contract that is responsible for deploying other smart contracts on zkSync. * @dev The contract is responsible for generating the address of the deployed smart contract, * incrementing the deployment nonce and making sure that the constructor is never called twice in a contract. @@ -43,7 +44,10 @@ contract ContractDeployer is IContractDeployer, ISystemContract { } // It is an EOA, it is still an account. - if (ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT.getRawCodeHash(_address) == 0) { + if ( + _address > address(MAX_SYSTEM_CONTRACT_ADDRESS) && + ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT.getRawCodeHash(_address) == 0 + ) { return AccountAbstractionVersion.Version1; } @@ -213,6 +217,9 @@ contract ContractDeployer is IContractDeployer, ISystemContract { function forceDeployOnAddress(ForceDeployment calldata _deployment, address _sender) external payable onlySelf { _ensureBytecodeIsKnown(_deployment.bytecodeHash); + // Since the `forceDeployOnAddress` function is called only during upgrades, the Governance is trusted to correctly select + // the addresses to deploy the new bytecodes to and to assess whether overriding the AccountInfo for the "force-deployed" + // contract is acceptable. AccountInfo memory newAccountInfo; newAccountInfo.supportedAAVersion = AccountAbstractionVersion.None; // Accounts have sequential nonces by default. @@ -227,8 +234,23 @@ contract ContractDeployer is IContractDeployer, ISystemContract { false, _deployment.callConstructor ); + } - emit ContractDeployed(_sender, _deployment.bytecodeHash, _deployment.newAddress); + /// @notice The method that is temporarily needed to upgrade the Keccak256 precompile. It is to be removed in the + /// future. Unlike a normal forced deployment, it does not update account information as it requires updating a + /// mapping, and so requires Keccak256 precompile to work already. + /// @dev This method expects the sender (FORCE_DEPLOYER) to provide the correct bytecode hash for the Keccak256 + /// precompile. + function forceDeployKeccak256(bytes32 _keccak256BytecodeHash) external payable onlyCallFrom(FORCE_DEPLOYER) { + _ensureBytecodeIsKnown(_keccak256BytecodeHash); + _constructContract( + msg.sender, + address(KECCAK256_SYSTEM_CONTRACT), + _keccak256BytecodeHash, + msg.data[0:0], + false, + false + ); } /// @notice This method is to be used only during an upgrade to set bytecodes on specific addresses. @@ -236,7 +258,7 @@ contract ContractDeployer is IContractDeployer, ISystemContract { /// by `FORCE_DEPLOYER`. function forceDeployOnAddresses(ForceDeployment[] calldata _deployments) external payable { require( - msg.sender == FORCE_DEPLOYER || msg.sender == address(COMPLEX_UPGRADER_CONTRACT), + msg.sender == FORCE_DEPLOYER || msg.sender == address(COMPLEX_UPGRADER_CONTRACT), "Can only be called by FORCE_DEPLOYER or COMPLEX_UPGRADER_CONTRACT" ); @@ -294,7 +316,6 @@ contract ContractDeployer is IContractDeployer, ISystemContract { _storeAccountInfo(_newAddress, newAccountInfo); _constructContract(msg.sender, _newAddress, _bytecodeHash, _input, false, true); - emit ContractDeployed(msg.sender, _bytecodeHash, _newAddress); } /// @notice Check that bytecode hash is marked as known on the `KnownCodeStorage` system contracts @@ -351,5 +372,7 @@ contract ContractDeployer is IContractDeployer, ISystemContract { // If we do not call the constructor, we need to set the constructed code hash. ACCOUNT_CODE_STORAGE_SYSTEM_CONTRACT.storeAccountConstructedCodeHash(_newAddress, _bytecodeHash); } + + emit ContractDeployed(_sender, _bytecodeHash, _newAddress); } } diff --git a/contracts/DefaultAccount.sol b/contracts/DefaultAccount.sol index 2658947c..2257269d 100644 --- a/contracts/DefaultAccount.sol +++ b/contracts/DefaultAccount.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; import "./interfaces/IAccount.sol"; import "./libraries/TransactionHelper.sol"; @@ -10,6 +10,7 @@ import {BOOTLOADER_FORMAL_ADDRESS, NONCE_HOLDER_SYSTEM_CONTRACT, DEPLOYER_SYSTEM /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice The default implementation of account. * @dev The bytecode of the contract is set by default for all addresses for which no other bytecodes are deployed. * @notice If the caller is not a bootloader always returns empty data on call, just like EOA does. @@ -100,8 +101,6 @@ contract DefaultAccount is IAccount { if (_isValidSignature(txHash, _transaction.signature)) { magic = ACCOUNT_VALIDATION_SUCCESS_MAGIC; - } else { - magic = bytes4(0); } } @@ -218,7 +217,7 @@ contract DefaultAccount is IAccount { _transaction.processPaymasterInput(); } - fallback() external payable { + fallback() external payable ignoreInDelegateCall { // fallback of default account shouldn't be called by bootloader under no circumstances assert(msg.sender != BOOTLOADER_FORMAL_ADDRESS); diff --git a/contracts/EmptyContract.sol b/contracts/EmptyContract.sol index 75b788dc..f0304beb 100644 --- a/contracts/EmptyContract.sol +++ b/contracts/EmptyContract.sol @@ -1,9 +1,10 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice The "empty" contract that is put into some system contracts by default. * @dev The bytecode of the contract is set by default for all addresses for which no other bytecodes are deployed. */ diff --git a/contracts/EventWriter.yul b/contracts/EventWriter.yul index 0a64510d..4cd4a381 100644 --- a/contracts/EventWriter.yul +++ b/contracts/EventWriter.yul @@ -1,11 +1,14 @@ /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice The contract responsible for decoding and writing events using low-level instructions. * @dev The metadata and topics are passed via registers, and the first accessible register contains their number. * The rest of the data is passed via calldata without copying. */ object "EventWriter" { - code { } + code { + return(0, 0) + } object "EventWriter_deployed" { code { //////////////////////////////////////////////////////////////// diff --git a/contracts/ImmutableSimulator.sol b/contracts/ImmutableSimulator.sol index e56f1ce7..a018c92a 100644 --- a/contracts/ImmutableSimulator.sol +++ b/contracts/ImmutableSimulator.sol @@ -1,12 +1,13 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; import "./interfaces/IImmutableSimulator.sol"; import {DEPLOYER_SYSTEM_CONTRACT} from "./Constants.sol"; /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice System smart contract that simulates the behavior of immutable variables in Solidity. * @dev The contract stores the immutable variables created during deployment by other contracts on his storage. * @dev This simulator is needed so that smart contracts with the same Solidity code but different diff --git a/contracts/KnownCodesStorage.sol b/contracts/KnownCodesStorage.sol index b3cb637f..2dda7854 100644 --- a/contracts/KnownCodesStorage.sol +++ b/contracts/KnownCodesStorage.sol @@ -1,39 +1,35 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; -import "./interfaces/IKnownCodesStorage.sol"; -import "./libraries/Utils.sol"; -import "./libraries/SystemContractHelper.sol"; -import {BOOTLOADER_FORMAL_ADDRESS, BYTECODE_COMPRESSOR_CONTRACT} from "./Constants.sol"; +import {IKnownCodesStorage} from "./interfaces/IKnownCodesStorage.sol"; +import {ISystemContract} from "./interfaces/ISystemContract.sol"; +import {Utils} from "./libraries/Utils.sol"; +import {SystemContractHelper} from "./libraries/SystemContractHelper.sol"; +import {COMPRESSOR_CONTRACT, L1_MESSENGER_CONTRACT} from "./Constants.sol"; /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice The storage of this contract will basically serve as a mapping for the known code hashes. * @dev Code hash is not strictly a hash, it's a structure where the first byte denotes the version of the hash, * the second byte denotes whether the contract is constructed, and the next two bytes denote the length in 32-byte words. * words. And then the next 28 bytes is the truncated hash. */ -contract KnownCodesStorage is IKnownCodesStorage { - modifier onlyBootloader() { - require(msg.sender == BOOTLOADER_FORMAL_ADDRESS, "Callable only by the bootloader"); - _; - } - - modifier onlyBytecodeCompressor() { - require(msg.sender == address(BYTECODE_COMPRESSOR_CONTRACT), "Callable only by the bytecode compressor"); +contract KnownCodesStorage is IKnownCodesStorage, ISystemContract { + modifier onlyCompressor() { + require(msg.sender == address(COMPRESSOR_CONTRACT), "Callable only by the compressor"); _; } /// @notice The method that is used by the bootloader to mark several bytecode hashes as known. /// @param _shouldSendToL1 Whether the bytecode should be sent on L1. /// @param _hashes Hashes of the bytecodes to be marked as known. - function markFactoryDeps(bool _shouldSendToL1, bytes32[] calldata _hashes) external onlyBootloader { + function markFactoryDeps(bool _shouldSendToL1, bytes32[] calldata _hashes) external onlyCallFromBootloader { unchecked { uint256 hashesLen = _hashes.length; for (uint256 i = 0; i < hashesLen; ++i) { - uint256 codeLengthInBytes = Utils.bytecodeLenInBytes(_hashes[i]); - _markBytecodeAsPublished(_hashes[i], 0, codeLengthInBytes, _shouldSendToL1); + _markBytecodeAsPublished(_hashes[i], _shouldSendToL1); } } } @@ -41,32 +37,19 @@ contract KnownCodesStorage is IKnownCodesStorage { /// @notice The method used to mark a single bytecode hash as known. /// @dev Only trusted contacts can call this method, currently only the bytecode compressor. /// @param _bytecodeHash The hash of the bytecode that is marked as known. - /// @param _l1PreimageHash The hash of the preimage is be shown on L1 if zero - the full bytecode will be shown. - /// @param _l1PreimageBytesLen The length of the preimage in bytes. - function markBytecodeAsPublished( - bytes32 _bytecodeHash, - bytes32 _l1PreimageHash, - uint256 _l1PreimageBytesLen - ) external onlyBytecodeCompressor { - _markBytecodeAsPublished(_bytecodeHash, _l1PreimageHash, _l1PreimageBytesLen, false); + function markBytecodeAsPublished(bytes32 _bytecodeHash) external onlyCompressor { + _markBytecodeAsPublished(_bytecodeHash, false); } /// @notice The method used to mark a single bytecode hash as known /// @param _bytecodeHash The hash of the bytecode that is marked as known - /// @param _l1PreimageHash The hash of the preimage to be shown on L1 if zero - the full bytecode will be shown - /// @param _l1PreimageBytesLen The length of the preimage in bytes /// @param _shouldSendToL1 Whether the bytecode should be sent on L1 - function _markBytecodeAsPublished( - bytes32 _bytecodeHash, - bytes32 _l1PreimageHash, - uint256 _l1PreimageBytesLen, - bool _shouldSendToL1 - ) internal { + function _markBytecodeAsPublished(bytes32 _bytecodeHash, bool _shouldSendToL1) internal { if (getMarker(_bytecodeHash) == 0) { _validateBytecode(_bytecodeHash); if (_shouldSendToL1) { - _sendBytecodeToL1(_bytecodeHash, _l1PreimageHash, _l1PreimageBytesLen); + L1_MESSENGER_CONTRACT.requestBytecodeL1Publication(_bytecodeHash); } // Save as known, to not resend the log to L1 @@ -78,46 +61,6 @@ contract KnownCodesStorage is IKnownCodesStorage { } } - /// @notice Method used for sending the bytecode (preimage for the bytecode hash) on L1. - /// @dev While bytecode must be visible to L1 observers, it's not necessary to disclose the whole raw bytecode. - /// To achieve this, it's possible to utilize compressed data using a known compression algorithm. Thus, the - /// L1 preimage data may differ from the raw bytecode. - /// @param _bytecodeHash The hash of the bytecode that is marked as known. - /// @param _l1PreimageHash The hash of the preimage to be shown on L1 if zero - the full bytecode will be shown. - /// @param _l1PreimageBytesLen The length of the preimage in bytes. - /// @dev This method sends a single L2->L1 log with the bytecodeHash and l1PreimageHash. It is the responsibility of the L1 - /// smart contracts to make sure that the preimage for this bytecode hash has been shown. - function _sendBytecodeToL1(bytes32 _bytecodeHash, bytes32 _l1PreimageHash, uint256 _l1PreimageBytesLen) internal { - // Burn gas to cover the cost of publishing pubdata on L1 - - // Get the cost of 1 pubdata byte in gas - uint256 meta = SystemContractHelper.getZkSyncMetaBytes(); - uint256 pricePerPubdataByteInGas = SystemContractHelper.getGasPerPubdataByteFromMeta(meta); - - // Calculate how many bytes of calldata will need to be transferred to L1. - // We published the data as ABI-encoded `bytes`, so we pay for: - // - bytecode length in bytes, rounded up to a multiple of 32 (it always is, because of the bytecode format) - // - 32 bytes of encoded offset - // - 32 bytes of encoded length - - uint256 gasToPay = (_l1PreimageBytesLen + 64) * pricePerPubdataByteInGas; - _burnGas(Utils.safeCastToU32(gasToPay)); - - // Send a log to L1 that bytecode should be known. - // L1 smart contract will check the availability of bytecodeHash preimage. - SystemContractHelper.toL1(true, _bytecodeHash, _l1PreimageHash); - } - - /// @notice Method used for burning a certain amount of gas - /// @param _gasToPay The number of gas to burn. - function _burnGas(uint32 _gasToPay) internal view { - bool precompileCallSuccess = SystemContractHelper.precompileCall( - 0, // The precompile parameters are formal ones. We only need the precompile call to burn gas. - _gasToPay - ); - require(precompileCallSuccess, "Failed to charge gas"); - } - /// @notice Returns the marker stored for a bytecode hash. 1 means that the bytecode hash is known /// and can be used for deploying contracts. 0 otherwise. function getMarker(bytes32 _hash) public view override returns (uint256 marker) { diff --git a/contracts/L1Messenger.sol b/contracts/L1Messenger.sol index 00363f14..47ee3265 100644 --- a/contracts/L1Messenger.sol +++ b/contracts/L1Messenger.sol @@ -1,13 +1,17 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; -import "./interfaces/IL1Messenger.sol"; -import "./libraries/SystemContractHelper.sol"; -import "./libraries/EfficientCall.sol"; +import {IL1Messenger, L2ToL1Log, L2_L1_LOGS_TREE_DEFAULT_LEAF_HASH, L2_TO_L1_LOG_SERIALIZE_SIZE, STATE_DIFF_COMPRESSION_VERSION_NUMBER} from "./interfaces/IL1Messenger.sol"; +import {ISystemContract} from "./interfaces/ISystemContract.sol"; +import {SystemContractHelper} from "./libraries/SystemContractHelper.sol"; +import {EfficientCall} from "./libraries/EfficientCall.sol"; +import {Utils} from "./libraries/Utils.sol"; +import {SystemLogKey, SYSTEM_CONTEXT_CONTRACT, KNOWN_CODE_STORAGE_CONTRACT, COMPRESSOR_CONTRACT, STATE_DIFF_ENTRY_SIZE, MAX_ALLOWED_PUBDATA_PER_BATCH, L2_TO_L1_LOGS_MERKLE_TREE_LEAVES} from "./Constants.sol"; /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice Smart contract for sending arbitrary length messages to L1 * @dev by default ZkSync can send fixed length messages on L1. * A fixed length message has 4 parameters `senderAddress` `isService`, `key`, `value`, @@ -18,39 +22,310 @@ import "./libraries/EfficientCall.sol"; * - The contract on L1 accepts all sent messages and if the message came from this system contract * it requires that the preimage of `value` be provided. */ -contract L1Messenger is IL1Messenger { - /// @notice Sends an arbitrary length message to L1. - /// @param _message The variable length message to be sent to L1. - /// @return hash The keccak256 hashed value of the message. +contract L1Messenger is IL1Messenger, ISystemContract { + /// @notice Sequential hash of logs sent in the current block. + /// @dev Will be reset at the end of the block to zero value. + bytes32 internal chainedLogsHash; + + /// @notice Number of logs sent in the current block. + /// @dev Will be reset at the end of the block to zero value. + uint256 internal numberOfLogsToProcess; + + /// @notice Sequential hash of hashes of the messages sent in the current block. + /// @dev Will be reset at the end of the block to zero value. + bytes32 internal chainedMessagesHash; + + /// @notice Sequential hash of bytecode hashes that needs to published + /// according to the current block execution invariant. + /// @dev Will be reset at the end of the block to zero value. + bytes32 internal chainedL1BytecodesRevealDataHash; + + /// The gas cost of processing one keccak256 round. + uint256 internal constant KECCAK_ROUND_GAS_COST = 40; + + /// The number of bytes processed in one keccak256 round. + uint256 internal constant KECCAK_ROUND_NUMBER_OF_BYTES = 136; + + /// The gas cost of calculation of keccak256 of bytes array of such length. + function keccakGasCost(uint256 _length) internal pure returns (uint256) { + return KECCAK_ROUND_GAS_COST * (_length / KECCAK_ROUND_NUMBER_OF_BYTES + 1); + } + + /// The gas cost of processing one sha256 round. + uint256 internal constant SHA256_ROUND_GAS_COST = 7; + + /// The number of bytes processed in one sha256 round. + uint256 internal constant SHA256_ROUND_NUMBER_OF_BYTES = 64; + + /// The gas cost of calculation of sha256 of bytes array of such length. + function sha256GasCost(uint256 _length) internal pure returns (uint256) { + return SHA256_ROUND_GAS_COST * ((_length + 8) / SHA256_ROUND_NUMBER_OF_BYTES + 1); + } + + /// @notice Sends L2ToL1Log. + /// @dev Can be called only by a system contract. + function sendL2ToL1Log( + bool _isService, + bytes32 _key, + bytes32 _value + ) external onlyCallFromSystemContract returns (uint256 logIdInMerkleTree) { + L2ToL1Log memory l2ToL1Log = L2ToL1Log({ + l2ShardId: 0, + isService: _isService, + txNumberInBlock: SYSTEM_CONTEXT_CONTRACT.txNumberInBlock(), + sender: msg.sender, + key: _key, + value: _value + }); + logIdInMerkleTree = _processL2ToL1Log(l2ToL1Log); + + // We need to charge cost of hashing, as it will be used in `publishPubdataAndClearState`: + // - keccakGasCost(L2_TO_L1_LOG_SERIALIZE_SIZE) and keccakGasCost(64) when reconstructing L2ToL1Log + // - at most 1 time keccakGasCost(64) when building the Merkle tree (as merkle tree can contain + // ~2*N nodes, where the first N nodes are leaves the hash of which is calculated on the previous step). + uint256 gasToPay = keccakGasCost(L2_TO_L1_LOG_SERIALIZE_SIZE) + 2 * keccakGasCost(64); + SystemContractHelper.burnGas(Utils.safeCastToU32(gasToPay)); + } + + /// @notice Internal function to send L2ToL1Log. + function _processL2ToL1Log(L2ToL1Log memory _l2ToL1Log) internal returns (uint256 logIdInMerkleTree) { + bytes32 hashedLog = keccak256( + abi.encodePacked( + _l2ToL1Log.l2ShardId, + _l2ToL1Log.isService, + _l2ToL1Log.txNumberInBlock, + _l2ToL1Log.sender, + _l2ToL1Log.key, + _l2ToL1Log.value + ) + ); + + chainedLogsHash = keccak256(abi.encode(chainedLogsHash, hashedLog)); + + logIdInMerkleTree = numberOfLogsToProcess; + numberOfLogsToProcess++; + + emit L2ToL1LogSent(_l2ToL1Log); + } + + /// @notice Public functionality to send messages to L1. function sendToL1(bytes calldata _message) external override returns (bytes32 hash) { + uint256 gasBeforeMessageHashing = gasleft(); hash = EfficientCall.keccak(_message); + uint256 gasSpentOnMessageHashing = gasBeforeMessageHashing - gasleft(); + + /// Store message record + chainedMessagesHash = keccak256(abi.encode(chainedMessagesHash, hash)); + + /// Store log record + L2ToL1Log memory l2ToL1Log = L2ToL1Log({ + l2ShardId: 0, + isService: true, + txNumberInBlock: SYSTEM_CONTEXT_CONTRACT.txNumberInBlock(), + sender: address(this), + key: bytes32(uint256(uint160(msg.sender))), + value: hash + }); + _processL2ToL1Log(l2ToL1Log); // Get cost of one byte pubdata in gas from context. uint256 meta = SystemContractHelper.getZkSyncMetaBytes(); uint32 gasPerPubdataBytes = SystemContractHelper.getGasPerPubdataByteFromMeta(meta); - // Calculate how many bytes of calldata will need to be transferred to L1. - // We published the data as ABI-encoded `bytes`, so we pay for: - // - message length in bytes, rounded up to a multiple of 32 - // - 32 bytes of encoded offset - // - 32 bytes of encoded length + uint256 pubdataLen; + unchecked { + // 4 bytes used to encode the length of the message (see `publishPubdataAndClearState`) + // L2_TO_L1_LOG_SERIALIZE_SIZE bytes used to encode L2ToL1Log + pubdataLen = 4 + _message.length + L2_TO_L1_LOG_SERIALIZE_SIZE; + } + + // We need to charge cost of hashing, as it will be used in `publishPubdataAndClearState`: + // - keccakGasCost(L2_TO_L1_LOG_SERIALIZE_SIZE) and keccakGasCost(64) when reconstructing L2ToL1Log + // - keccakGasCost(64) and gasSpentOnMessageHashing when reconstructing Messages + // - at most 1 time keccakGasCost(64) when building the Merkle tree (as merkle tree can contain + // ~2*N nodes, where the first N nodes are leaves the hash of which is calculated on the previous step). + uint256 gasToPay = pubdataLen * + gasPerPubdataBytes + + keccakGasCost(L2_TO_L1_LOG_SERIALIZE_SIZE) + + 3 * + keccakGasCost(64) + + gasSpentOnMessageHashing; + SystemContractHelper.burnGas(Utils.safeCastToU32(gasToPay)); + + emit L1MessageSent(msg.sender, hash, _message); + } + + /// @dev Can be called only by KnownCodesStorage system contract. + function requestBytecodeL1Publication( + bytes32 _bytecodeHash + ) external override onlyCallFrom(address(KNOWN_CODE_STORAGE_CONTRACT)) { + chainedL1BytecodesRevealDataHash = keccak256(abi.encode(chainedL1BytecodesRevealDataHash, _bytecodeHash)); + + uint256 bytecodeLen = Utils.bytecodeLenInBytes(_bytecodeHash); + + // Get cost of one byte pubdata in gas from context. + uint256 meta = SystemContractHelper.getZkSyncMetaBytes(); + uint32 gasPerPubdataBytes = SystemContractHelper.getGasPerPubdataByteFromMeta(meta); uint256 pubdataLen; unchecked { - pubdataLen = ((_message.length + 31) / 32) * 32 + 64; + // 4 bytes used to encode the length of the bytecode (see `publishPubdataAndClearState`) + pubdataLen = 4 + bytecodeLen; } - uint256 gasToPay = pubdataLen * gasPerPubdataBytes; - // Call precompile to burn gas to cover the cost of publishing pubdata to L1. - uint256 precompileParams = SystemContractHelper.packPrecompileParams(0, 0, 0, 0, 0); - bool precompileCallSuccess = SystemContractHelper.precompileCall( - precompileParams, - Utils.safeCastToU32(gasToPay) + // We need to charge cost of hashing, as it will be used in `publishPubdataAndClearState` + uint256 gasToPay = pubdataLen * gasPerPubdataBytes + sha256GasCost(bytecodeLen) + keccakGasCost(64); + SystemContractHelper.burnGas(Utils.safeCastToU32(gasToPay)); + + emit BytecodeL1PublicationRequested(_bytecodeHash); + } + + /// @notice Verifies that the {_totalL2ToL1PubdataAndStateDiffs} reflects what occurred within the L1Batch and that + /// the compressed statediffs are equivalent to the full state diffs. + /// @param _totalL2ToL1PubdataAndStateDiffs The total pubdata and uncompressed state diffs of transactions that were + /// processed in the current L1 Batch. Pubdata consists of L2 to L1 Logs, messages, deployed bytecode, and state diffs. + /// @dev Function that should be called exactly once per L1 Batch by the bootloader. + /// @dev Checks that totalL2ToL1Pubdata is strictly packed data that should to be published to L1. + /// @dev The data passed in also contains the encoded state diffs to be checked again, however this is aux data that is not + /// part of the committed pubdata. + /// @dev Performs calculation of L2ToL1Logs merkle tree root, "sends" such root and keccak256(totalL2ToL1Pubdata) + /// to L1 using low-level (VM) L2Log. + function publishPubdataAndClearState( + bytes calldata _totalL2ToL1PubdataAndStateDiffs + ) external onlyCallFromBootloader { + uint256 calldataPtr = 0; + + /// Check logs + uint32 numberOfL2ToL1Logs = uint32(bytes4(_totalL2ToL1PubdataAndStateDiffs[calldataPtr:calldataPtr + 4])); + require(numberOfL2ToL1Logs <= L2_TO_L1_LOGS_MERKLE_TREE_LEAVES, "Too many L2->L1 logs"); + calldataPtr += 4; + + bytes32[] memory l2ToL1LogsTreeArray = new bytes32[](L2_TO_L1_LOGS_MERKLE_TREE_LEAVES); + bytes32 reconstructedChainedLogsHash; + for (uint256 i = 0; i < numberOfL2ToL1Logs; ++i) { + bytes32 hashedLog = EfficientCall.keccak( + _totalL2ToL1PubdataAndStateDiffs[calldataPtr:calldataPtr + L2_TO_L1_LOG_SERIALIZE_SIZE] + ); + calldataPtr += L2_TO_L1_LOG_SERIALIZE_SIZE; + l2ToL1LogsTreeArray[i] = hashedLog; + reconstructedChainedLogsHash = keccak256(abi.encode(reconstructedChainedLogsHash, hashedLog)); + } + require( + reconstructedChainedLogsHash == chainedLogsHash, + "reconstructedChainedLogsHash is not equal to chainedLogsHash" ); - require(precompileCallSuccess, "Failed to burn gas"); + for (uint256 i = numberOfL2ToL1Logs; i < L2_TO_L1_LOGS_MERKLE_TREE_LEAVES; ++i) { + l2ToL1LogsTreeArray[i] = L2_L1_LOGS_TREE_DEFAULT_LEAF_HASH; + } + uint256 nodesOnCurrentLevel = L2_TO_L1_LOGS_MERKLE_TREE_LEAVES; + while (nodesOnCurrentLevel > 1) { + nodesOnCurrentLevel /= 2; + for (uint256 i = 0; i < nodesOnCurrentLevel; ++i) { + l2ToL1LogsTreeArray[i] = keccak256( + abi.encode(l2ToL1LogsTreeArray[2 * i], l2ToL1LogsTreeArray[2 * i + 1]) + ); + } + } + bytes32 l2ToL1LogsTreeRoot = l2ToL1LogsTreeArray[0]; - SystemContractHelper.toL1(true, bytes32(uint256(uint160(msg.sender))), hash); + /// Check messages + uint32 numberOfMessages = uint32(bytes4(_totalL2ToL1PubdataAndStateDiffs[calldataPtr:calldataPtr + 4])); + calldataPtr += 4; + bytes32 reconstructedChainedMessagesHash; + for (uint256 i = 0; i < numberOfMessages; ++i) { + uint32 currentMessageLength = uint32(bytes4(_totalL2ToL1PubdataAndStateDiffs[calldataPtr:calldataPtr + 4])); + calldataPtr += 4; + bytes32 hashedMessage = EfficientCall.keccak( + _totalL2ToL1PubdataAndStateDiffs[calldataPtr:calldataPtr + currentMessageLength] + ); + calldataPtr += currentMessageLength; + reconstructedChainedMessagesHash = keccak256(abi.encode(reconstructedChainedMessagesHash, hashedMessage)); + } + require( + reconstructedChainedMessagesHash == chainedMessagesHash, + "reconstructedChainedMessagesHash is not equal to chainedMessagesHash" + ); - emit L1MessageSent(msg.sender, hash, _message); + /// Check bytecodes + uint32 numberOfBytecodes = uint32(bytes4(_totalL2ToL1PubdataAndStateDiffs[calldataPtr:calldataPtr + 4])); + calldataPtr += 4; + bytes32 reconstructedChainedL1BytecodesRevealDataHash; + for (uint256 i = 0; i < numberOfBytecodes; ++i) { + uint32 currentBytecodeLength = uint32( + bytes4(_totalL2ToL1PubdataAndStateDiffs[calldataPtr:calldataPtr + 4]) + ); + calldataPtr += 4; + reconstructedChainedL1BytecodesRevealDataHash = keccak256( + abi.encode( + reconstructedChainedL1BytecodesRevealDataHash, + Utils.hashL2Bytecode( + _totalL2ToL1PubdataAndStateDiffs[calldataPtr:calldataPtr + currentBytecodeLength] + ) + ) + ); + calldataPtr += currentBytecodeLength; + } + require( + reconstructedChainedL1BytecodesRevealDataHash == chainedL1BytecodesRevealDataHash, + "reconstructedChainedL1BytecodesRevealDataHash is not equal to chainedL1BytecodesRevealDataHash" + ); + + /// Check State Diffs + /// encoding is as follows: + /// header (1 byte version, 3 bytes total len of compressed, 1 byte enumeration index size, 2 bytes number of initial writes) + /// body (N bytes of initial writes [32 byte derived key || compressed value], M bytes repeated writes [enumeration index || compressed value]) + /// encoded state diffs: [20bytes address][32bytes key][32bytes derived key][8bytes enum index][32bytes initial value][32bytes final value] + require( + uint256(uint8(bytes1(_totalL2ToL1PubdataAndStateDiffs[calldataPtr]))) == + STATE_DIFF_COMPRESSION_VERSION_NUMBER, + "state diff compression version mismatch" + ); + calldataPtr++; + + uint24 compressedStateDiffSize = uint24(bytes3(_totalL2ToL1PubdataAndStateDiffs[calldataPtr:calldataPtr + 3])); + calldataPtr += 3; + + uint8 enumerationIndexSize = uint8(bytes1(_totalL2ToL1PubdataAndStateDiffs[calldataPtr])); + calldataPtr++; + + bytes calldata compressedStateDiffs = _totalL2ToL1PubdataAndStateDiffs[calldataPtr:calldataPtr + + compressedStateDiffSize]; + calldataPtr += compressedStateDiffSize; + + bytes calldata totalL2ToL1Pubdata = _totalL2ToL1PubdataAndStateDiffs[:calldataPtr]; + + require(calldataPtr <= MAX_ALLOWED_PUBDATA_PER_BATCH, "L1 Messenger pubdata is too long"); + + uint32 numberOfStateDiffs = uint32(bytes4(_totalL2ToL1PubdataAndStateDiffs[calldataPtr:calldataPtr + 4])); + calldataPtr += 4; + + bytes calldata stateDiffs = _totalL2ToL1PubdataAndStateDiffs[calldataPtr:calldataPtr + + (numberOfStateDiffs * STATE_DIFF_ENTRY_SIZE)]; + calldataPtr += numberOfStateDiffs * STATE_DIFF_ENTRY_SIZE; + + bytes32 stateDiffHash = COMPRESSOR_CONTRACT.verifyCompressedStateDiffs( + numberOfStateDiffs, + enumerationIndexSize, + stateDiffs, + compressedStateDiffs + ); + + /// Check for calldata strict format + require(calldataPtr == _totalL2ToL1PubdataAndStateDiffs.length, "Extra data in the totalL2ToL1Pubdata array"); + + /// Native (VM) L2 to L1 log + SystemContractHelper.toL1(true, bytes32(uint256(SystemLogKey.L2_TO_L1_LOGS_TREE_ROOT_KEY)), l2ToL1LogsTreeRoot); + SystemContractHelper.toL1( + true, + bytes32(uint256(SystemLogKey.TOTAL_L2_TO_L1_PUBDATA_KEY)), + EfficientCall.keccak(totalL2ToL1Pubdata) + ); + SystemContractHelper.toL1(true, bytes32(uint256(SystemLogKey.STATE_DIFF_HASH_KEY)), stateDiffHash); + + /// Clear logs state + chainedLogsHash = bytes32(0); + numberOfLogsToProcess = 0; + chainedMessagesHash = bytes32(0); + chainedL1BytecodesRevealDataHash = bytes32(0); } } diff --git a/contracts/L2EthToken.sol b/contracts/L2EthToken.sol index d59a8fb6..fbd63ae2 100644 --- a/contracts/L2EthToken.sol +++ b/contracts/L2EthToken.sol @@ -1,31 +1,27 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; import {IEthToken} from "./interfaces/IEthToken.sol"; +import {ISystemContract} from "./interfaces/ISystemContract.sol"; import {MSG_VALUE_SYSTEM_CONTRACT, DEPLOYER_SYSTEM_CONTRACT, BOOTLOADER_FORMAL_ADDRESS, L1_MESSENGER_CONTRACT} from "./Constants.sol"; -import {SystemContractHelper} from "./libraries/SystemContractHelper.sol"; import {IMailbox} from "./interfaces/IMailbox.sol"; /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice Native ETH contract. * @dev It does NOT provide interfaces for personal interaction with tokens like `transfer`, `approve`, and `transferFrom`. * Instead, this contract is used by the bootloader and `MsgValueSimulator`/`ContractDeployer` system contracts * to perform the balance changes while simulating the `msg.value` Ethereum behavior. */ -contract L2EthToken is IEthToken { +contract L2EthToken is IEthToken, ISystemContract { /// @notice The balances of the users. - mapping(address => uint256) balance; + mapping(address => uint256) internal balance; /// @notice The total amount of tokens that have been minted. uint256 public override totalSupply; - modifier onlyBootloader() { - require(msg.sender == BOOTLOADER_FORMAL_ADDRESS, "Callable only by the bootloader"); - _; - } - /// @notice Transfer tokens from one address to another. /// @param _from The address to transfer the ETH from. /// @param _to The address to transfer the ETH to. @@ -65,7 +61,7 @@ contract L2EthToken is IEthToken { /// @dev This method is only callable by the bootloader. /// @param _account The address which to mint the funds to. /// @param _amount The amount of ETH in wei to be minted. - function mint(address _account, uint256 _amount) external override onlyBootloader { + function mint(address _account, uint256 _amount) external override onlyCallFromBootloader { totalSupply += _amount; balance[_account] += _amount; emit Mint(_account, _amount); diff --git a/contracts/MsgValueSimulator.sol b/contracts/MsgValueSimulator.sol index 5d66c304..07ed23d4 100644 --- a/contracts/MsgValueSimulator.sol +++ b/contracts/MsgValueSimulator.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; import "./libraries/Utils.sol"; import "./libraries/EfficientCall.sol"; @@ -10,6 +10,7 @@ import {MSG_VALUE_SIMULATOR_IS_SYSTEM_BIT, ETH_TOKEN_SYSTEM_CONTRACT} from "./Co /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice The contract responsible for simulating transactions with `msg.value` inside zkEVM. * @dev It accepts value and whether the call should be system in the first extraAbi param and * the address to call in the second extraAbi param, transfers the funds and uses `mimicCall` to continue the diff --git a/contracts/NonceHolder.sol b/contracts/NonceHolder.sol index e74a5664..b2775f1c 100644 --- a/contracts/NonceHolder.sol +++ b/contracts/NonceHolder.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; import "./interfaces/INonceHolder.sol"; import "./interfaces/IContractDeployer.sol"; @@ -9,6 +9,7 @@ import {DEPLOYER_SYSTEM_CONTRACT} from "./Constants.sol"; /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice A contract used for managing nonces for accounts. Together with bootloader, * this contract ensures that the pair (sender, nonce) is always unique, ensuring * unique transaction hashes. @@ -131,8 +132,11 @@ contract NonceHolder is INonceHolder, ISystemContract { /// @notice Increments the deployment nonce for the account and returns the previous one. /// @param _address The address of the account which to return the deploy nonce for. /// @return prevDeploymentNonce The deployment nonce at the time this function is called. - function incrementDeploymentNonce(address _address) external onlySystemCall returns (uint256 prevDeploymentNonce) { - require(msg.sender == address(DEPLOYER_SYSTEM_CONTRACT), ""); + function incrementDeploymentNonce(address _address) external returns (uint256 prevDeploymentNonce) { + require( + msg.sender == address(DEPLOYER_SYSTEM_CONTRACT), + "Only the contract deployer can increment the deployment nonce" + ); uint256 addressAsKey = uint256(uint160(_address)); uint256 oldRawNonce = rawNonces[addressAsKey]; diff --git a/contracts/SystemContext.sol b/contracts/SystemContext.sol index 5d801f34..67f9248e 100644 --- a/contracts/SystemContext.sol +++ b/contracts/SystemContext.sol @@ -1,23 +1,20 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; import {ISystemContext} from "./interfaces/ISystemContext.sol"; +import {ISystemContract} from "./interfaces/ISystemContract.sol"; import {ISystemContextDeprecated} from "./interfaces/ISystemContextDeprecated.sol"; import {SystemContractHelper} from "./libraries/SystemContractHelper.sol"; -import {BOOTLOADER_FORMAL_ADDRESS} from "./Constants.sol"; +import {BOOTLOADER_FORMAL_ADDRESS, SystemLogKey} from "./Constants.sol"; /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice Contract that stores some of the context variables, that may be either * block-scoped, tx-scoped or system-wide. */ -contract SystemContext is ISystemContext, ISystemContextDeprecated { - modifier onlyBootloader() { - require(msg.sender == BOOTLOADER_FORMAL_ADDRESS, "Callable only by the bootloader"); - _; - } - +contract SystemContext is ISystemContext, ISystemContextDeprecated, ISystemContract { /// @notice The number of latest L2 blocks to store. /// @dev EVM requires us to be able to query the hashes of previous 256 blocks. /// We could either: @@ -64,11 +61,11 @@ contract SystemContext is ISystemContext, ISystemContextDeprecated { bytes32 internal currentL2BlockTxsRollingHash; /// @notice The hashes of L2 blocks. - /// @dev It stores block hashes for previous L2 blocks. Note, in order to make publishing the hashes - /// of the miniblocks cheaper, we only store the previous MINIBLOCK_HASHES_TO_STORE ones. Since whenever we need to publish a state + /// @dev It stores block hashes for previous L2 blocks. Note, in order to make publishing the hashes + /// of the miniblocks cheaper, we only store the previous MINIBLOCK_HASHES_TO_STORE ones. Since whenever we need to publish a state /// diff, a pair of is published and for cached keys only 8-byte id is used instead of 32 bytes. /// By having this data in a cyclic array of MINIBLOCK_HASHES_TO_STORE blocks, we bring the costs down by 40% (i.e. 40 bytes per miniblock instead of 64 bytes). - /// @dev The hash of a miniblock with number N would be stored under slot N%MINIBLOCK_HASHES_TO_STORE. + /// @dev The hash of a miniblock with number N would be stored under slot N%MINIBLOCK_HASHES_TO_STORE. /// @dev Hashes of the blocks older than the ones which are stored here can be calculated as _calculateLegacyL2BlockHash(blockNumber). bytes32[MINIBLOCK_HASHES_TO_STORE] internal l2BlockHash; @@ -82,22 +79,25 @@ contract SystemContext is ISystemContext, ISystemContextDeprecated { /// @notice The information about the virtual blocks upgrade, which tracks when the migration to the L2 blocks has started and finished. VirtualBlockUpgradeInfo internal virtualBlockUpgradeInfo; + /// @notice Number of current transaction in block. + uint16 public txNumberInBlock; + /// @notice Set the current tx origin. /// @param _newOrigin The new tx origin. - function setTxOrigin(address _newOrigin) external onlyBootloader { + function setTxOrigin(address _newOrigin) external onlyCallFromBootloader { origin = _newOrigin; } /// @notice Set the the current gas price. /// @param _gasPrice The new tx gasPrice. - function setGasPrice(uint256 _gasPrice) external onlyBootloader { + function setGasPrice(uint256 _gasPrice) external onlyCallFromBootloader { gasPrice = _gasPrice; } /// @notice The method that emulates `blockhash` opcode in EVM. /// @dev Just like the blockhash in the EVM, it returns bytes32(0), /// when queried about hashes that are older than 256 blocks ago. - /// @dev Since zksolc compiler calls this method to emulate `blockhash`, + /// @dev Since zksolc compiler calls this method to emulate `blockhash`, /// its signature can not be changed to `getL2BlockHashEVM`. /// @return hash The blockhash of the block with the given number. function getBlockHashEVM(uint256 _block) external view returns (bytes32 hash) { @@ -107,7 +107,7 @@ contract SystemContext is ISystemContext, ISystemContextDeprecated { // Due to virtual blocks upgrade, we'll have to use the following logic for retreiving the blockhash: // 1. If the block number is out of the 256-block supported range, return 0. - // 2. If the block was created before the upgrade for the virtual blocks (i.e. there we used to use hashes of the batches), + // 2. If the block was created before the upgrade for the virtual blocks (i.e. there we used to use hashes of the batches), // we return the hash of the batch. // 3. If the block was created after the day when the virtual blocks have caught up with the L2 blocks, i.e. // all the information which is returned for users should be for L2 blocks, we return the hash of the corresponding L2 block. @@ -118,11 +118,14 @@ contract SystemContext is ISystemContext, ISystemContextDeprecated { // Note, that we will get into this branch only for a brief moment of time, right after the upgrade // for virtual blocks before 256 virtual blocks are produced. hash = batchHash[_block]; - } else if (_block >= currentVirtualBlockUpgradeInfo.virtualBlockFinishL2Block && currentVirtualBlockUpgradeInfo.virtualBlockFinishL2Block > 0) { + } else if ( + _block >= currentVirtualBlockUpgradeInfo.virtualBlockFinishL2Block && + currentVirtualBlockUpgradeInfo.virtualBlockFinishL2Block > 0 + ) { hash = _getLatest257L2blockHash(_block); } else { - // Important: we do not want this number to ever collide with the L2 block hash (either new or old one) and so - // that's why the legacy L2 blocks' hashes are keccak256(abi.encodePacked(uint32(_block))), while these are equivalent to + // Important: we do not want this number to ever collide with the L2 block hash (either new or old one) and so + // that's why the legacy L2 blocks' hashes are keccak256(abi.encodePacked(uint32(_block))), while these are equivalent to // keccak256(abi.encodePacked(_block)) hash = keccak256(abi.encode(_block)); } @@ -152,7 +155,7 @@ contract SystemContext is ISystemContext, ISystemContextDeprecated { } /// @notice Returns the current L2 block's number. - /// @dev Since zksolc compiler calls this method to emulate `block.number`, + /// @dev Since zksolc compiler calls this method to emulate `block.number`, /// its signature can not be changed to `getL2BlockNumber`. /// @return blockNumber The current L2 block's number. function getBlockNumber() public view returns (uint128) { @@ -160,7 +163,7 @@ contract SystemContext is ISystemContext, ISystemContextDeprecated { } /// @notice Returns the current L2 block's timestamp. - /// @dev Since zksolc compiler calls this method to emulate `block.timestamp`, + /// @dev Since zksolc compiler calls this method to emulate `block.timestamp`, /// its signature can not be changed to `getL2BlockTimestamp`. /// @return timestamp The current L2 block's timestamp. function getBlockTimestamp() public view returns (uint128) { @@ -195,12 +198,10 @@ contract SystemContext is ISystemContext, ISystemContextDeprecated { return keccak256(abi.encode(_blockNumber, _blockTimestamp, _prevL2BlockHash, _blockTxsRollingHash)); } - /// @notice Calculates the legacy block hash of L2 block, which were used before the upgrade where + /// @notice Calculates the legacy block hash of L2 block, which were used before the upgrade where /// the advanced block hashes were introduced. /// @param _blockNumber The number of the L2 block. - function _calculateLegacyL2BlockHash( - uint128 _blockNumber - ) internal pure returns (bytes32) { + function _calculateLegacyL2BlockHash(uint128 _blockNumber) internal pure returns (bytes32) { return keccak256(abi.encodePacked(uint32(_blockNumber))); } @@ -208,25 +209,21 @@ contract SystemContext is ISystemContext, ISystemContextDeprecated { /// @param _l2BlockNumber The number of the new L2 block. /// @param _expectedPrevL2BlockHash The expected hash of the previous L2 block. /// @param _isFirstInBatch Whether this method is called for the first time in the batch. - function _upgradeL2Blocks( - uint128 _l2BlockNumber, - bytes32 _expectedPrevL2BlockHash, - bool _isFirstInBatch - ) internal { + function _upgradeL2Blocks(uint128 _l2BlockNumber, bytes32 _expectedPrevL2BlockHash, bool _isFirstInBatch) internal { require(_isFirstInBatch, "Upgrade transaction must be first"); - + // This is how it will be commonly done in practice, but it will simplify some logic later require(_l2BlockNumber > 0, "L2 block number is never expected to be zero"); - + unchecked { - bytes32 correctPrevBlockHash = _calculateLegacyL2BlockHash(uint128(_l2BlockNumber - 1)); + bytes32 correctPrevBlockHash = _calculateLegacyL2BlockHash(_l2BlockNumber - 1); require(correctPrevBlockHash == _expectedPrevL2BlockHash, "The previous L2 block hash is incorrect"); - // Whenever we'll be queried about the hashes of the blocks before the upgrade, + // Whenever we'll be queried about the hashes of the blocks before the upgrade, // we'll use batches' hashes, so we don't need to store 256 previous hashes. // However, we do need to store the last previous hash in order to be able to correctly calculate the // hash of the new L2 block. - _setL2BlockHash(uint128(_l2BlockNumber - 1), correctPrevBlockHash); + _setL2BlockHash(_l2BlockNumber - 1, correctPrevBlockHash); } } @@ -239,11 +236,11 @@ contract SystemContext is ISystemContext, ISystemContextDeprecated { uint128 _maxVirtualBlocksToCreate, uint128 _newTimestamp ) internal { - if(virtualBlockUpgradeInfo.virtualBlockFinishL2Block != 0) { + if (virtualBlockUpgradeInfo.virtualBlockFinishL2Block != 0) { // No need to to do anything about virtual blocks anymore // All the info is the same as for L2 blocks. currentVirtualL2BlockInfo = currentL2BlockInfo; - return; + return; } BlockInfo memory virtualBlockInfo = currentVirtualL2BlockInfo; @@ -252,7 +249,7 @@ contract SystemContext is ISystemContext, ISystemContextDeprecated { uint128 currentBatchNumber = currentBatchInfo.number; // The virtual block is set for the first time. We can count it as 1 creation of a virtual block. - // Note, that when setting the virtual block number we use the batch number to make a smoother upgrade from batch number to + // Note, that when setting the virtual block number we use the batch number to make a smoother upgrade from batch number to // the L2 block number. virtualBlockInfo.number = currentBatchNumber; // Remembering the batch number on which the upgrade to the virtual blocks has been done. @@ -261,7 +258,7 @@ contract SystemContext is ISystemContext, ISystemContextDeprecated { require(_maxVirtualBlocksToCreate > 0, "Can't initialize the first virtual block"); _maxVirtualBlocksToCreate -= 1; } else if (_maxVirtualBlocksToCreate == 0) { - // The virtual blocks have been already initialized, but the operator didn't ask to create + // The virtual blocks have been already initialized, but the operator didn't ask to create // any new virtual blocks. So we can just return. return; } @@ -271,13 +268,13 @@ contract SystemContext is ISystemContext, ISystemContextDeprecated { // The virtual block number must never exceed the L2 block number. // We do not use a `require` here, since the virtual blocks are a temporary solution to let the Solidity's `block.number` - // catch up with the L2 block number and so the situation where virtualBlockInfo.number starts getting larger + // catch up with the L2 block number and so the situation where virtualBlockInfo.number starts getting larger // than _l2BlockNumber is expected once virtual blocks have caught up the L2 blocks. if (virtualBlockInfo.number >= _l2BlockNumber) { virtualBlockUpgradeInfo.virtualBlockFinishL2Block = _l2BlockNumber; virtualBlockInfo.number = _l2BlockNumber; } - + currentVirtualL2BlockInfo = virtualBlockInfo; } @@ -285,16 +282,9 @@ contract SystemContext is ISystemContext, ISystemContextDeprecated { /// @param _l2BlockNumber The number of the new L2 block. /// @param _l2BlockTimestamp The timestamp of the new L2 block. /// @param _prevL2BlockHash The hash of the previous L2 block. - function _setNewL2BlockData( - uint128 _l2BlockNumber, - uint128 _l2BlockTimestamp, - bytes32 _prevL2BlockHash - ) internal { + function _setNewL2BlockData(uint128 _l2BlockNumber, uint128 _l2BlockTimestamp, bytes32 _prevL2BlockHash) internal { // In the unsafe version we do not check that the block data is correct - currentL2BlockInfo = BlockInfo({ - number: _l2BlockNumber, - timestamp: _l2BlockTimestamp - }); + currentL2BlockInfo = BlockInfo({number: _l2BlockNumber, timestamp: _l2BlockTimestamp}); // It is always assumed in production that _l2BlockNumber > 0 _setL2BlockHash(_l2BlockNumber - 1, _prevL2BlockHash); @@ -305,64 +295,69 @@ contract SystemContext is ISystemContext, ISystemContextDeprecated { /// @notice Sets the current block number and timestamp of the L2 block. /// @dev Called by the bootloader before each transaction. This is needed to ensure - /// that the data about the block is consistent with the sequencer. - /// @dev If the new block number is the same as the current one, we ensure that the block's data is + /// that the data about the block is consistent with the sequencer. + /// @dev If the new block number is the same as the current one, we ensure that the block's data is /// consistent with the one in the current block. - /// @dev If the new block number is greater than the current one by 1, + /// @dev If the new block number is greater than the current one by 1, /// then we ensure that timestamp has increased. - /// @dev If the currently stored number is 0, we assume that it is the first upgrade transaction + /// @dev If the currently stored number is 0, we assume that it is the first upgrade transaction /// and so we will fill up the old data. /// @param _l2BlockNumber The number of the new L2 block. /// @param _l2BlockTimestamp The timestamp of the new L2 block. /// @param _expectedPrevL2BlockHash The expected hash of the previous L2 block. /// @param _isFirstInBatch Whether this method is called for the first time in the batch. /// @param _maxVirtualBlocksToCreate The maximum number of virtual block to create with this L2 block. - /// @dev It is a strict requirement that a new virtual block is created at the start of the batch. + /// @dev It is a strict requirement that a new virtual block is created at the start of the batch. /// @dev It is also enforced that the number of the current virtual L2 block can not exceed the number of the L2 block. function setL2Block( - uint128 _l2BlockNumber, + uint128 _l2BlockNumber, uint128 _l2BlockTimestamp, bytes32 _expectedPrevL2BlockHash, bool _isFirstInBatch, uint128 _maxVirtualBlocksToCreate - ) external onlyBootloader { + ) external onlyCallFromBootloader { // We check that the timestamp of the L2 block is consistent with the timestamp of the batch. - if(_isFirstInBatch) { + if (_isFirstInBatch) { uint128 currentBatchTimestamp = currentBatchInfo.timestamp; - require(_l2BlockTimestamp >= currentBatchTimestamp, "The timestamp of the L2 block must be greater than or equal to the timestamp of the current batch"); + require( + _l2BlockTimestamp >= currentBatchTimestamp, + "The timestamp of the L2 block must be greater than or equal to the timestamp of the current batch" + ); require(_maxVirtualBlocksToCreate > 0, "There must be a virtual block created at the start of the batch"); } (uint128 currentL2BlockNumber, uint128 currentL2BlockTimestamp) = getL2BlockNumberAndTimestamp(); if (currentL2BlockNumber == 0 && currentL2BlockTimestamp == 0) { - // Since currentL2BlockNumber and currentL2BlockTimestamp are zero it means that it is + // Since currentL2BlockNumber and currentL2BlockTimestamp are zero it means that it is // the first ever batch with L2 blocks, so we need to initialize those. - _upgradeL2Blocks( - _l2BlockNumber, - _expectedPrevL2BlockHash, - _isFirstInBatch - ); + _upgradeL2Blocks(_l2BlockNumber, _expectedPrevL2BlockHash, _isFirstInBatch); _setNewL2BlockData(_l2BlockNumber, _l2BlockTimestamp, _expectedPrevL2BlockHash); } else if (currentL2BlockNumber == _l2BlockNumber) { require(!_isFirstInBatch, "Can not reuse L2 block number from the previous batch"); require(currentL2BlockTimestamp == _l2BlockTimestamp, "The timestamp of the same L2 block must be same"); - require(_expectedPrevL2BlockHash == _getLatest257L2blockHash(_l2BlockNumber - 1), "The previous hash of the same L2 block must be same"); + require( + _expectedPrevL2BlockHash == _getLatest257L2blockHash(_l2BlockNumber - 1), + "The previous hash of the same L2 block must be same" + ); require(_maxVirtualBlocksToCreate == 0, "Can not create virtual blocks in the middle of the miniblock"); } else if (currentL2BlockNumber + 1 == _l2BlockNumber) { // From the checks in _upgradeL2Blocks it is known that currentL2BlockNumber can not be 0 bytes32 prevL2BlockHash = _getLatest257L2blockHash(currentL2BlockNumber - 1); bytes32 pendingL2BlockHash = _calculateL2BlockHash( - currentL2BlockNumber, - currentL2BlockTimestamp, - prevL2BlockHash, + currentL2BlockNumber, + currentL2BlockTimestamp, + prevL2BlockHash, currentL2BlockTxsRollingHash ); require(_expectedPrevL2BlockHash == pendingL2BlockHash, "The current L2 block hash is incorrect"); - require(_l2BlockTimestamp > currentL2BlockTimestamp, "The timestamp of the new L2 block must be greater than the timestamp of the previous L2 block"); + require( + _l2BlockTimestamp > currentL2BlockTimestamp, + "The timestamp of the new L2 block must be greater than the timestamp of the previous L2 block" + ); // Since the new block is created, we'll clear out the rolling hash _setNewL2BlockData(_l2BlockNumber, _l2BlockTimestamp, _expectedPrevL2BlockHash); @@ -373,37 +368,39 @@ contract SystemContext is ISystemContext, ISystemContextDeprecated { _setVirtualBlock(_l2BlockNumber, _maxVirtualBlocksToCreate, _l2BlockTimestamp); } + /// @notice Appends the transaction hash to the rolling hash of the current L2 block. + /// @param _txHash The hash of the transaction. + function appendTransactionToCurrentL2Block(bytes32 _txHash) external onlyCallFromBootloader { + currentL2BlockTxsRollingHash = keccak256(abi.encode(currentL2BlockTxsRollingHash, _txHash)); + } + /// @notice Publishes L2->L1 logs needed to verify the validity of this batch on L1. /// @dev Should be called at the end of the current batch. - function publishBatchDataToL1() external onlyBootloader { + function publishTimestampDataToL1() external onlyCallFromBootloader { (uint128 currentBatchNumber, uint128 currentBatchTimestamp) = getBatchNumberAndTimestamp(); (, uint128 currentL2BlockTimestamp) = getL2BlockNumberAndTimestamp(); // The structure of the "setNewBatch" implies that currentBatchNumber > 0, but we still double check it require(currentBatchNumber > 0, "The current batch number must be greater than 0"); - bytes32 prevBatchHash = batchHash[currentBatchNumber - 1]; // In order to spend less pubdata, the packed version is published uint256 packedTimestamps = (uint256(currentBatchTimestamp) << 128) | currentL2BlockTimestamp; - SystemContractHelper.toL1(false, bytes32(packedTimestamps), prevBatchHash); - } - - /// @notice Appends the transaction hash to the rolling hash of the current L2 block. - /// @param _txHash The hash of the transaction. - function appendTransactionToCurrentL2Block( - bytes32 _txHash - ) external onlyBootloader { - currentL2BlockTxsRollingHash = keccak256(abi.encode(currentL2BlockTxsRollingHash, _txHash)); + SystemContractHelper.toL1( + false, + bytes32(uint256(SystemLogKey.PACKED_BATCH_AND_L2_BLOCK_TIMESTAMP_KEY)), + bytes32(packedTimestamps) + ); } /// @notice Ensures that the timestamp of the batch is greater than the timestamp of the last L2 block. /// @param _newTimestamp The timestamp of the new batch. - function _ensureBatchConsistentWithL2Block( - uint128 _newTimestamp - ) internal view { + function _ensureBatchConsistentWithL2Block(uint128 _newTimestamp) internal view { uint128 currentBlockTimestamp = currentL2BlockInfo.timestamp; - require(_newTimestamp > currentBlockTimestamp, "The timestamp of the batch must be greater than the timestamp of the previous block"); + require( + _newTimestamp > currentBlockTimestamp, + "The timestamp of the batch must be greater than the timestamp of the previous block" + ); } /// @notice Increments the current batch number and sets the new timestamp @@ -420,57 +417,66 @@ contract SystemContext is ISystemContext, ISystemContextDeprecated { uint128 _newTimestamp, uint128 _expectedNewNumber, uint256 _baseFee - ) external onlyBootloader { + ) external onlyCallFromBootloader { (uint128 previousBatchNumber, uint128 previousBatchTimestamp) = getBatchNumberAndTimestamp(); require(_newTimestamp > previousBatchTimestamp, "Timestamps should be incremental"); require(previousBatchNumber + 1 == _expectedNewNumber, "The provided block number is not correct"); - + _ensureBatchConsistentWithL2Block(_newTimestamp); batchHash[previousBatchNumber] = _prevBatchHash; // Setting new block number and timestamp - BlockInfo memory newBlockInfo = BlockInfo({ - number: previousBatchNumber + 1, - timestamp: _newTimestamp - }); + BlockInfo memory newBlockInfo = BlockInfo({number: previousBatchNumber + 1, timestamp: _newTimestamp}); currentBatchInfo = newBlockInfo; baseFee = _baseFee; + + // The correctness of this block hash: + SystemContractHelper.toL1(false, bytes32(uint256(SystemLogKey.PREV_BATCH_HASH_KEY)), _prevBatchHash); } /// @notice A testing method that manually sets the current blocks' number and timestamp. /// @dev Should be used only for testing / ethCalls and should never be used in production. - function unsafeOverrideBatch(uint256 _newTimestamp, uint256 _number, uint256 _baseFee) external onlyBootloader { - BlockInfo memory newBlockInfo = BlockInfo({ - number: uint128(_number), - timestamp: uint128(_newTimestamp) - }); + function unsafeOverrideBatch( + uint256 _newTimestamp, + uint256 _number, + uint256 _baseFee + ) external onlyCallFromBootloader { + BlockInfo memory newBlockInfo = BlockInfo({number: uint128(_number), timestamp: uint128(_newTimestamp)}); currentBatchInfo = newBlockInfo; baseFee = _baseFee; } + function incrementTxNumberInBatch() external onlyCallFromBootloader { + txNumberInBlock += 1; + } + + function resetTxNumberInBatch() external onlyCallFromBootloader { + txNumberInBlock = 0; + } + /*////////////////////////////////////////////////////////////// DEPRECATED METHODS //////////////////////////////////////////////////////////////*/ /// @notice Returns the current batch's number and timestamp. - /// @dev Deprecated in favor of getBatchNumberAndTimestamp. + /// @dev Deprecated in favor of getBatchNumberAndTimestamp. function currentBlockInfo() external view returns (uint256 blockInfo) { (uint128 blockNumber, uint128 blockTimestamp) = getBatchNumberAndTimestamp(); - blockInfo = uint256(blockNumber) << 128 | uint256(blockTimestamp); + blockInfo = (uint256(blockNumber) << 128) | uint256(blockTimestamp); } - + /// @notice Returns the current batch's number and timestamp. - /// @dev Deprecated in favor of getBatchNumberAndTimestamp. + /// @dev Deprecated in favor of getBatchNumberAndTimestamp. function getBlockNumberAndTimestamp() external view returns (uint256 blockNumber, uint256 blockTimestamp) { (blockNumber, blockTimestamp) = getBatchNumberAndTimestamp(); } /// @notice Returns the hash of the given batch. - /// @dev Deprecated in favor of getBatchHash. + /// @dev Deprecated in favor of getBatchHash. function blockHash(uint256 _blockNumber) external view returns (bytes32 hash) { hash = batchHash[_blockNumber]; } diff --git a/contracts/interfaces/IAccount.sol b/contracts/interfaces/IAccount.sol index cb54f313..3ee3f616 100644 --- a/contracts/interfaces/IAccount.sol +++ b/contracts/interfaces/IAccount.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; import "../libraries/TransactionHelper.sol"; diff --git a/contracts/interfaces/IAccountCodeStorage.sol b/contracts/interfaces/IAccountCodeStorage.sol index 977e7e16..c266774e 100644 --- a/contracts/interfaces/IAccountCodeStorage.sol +++ b/contracts/interfaces/IAccountCodeStorage.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; interface IAccountCodeStorage { function storeAccountConstructingCodeHash(address _address, bytes32 _hash) external; diff --git a/contracts/interfaces/IBootloaderUtilities.sol b/contracts/interfaces/IBootloaderUtilities.sol index 16cfc7cf..e995295e 100644 --- a/contracts/interfaces/IBootloaderUtilities.sol +++ b/contracts/interfaces/IBootloaderUtilities.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; import "../libraries/TransactionHelper.sol"; diff --git a/contracts/interfaces/IBytecodeCompressor.sol b/contracts/interfaces/IBytecodeCompressor.sol deleted file mode 100644 index 1958f888..00000000 --- a/contracts/interfaces/IBytecodeCompressor.sol +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8.0; - -interface IBytecodeCompressor { - function publishCompressedBytecode( - bytes calldata _bytecode, - bytes calldata _rawCompressedData - ) external payable returns (bytes32 bytecodeHash); -} diff --git a/contracts/interfaces/IComplexUpgrader.sol b/contracts/interfaces/IComplexUpgrader.sol index f535356a..ebc26dd2 100644 --- a/contracts/interfaces/IComplexUpgrader.sol +++ b/contracts/interfaces/IComplexUpgrader.sol @@ -1,10 +1,7 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; interface IComplexUpgrader { - function upgrade( - address _delegateTo, - bytes calldata _calldata - ) external payable; + function upgrade(address _delegateTo, bytes calldata _calldata) external payable; } diff --git a/contracts/interfaces/ICompressor.sol b/contracts/interfaces/ICompressor.sol new file mode 100644 index 00000000..16e02d97 --- /dev/null +++ b/contracts/interfaces/ICompressor.sol @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.20; + +// The bitmask by applying which to the compressed state diff metadata we retrieve its operation. +uint8 constant OPERATION_BITMASK = 7; +// The number of bits shifting the compressed state diff metadata by which we retrieve its length. +uint8 constant LENGTH_BITS_OFFSET = 3; +// The maximal length in bytes that an enumeration index can have. +uint8 constant MAX_ENUMERATION_INDEX_SIZE = 8; + +interface ICompressor { + function publishCompressedBytecode( + bytes calldata _bytecode, + bytes calldata _rawCompressedData + ) external payable returns (bytes32 bytecodeHash); + + function verifyCompressedStateDiffs( + uint256 _numberOfStateDiffs, + uint256 _enumerationIndexSize, + bytes calldata _stateDiffs, + bytes calldata _compressedStateDiffs + ) external payable returns (bytes32 stateDiffHash); +} diff --git a/contracts/interfaces/IContractDeployer.sol b/contracts/interfaces/IContractDeployer.sol index d21b917d..3f84672d 100644 --- a/contracts/interfaces/IContractDeployer.sol +++ b/contracts/interfaces/IContractDeployer.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; interface IContractDeployer { /// @notice Defines the version of the account abstraction protocol diff --git a/contracts/interfaces/IEthToken.sol b/contracts/interfaces/IEthToken.sol index 5543d931..ec9b399f 100644 --- a/contracts/interfaces/IEthToken.sol +++ b/contracts/interfaces/IEthToken.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; interface IEthToken { function balanceOf(uint256) external view returns (uint256); diff --git a/contracts/interfaces/IImmutableSimulator.sol b/contracts/interfaces/IImmutableSimulator.sol index 650f47d8..d30ac9b9 100644 --- a/contracts/interfaces/IImmutableSimulator.sol +++ b/contracts/interfaces/IImmutableSimulator.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; struct ImmutableData { uint256 index; diff --git a/contracts/interfaces/IKnownCodesStorage.sol b/contracts/interfaces/IKnownCodesStorage.sol index c56327ad..b5a783ba 100644 --- a/contracts/interfaces/IKnownCodesStorage.sol +++ b/contracts/interfaces/IKnownCodesStorage.sol @@ -1,17 +1,13 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; interface IKnownCodesStorage { event MarkedAsKnown(bytes32 indexed bytecodeHash, bool indexed sendBytecodeToL1); function markFactoryDeps(bool _shouldSendToL1, bytes32[] calldata _hashes) external; - function markBytecodeAsPublished( - bytes32 _bytecodeHash, - bytes32 _l1PreimageHash, - uint256 _l1PreimageBytesLen - ) external; + function markBytecodeAsPublished(bytes32 _bytecodeHash) external; function getMarker(bytes32 _hash) external view returns (uint256); } diff --git a/contracts/interfaces/IL1Messenger.sol b/contracts/interfaces/IL1Messenger.sol index fbf57e53..ab6a670f 100644 --- a/contracts/interfaces/IL1Messenger.sol +++ b/contracts/interfaces/IL1Messenger.sol @@ -1,11 +1,50 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; + +/// @dev The log passed from L2 +/// @param l2ShardId The shard identifier, 0 - rollup, 1 - porter. All other values are not used but are reserved for the future +/// @param isService A boolean flag that is part of the log along with `key`, `value`, and `sender` address. +/// This field is required formally but does not have any special meaning. +/// @param txNumberInBlock The L2 transaction number in a block, in which the log was sent +/// @param sender The L2 address which sent the log +/// @param key The 32 bytes of information that was sent in the log +/// @param value The 32 bytes of information that was sent in the log +// Both `key` and `value` are arbitrary 32-bytes selected by the log sender +struct L2ToL1Log { + uint8 l2ShardId; + bool isService; + uint16 txNumberInBlock; + address sender; + bytes32 key; + bytes32 value; +} + +/// @dev Bytes in raw L2 to L1 log +/// @dev Equal to the bytes size of the tuple - (uint8 ShardId, bool isService, uint16 txNumberInBlock, address sender, bytes32 key, bytes32 value) +uint256 constant L2_TO_L1_LOG_SERIALIZE_SIZE = 88; + +/// @dev The value of default leaf hash for L2 to L1 logs Merkle tree +/// @dev An incomplete fixed-size tree is filled with this value to be a full binary tree +/// @dev Actually equal to the `keccak256(new bytes(L2_TO_L1_LOG_SERIALIZE_SIZE))` +bytes32 constant L2_L1_LOGS_TREE_DEFAULT_LEAF_HASH = 0x72abee45b59e344af8a6e520241c4744aff26ed411f4c4b00f8af09adada43ba; + +/// @dev The current version of state diff compression being used. +uint256 constant STATE_DIFF_COMPRESSION_VERSION_NUMBER = 1; interface IL1Messenger { // Possibly in the future we will be able to track the messages sent to L1 with // some hooks in the VM. For now, it is much easier to track them with L2 events. event L1MessageSent(address indexed _sender, bytes32 indexed _hash, bytes _message); + event L2ToL1LogSent(L2ToL1Log _l2log); + + event BytecodeL1PublicationRequested(bytes32 _bytecodeHash); + function sendToL1(bytes memory _message) external returns (bytes32); + + function sendL2ToL1Log(bool _isService, bytes32 _key, bytes32 _value) external returns (uint256 logIdInMerkleTree); + + // This function is expected to be called only by the KnownCodesStorage system contract + function requestBytecodeL1Publication(bytes32 _bytecodeHash) external; } diff --git a/contracts/interfaces/IL2StandardToken.sol b/contracts/interfaces/IL2StandardToken.sol index 5edb43c2..3d75c8ed 100644 --- a/contracts/interfaces/IL2StandardToken.sol +++ b/contracts/interfaces/IL2StandardToken.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; interface IL2StandardToken { event BridgeMint(address indexed _account, uint256 _amount); diff --git a/contracts/interfaces/IMailbox.sol b/contracts/interfaces/IMailbox.sol index f362f639..ba673058 100644 --- a/contracts/interfaces/IMailbox.sol +++ b/contracts/interfaces/IMailbox.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; interface IMailbox { function finalizeEthWithdrawal( - uint256 _l2BlockNumber, + uint256 _l2BatchNumber, uint256 _l2MessageIndex, uint16 _l2TxNumberInBlock, bytes calldata _message, diff --git a/contracts/interfaces/INonceHolder.sol b/contracts/interfaces/INonceHolder.sol index ebddfb04..1213fbea 100644 --- a/contracts/interfaces/INonceHolder.sol +++ b/contracts/interfaces/INonceHolder.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; /** * @author Matter Labs diff --git a/contracts/interfaces/IPaymaster.sol b/contracts/interfaces/IPaymaster.sol index cc151935..928f19ed 100644 --- a/contracts/interfaces/IPaymaster.sol +++ b/contracts/interfaces/IPaymaster.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; import "../libraries/TransactionHelper.sol"; diff --git a/contracts/interfaces/IPaymasterFlow.sol b/contracts/interfaces/IPaymasterFlow.sol index dc1b849f..59352f23 100644 --- a/contracts/interfaces/IPaymasterFlow.sol +++ b/contracts/interfaces/IPaymasterFlow.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; /** * @author Matter Labs diff --git a/contracts/interfaces/ISystemContext.sol b/contracts/interfaces/ISystemContext.sol index 6bc4476b..d8a98292 100644 --- a/contracts/interfaces/ISystemContext.sol +++ b/contracts/interfaces/ISystemContext.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; /** * @author Matter Labs @@ -16,11 +16,10 @@ interface ISystemContext { /// @notice A structure representing the timeline for the upgrade from the batch numbers to the L2 block numbers. /// @dev It will used for the L1 batch -> L2 block migration in Q3 2023 only. struct VirtualBlockUpgradeInfo { - /// @notice In order to maintain consistent results for `blockhash` requests, we'll + /// @notice In order to maintain consistent results for `blockhash` requests, we'll /// have to remember the number of the batch when the upgrade to the virtual blocks has been done. /// The hashes for virtual blocks before the upgrade are identical to the hashes of the corresponding batches. uint128 virtualBlockStartBatch; - /// @notice L2 block when the virtual blocks have caught up with the L2 blocks. Starting from this block, /// all the information returned to users for block.timestamp/number, etc should be the information about the L2 blocks and /// not virtual blocks. @@ -41,6 +40,8 @@ interface ISystemContext { function baseFee() external view returns (uint256); + function txNumberInBlock() external view returns (uint16); + function getBlockHashEVM(uint256 _block) external view returns (bytes32); function getBatchHash(uint256 _batchNumber) external view returns (bytes32 hash); diff --git a/contracts/interfaces/ISystemContextDeprecated.sol b/contracts/interfaces/ISystemContextDeprecated.sol index 40ead86d..b51faeed 100644 --- a/contracts/interfaces/ISystemContextDeprecated.sol +++ b/contracts/interfaces/ISystemContextDeprecated.sol @@ -1,13 +1,13 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; /** * @author Matter Labs * @notice The interface with deprecated functions of the SystemContext contract. It is aimed for backward compatibility. */ interface ISystemContextDeprecated { - function currentBlockInfo() external view returns(uint256); + function currentBlockInfo() external view returns (uint256); function getBlockNumberAndTimestamp() external view returns (uint256 blockNumber, uint256 blockTimestamp); diff --git a/contracts/interfaces/ISystemContract.sol b/contracts/interfaces/ISystemContract.sol index 66c8565f..c486abc9 100644 --- a/contracts/interfaces/ISystemContract.sol +++ b/contracts/interfaces/ISystemContract.sol @@ -1,19 +1,46 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; import {SystemContractHelper} from "../libraries/SystemContractHelper.sol"; +import {BOOTLOADER_FORMAL_ADDRESS} from "../Constants.sol"; /// @dev Solidity does not allow exporting modifiers via libraries, so /// the only way to do reuse modifiers is to have a base contract +/// @dev Never add storage variables into this contract as some +/// system contracts rely on this abstract contract as on interface! abstract contract ISystemContract { /// @notice Modifier that makes sure that the method /// can only be called via a system call. modifier onlySystemCall() { require( SystemContractHelper.isSystemCall() || SystemContractHelper.isSystemContract(msg.sender), - "This method requires the system call flag" + "This method require system call flag" ); _; } + + /// @notice Modifier that makes sure that the method + /// can only be called from a system contract. + modifier onlyCallFromSystemContract() { + require( + SystemContractHelper.isSystemContract(msg.sender), + "This method require the caller to be system contract" + ); + _; + } + + /// @notice Modifier that makes sure that the method + /// can only be called from a special given address. + modifier onlyCallFrom(address caller) { + require(msg.sender == caller, "Inappropriate caller"); + _; + } + + /// @notice Modifier that makes sure that the method + /// can only be called from the bootloader. + modifier onlyCallFromBootloader() { + require(msg.sender == BOOTLOADER_FORMAL_ADDRESS, "Callable only by the bootloader"); + _; + } } diff --git a/contracts/libraries/EfficientCall.sol b/contracts/libraries/EfficientCall.sol index 2983a518..22801d6f 100644 --- a/contracts/libraries/EfficientCall.sol +++ b/contracts/libraries/EfficientCall.sol @@ -1,13 +1,14 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; import "./SystemContractHelper.sol"; import "./Utils.sol"; -import {SHA256_SYSTEM_CONTRACT, KECCAK256_SYSTEM_CONTRACT} from "../Constants.sol"; +import {SHA256_SYSTEM_CONTRACT, KECCAK256_SYSTEM_CONTRACT, MSG_VALUE_SYSTEM_CONTRACT} from "../Constants.sol"; /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice This library is used to perform ultra-efficient calls using zkEVM-specific features. * @dev EVM calls always accept a memory slice as input and return a memory slice as output. * Therefore, even if the user has a ready-made calldata slice, they still need to copy it to memory @@ -249,24 +250,17 @@ library EfficientCall { ) private view { SystemContractHelper.loadCalldataIntoActivePtr(); - // Currently, zkEVM considers the pointer valid if(ptr.offset < ptr.length || (ptr.length == 0 && ptr.offset == 0)), otherwise panics. - // So, if the data is empty we need to make the `ptr.length = ptr.offset = 0`, otherwise follow standard logic. - if (_data.length == 0) { - // Safe to cast, offset is never bigger than `type(uint32).max` - SystemContractHelper.ptrShrinkIntoActive(uint32(msg.data.length)); - } else { - uint256 dataOffset; - assembly { - dataOffset := _data.offset - } - - // Safe to cast, offset is never bigger than `type(uint32).max` - SystemContractHelper.ptrAddIntoActive(uint32(dataOffset)); - // Safe to cast, `data.length` is never bigger than `type(uint32).max` - uint32 shrinkTo = uint32(msg.data.length - (_data.length + dataOffset)); - SystemContractHelper.ptrShrinkIntoActive(shrinkTo); + uint256 dataOffset; + assembly { + dataOffset := _data.offset } + // Safe to cast, offset is never bigger than `type(uint32).max` + SystemContractHelper.ptrAddIntoActive(uint32(dataOffset)); + // Safe to cast, `data.length` is never bigger than `type(uint32).max` + uint32 shrinkTo = uint32(msg.data.length - (_data.length + dataOffset)); + SystemContractHelper.ptrShrinkIntoActive(shrinkTo); + uint32 gas = Utils.safeCastToU32(_gas); uint256 farCallAbi = SystemContractsCaller.getFarCallABIWithEmptyFatPointer( gas, diff --git a/contracts/libraries/RLPEncoder.sol b/contracts/libraries/RLPEncoder.sol index ddef39ab..8e32ea9b 100644 --- a/contracts/libraries/RLPEncoder.sol +++ b/contracts/libraries/RLPEncoder.sol @@ -1,7 +1,12 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; +/** + * @author Matter Labs + * @custom:security-contact security@matterlabs.dev + * @notice This library provides RLP encoding functionality. + */ library RLPEncoder { function encodeAddress(address _val) internal pure returns (bytes memory encoded) { // The size is equal to 20 bytes of the address itself + 1 for encoding bytes length in RLP. diff --git a/contracts/libraries/SystemContractHelper.sol b/contracts/libraries/SystemContractHelper.sol index 68a8e37c..a66b9670 100644 --- a/contracts/libraries/SystemContractHelper.sol +++ b/contracts/libraries/SystemContractHelper.sol @@ -1,10 +1,10 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8; +pragma solidity 0.8.20; import {MAX_SYSTEM_CONTRACT_ADDRESS} from "../Constants.sol"; -import "./SystemContractsCaller.sol"; +import {SystemContractsCaller, CalldataForwardingMode, CALLFLAGS_CALL_ADDRESS, CODE_ADDRESS_CALL_ADDRESS, EVENT_WRITE_ADDRESS, EVENT_INITIALIZE_ADDRESS, GET_EXTRA_ABI_DATA_ADDRESS, LOAD_CALLDATA_INTO_ACTIVE_PTR_CALL_ADDRESS, META_CODE_SHARD_ID_OFFSET, META_CALLER_SHARD_ID_OFFSET, META_SHARD_ID_OFFSET, META_AUX_HEAP_SIZE_OFFSET, META_HEAP_SIZE_OFFSET, META_GAS_PER_PUBDATA_BYTE_OFFSET, MIMIC_CALL_BY_REF_CALL_ADDRESS, META_CALL_ADDRESS, MSG_VALUE_SIMULATOR_IS_SYSTEM_BIT, PTR_CALLDATA_CALL_ADDRESS, PTR_ADD_INTO_ACTIVE_CALL_ADDRESS, PTR_SHRINK_INTO_ACTIVE_CALL_ADDRESS, PTR_PACK_INTO_ACTIVE_CALL_ADDRESS, RAW_FAR_CALL_BY_REF_CALL_ADDRESS, PRECOMPILE_CALL_ADDRESS, SET_CONTEXT_VALUE_CALL_ADDRESS, SYSTEM_CALL_BY_REF_CALL_ADDRESS, TO_L1_CALL_ADDRESS} from "./SystemContractsCaller.sol"; uint256 constant UINT32_MASK = 0xffffffff; uint256 constant UINT128_MASK = 0xffffffffffffffffffffffffffffffff; @@ -31,6 +31,7 @@ enum Global { /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice Library used for accessing zkEVM-specific opcodes, needed for the development * of system contracts. * @dev While this library will be eventually available to public, some of the provided @@ -143,12 +144,10 @@ library SystemContractHelper { /// NOTE: The precompile type depends on `this` which calls precompile, which means that only /// system contracts corresponding to the list of precompiles above can do `precompileCall`. /// @dev If used not in the `sha256`, `keccak256` or `ecrecover` contracts, it will just burn the gas provided. - function precompileCall(uint256 _rawParams, uint32 _gasToBurn) internal view returns (bool success) { + /// @dev This method is `unsafe` because it does not check whether there is enough gas to burn. + function unsafePrecompileCall(uint256 _rawParams, uint32 _gasToBurn) internal view returns (bool success) { address callAddr = PRECOMPILE_CALL_ADDRESS; - // After `precompileCall` gas will be burned down to 0 if there are not enough of them, - // thats why it should be checked before the call. - require(gasleft() >= _gasToBurn); uint256 cleanupMask = UINT32_MASK; assembly { // Clearing input params as they are not cleaned by Solidity by default @@ -271,6 +270,8 @@ library SystemContractHelper { function getZkSyncMeta() internal view returns (ZkSyncMeta memory meta) { uint256 metaPacked = getZkSyncMetaBytes(); meta.gasPerPubdataByte = getGasPerPubdataByteFromMeta(metaPacked); + meta.heapSize = getHeapSizeFromMeta(metaPacked); + meta.auxHeapSize = getAuxHeapSizeFromMeta(metaPacked); meta.shardId = getShardIdFromMeta(metaPacked); meta.callerShardId = getCallerShardIdFromMeta(metaPacked); meta.codeShardId = getCodeShardIdFromMeta(metaPacked); @@ -328,4 +329,14 @@ library SystemContractHelper { function isSystemContract(address _address) internal pure returns (bool) { return uint160(_address) <= uint160(MAX_SYSTEM_CONTRACT_ADDRESS); } + + /// @notice Method used for burning a certain amount of gas. + /// @param _gasToPay The number of gas to burn. + function burnGas(uint32 _gasToPay) internal view { + bool precompileCallSuccess = unsafePrecompileCall( + 0, // The precompile parameters are formal ones. We only need the precompile call to burn gas. + _gasToPay + ); + require(precompileCallSuccess, "Failed to charge gas"); + } } diff --git a/contracts/libraries/SystemContractsCaller.sol b/contracts/libraries/SystemContractsCaller.sol index 594b5b3f..7be17992 100644 --- a/contracts/libraries/SystemContractsCaller.sol +++ b/contracts/libraries/SystemContractsCaller.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8; +pragma solidity 0.8.20; import {MSG_VALUE_SYSTEM_CONTRACT, MSG_VALUE_SIMULATOR_IS_SYSTEM_BIT} from "../Constants.sol"; import "./Utils.sol"; @@ -61,6 +61,7 @@ enum CalldataForwardingMode { /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice A library that allows calling contracts with the `isSystem` flag. * @dev It is needed to call ContractDeployer and NonceHolder. */ diff --git a/contracts/libraries/TransactionHelper.sol b/contracts/libraries/TransactionHelper.sol index 5d5cc6cf..e0578197 100644 --- a/contracts/libraries/TransactionHelper.sol +++ b/contracts/libraries/TransactionHelper.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; import "../openzeppelin/token/ERC20/IERC20.sol"; import "../openzeppelin/token/ERC20/utils/SafeERC20.sol"; @@ -72,6 +72,7 @@ struct Transaction { /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice Library is used to help custom accounts to work with common methods for the Transaction type. */ library TransactionHelper { diff --git a/contracts/libraries/UnsafeBytesCalldata.sol b/contracts/libraries/UnsafeBytesCalldata.sol index ff265fbd..4ce65f5f 100644 --- a/contracts/libraries/UnsafeBytesCalldata.sol +++ b/contracts/libraries/UnsafeBytesCalldata.sol @@ -1,9 +1,10 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @dev The library provides a set of functions that help read data from calldata bytes. * @dev Each of the functions accepts the `bytes calldata` and the offset where data should be read and returns a value of a certain type. * @@ -22,10 +23,29 @@ library UnsafeBytesCalldata { } } + function readUint32(bytes calldata _bytes, uint256 _start) internal pure returns (uint32 result) { + assembly { + let offset := sub(_bytes.offset, 28) + result := calldataload(add(offset, _start)) + } + } + function readUint64(bytes calldata _bytes, uint256 _start) internal pure returns (uint64 result) { assembly { let offset := sub(_bytes.offset, 24) result := calldataload(add(offset, _start)) } } + + function readBytes32(bytes calldata _bytes, uint256 _start) internal pure returns (bytes32 result) { + assembly { + result := calldataload(add(_bytes.offset, _start)) + } + } + + function readUint256(bytes calldata _bytes, uint256 _start) internal pure returns (uint256 result) { + assembly { + result := calldataload(add(_bytes.offset, _start)) + } + } } diff --git a/contracts/libraries/Utils.sol b/contracts/libraries/Utils.sol index d1f219de..a2791520 100644 --- a/contracts/libraries/Utils.sol +++ b/contracts/libraries/Utils.sol @@ -1,10 +1,11 @@ // SPDX-License-Identifier: MIT -pragma solidity >=0.8.0; +pragma solidity 0.8.20; import "./EfficientCall.sol"; /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @dev Common utilities used in zkSync system contracts */ library Utils { @@ -82,15 +83,15 @@ library Utils { // Note that the length of the bytecode must be provided in 32-byte words. require(_bytecode.length % 32 == 0, "po"); - uint256 bytecodeLenInWords = _bytecode.length / 32; - require(bytecodeLenInWords < 2 ** 16, "pp"); // bytecode length must be less than 2^16 words - require(bytecodeLenInWords % 2 == 1, "pr"); // bytecode length in words must be odd + uint256 lengthInWords = _bytecode.length / 32; + require(lengthInWords < 2 ** 16, "pp"); // bytecode length must be less than 2^16 words + require(lengthInWords % 2 == 1, "pr"); // bytecode length in words must be odd hashedBytecode = EfficientCall.sha(_bytecode) & 0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; // Setting the version of the hash hashedBytecode = (hashedBytecode | bytes32(uint256(1 << 248))); // Setting the length - hashedBytecode = hashedBytecode | bytes32(bytecodeLenInWords << 224); + hashedBytecode = hashedBytecode | bytes32(lengthInWords << 224); } } diff --git a/contracts/precompiles/EcAdd.yul b/contracts/precompiles/EcAdd.yul new file mode 100644 index 00000000..bfbac645 --- /dev/null +++ b/contracts/precompiles/EcAdd.yul @@ -0,0 +1,441 @@ +object "EcAdd" { + code { + return(0, 0) + } + object "EcAdd_deployed" { + code { + //////////////////////////////////////////////////////////////// + // CONSTANTS + //////////////////////////////////////////////////////////////// + + /// @notice Constant function for value three in Montgomery form. + /// @dev This value was precomputed using Python. + /// @return m_three The value three in Montgomery form. + function MONTGOMERY_THREE() -> m_three { + m_three := 19052624634359457937016868847204597229365286637454337178037183604060995791063 + } + + /// @notice Constant function for the alt_bn128 field order. + /// @dev See https://eips.ethereum.org/EIPS/eip-196 for further details. + /// @return ret The alt_bn128 field order. + function P() -> ret { + ret := 21888242871839275222246405745257275088696311157297823662689037894645226208583 + } + + /// @notice Constant function for the pre-computation of R^2 % N for the Montgomery REDC algorithm. + /// @dev R^2 is the Montgomery residue of the value 2^512. + /// @dev See https://en.wikipedia.org/wiki/Montgomery_modular_multiplication#The_REDC_algorithm for further detals. + /// @dev This value was precomputed using Python. + /// @return ret The value R^2 modulus the curve field order. + function R2_MOD_P() -> ret { + ret := 3096616502983703923843567936837374451735540968419076528771170197431451843209 + } + + /// @notice Constant function for the pre-computation of N' for the Montgomery REDC algorithm. + /// @dev N' is a value such that NN' = -1 mod R, with N being the curve field order. + /// @dev See https://en.wikipedia.org/wiki/Montgomery_modular_multiplication#The_REDC_algorithm for further detals. + /// @dev This value was precomputed using Python. + /// @return ret The value N'. + function N_PRIME() -> ret { + ret := 111032442853175714102588374283752698368366046808579839647964533820976443843465 + } + + ////////////////////////////////////////////////////////////////// + // HELPER FUNCTIONS + ////////////////////////////////////////////////////////////////// + + /// @dev Executes the `precompileCall` opcode. + function precompileCall(precompileParams, gasToBurn) -> ret { + // Compiler simulation for calling `precompileCall` opcode + ret := verbatim_2i_1o("precompile", precompileParams, gasToBurn) + } + + /// @notice Burns remaining gas until revert. + /// @dev This function is used to burn gas in the case of a failed precompile call. + function burnGas() { + // Precompiles that do not have a circuit counterpart + // will burn the provided gas by calling this function. + precompileCall(0, gas()) + } + + /// @notice Retrieves the highest half of the multiplication result. + /// @param multiplicand The value to multiply. + /// @param multiplier The multiplier. + /// @return ret The highest half of the multiplication result. + function getHighestHalfOfMultiplication(multiplicand, multiplier) -> ret { + ret := verbatim_2i_1o("mul_high", multiplicand, multiplier) + } + + /// @notice Computes the modular subtraction of two values. + /// @param minuend The value to subtract from. + /// @param subtrahend The value to subtract. + /// @param modulus The modulus. + /// @return difference The modular subtraction of the two values. + function submod(minuend, subtrahend, modulus) -> difference { + difference := addmod(minuend, sub(modulus, subtrahend), modulus) + } + + /// @notice Computes an addition and checks for overflow. + /// @param augend The value to add to. + /// @param addend The value to add. + /// @return sum The sum of the two values. + /// @return overflowed True if the addition overflowed, false otherwise. + function overflowingAdd(augend, addend) -> sum, overflowed { + sum := add(augend, addend) + overflowed := lt(sum, augend) + } + + // @notice Checks if a point is on the curve. + // @dev The curve in question is the alt_bn128 curve. + // @dev The Short Weierstrass equation of the curve is y^2 = x^3 + 3. + // @param x The x coordinate of the point in Montgomery form. + // @param y The y coordinate of the point in Montgomery form. + // @return ret True if the point is on the curve, false otherwise. + function pointIsInCurve(x, y) -> ret { + let ySquared := montgomeryMul(y, y) + let xSquared := montgomeryMul(x, x) + let xQubed := montgomeryMul(xSquared, x) + let xQubedPlusThree := montgomeryAdd(xQubed, MONTGOMERY_THREE()) + + ret := eq(ySquared, xQubedPlusThree) + } + + /// @notice Checks if a point is the point at infinity. + /// @dev The point at infinity is defined as the point (0, 0). + /// @dev See https://eips.ethereum.org/EIPS/eip-196 for further details. + /// @param x The x coordinate of the point. + /// @param y The y coordinate of the point. + /// @return ret True if the point is the point at infinity, false otherwise. + function isInfinity(x, y) -> ret { + ret := iszero(or(x, y)) + } + + /// @notice Checks if a coordinate is on the curve field order. + /// @dev A coordinate is on the curve field order if it is on the range [0, curveFieldOrder). + /// @dev This check is required in the precompile specification. See https://eips.ethereum.org/EIPS/eip-196 for further details. + /// @param coordinate The coordinate to check. + /// @return ret True if the coordinate is in the range, false otherwise. + function isOnFieldOrder(coordinate) -> ret { + ret := lt(coordinate, P()) + } + + /// @notice Computes the inverse in Montgomery Form of a number in Montgomery Form. + /// @dev Reference: https://github.com/lambdaclass/lambdaworks/blob/main/math/src/field/fields/montgomery_backed_prime_fields.rs#L169 + /// @dev Let `base` be a number in Montgomery Form, then base = a*R mod P() being `a` the base number (not in Montgomery Form) + /// @dev Let `inv` be the inverse of a number `a` in Montgomery Form, then inv = a^(-1)*R mod P() + /// @dev The original binary extended euclidean algorithms takes a number a and returns a^(-1) mod N + /// @dev In our case N is P(), and we'd like the input and output to be in Montgomery Form (a*R mod P() + /// @dev and a^(-1)*R mod P() respectively). + /// @dev If we just pass the input as a number in Montgomery Form the result would be a^(-1)*R^(-1) mod P(), + /// @dev but we want it to be a^(-1)*R mod P(). + /// @dev For that, we take advantage of the algorithm's linearity and multiply the result by R^2 mod P() + /// @dev to get R^2*a^(-1)*R^(-1) mod P() = a^(-1)*R mod P() as the desired result in Montgomery Form. + /// @dev `inv` takes the value of `b` or `c` being the result sometimes `b` and sometimes `c`. In paper + /// @dev multiplying `b` or `c` by R^2 mod P() results on starting their values as b = R2_MOD_P() and c = 0. + /// @param base A number `a` in Montgomery Form, then base = a*R mod P(). + /// @return inv The inverse of a number `a` in Montgomery Form, then inv = a^(-1)*R mod P(). + function binaryExtendedEuclideanAlgorithm(base) -> inv { + let modulus := P() + let u := base + let v := modulus + // Avoids unnecessary reduction step. + let b := R2_MOD_P() + let c := 0 + + for {} and(iszero(eq(u, 1)), iszero(eq(v, 1))) {} { + for {} iszero(and(u, 1)) {} { + u := shr(1, u) + let current := b + switch and(current, 1) + case 0 { + b := shr(1, b) + } + case 1 { + b := shr(1, add(b, modulus)) + } + } + + for {} iszero(and(v, 1)) {} { + v := shr(1, v) + let current := c + switch and(current, 1) + case 0 { + c := shr(1, c) + } + case 1 { + c := shr(1, add(c, modulus)) + } + } + + switch gt(v, u) + case 0 { + u := sub(u, v) + if lt(b, c) { + b := add(b, modulus) + } + b := sub(b, c) + } + case 1 { + v := sub(v, u) + if lt(c, b) { + c := add(c, modulus) + } + c := sub(c, b) + } + } + + switch eq(u, 1) + case 0 { + inv := c + } + case 1 { + inv := b + } + } + + /// @notice Implementation of the Montgomery reduction algorithm (a.k.a. REDC). + /// @dev See https://en.wikipedia.org/wiki/Montgomery_modular_multiplication#The_REDC_algorithm + /// @param lowestHalfOfT The lowest half of the value T. + /// @param higherHalfOfT The higher half of the value T. + /// @return S The result of the Montgomery reduction. + function REDC(lowestHalfOfT, higherHalfOfT) -> S { + let m := mul(lowestHalfOfT, N_PRIME()) + let hi := add(higherHalfOfT, getHighestHalfOfMultiplication(m, P())) + let lo, overflowed := overflowingAdd(lowestHalfOfT, mul(m, P())) + if overflowed { + hi := add(hi, 1) + } + S := hi + if iszero(lt(hi, P())) { + S := sub(hi, P()) + } + } + + /// @notice Encodes a field element into the Montgomery form using the Montgomery reduction algorithm (REDC). + /// @dev See https://en.wikipedia.org/wiki/Montgomery_modular_multiplication#The_REDC_algorithm for further details on transforming a field element into the Montgomery form. + /// @param a The field element to encode. + /// @return ret The field element in Montgomery form. + function intoMontgomeryForm(a) -> ret { + let hi := getHighestHalfOfMultiplication(a, R2_MOD_P()) + let lo := mul(a, R2_MOD_P()) + ret := REDC(lo, hi) + } + + /// @notice Decodes a field element out of the Montgomery form using the Montgomery reduction algorithm (REDC). + /// @dev See https://en.wikipedia.org/wiki/Montgomery_modular_multiplication#The_REDC_algorithm for further details on transforming a field element out of the Montgomery form. + /// @param m The field element in Montgomery form to decode. + /// @return ret The decoded field element. + function outOfMontgomeryForm(m) -> ret { + let hi := 0 + let lo := m + ret := REDC(lo, hi) + } + + /// @notice Computes the Montgomery addition. + /// @dev See https://en.wikipedia.org/wiki/Montgomery_modular_multiplication#The_REDC_algorithm for further details on the Montgomery multiplication. + /// @param augend The augend in Montgomery form. + /// @param addend The addend in Montgomery form. + /// @return ret The result of the Montgomery addition. + function montgomeryAdd(augend, addend) -> ret { + ret := add(augend, addend) + if iszero(lt(ret, P())) { + ret := sub(ret, P()) + } + } + + /// @notice Computes the Montgomery subtraction. + /// @dev See https://en.wikipedia.org/wiki/Montgomery_modular_multiplication#The_REDC_algorithm for further details on the Montgomery multiplication. + /// @param minuend The minuend in Montgomery form. + /// @param subtrahend The subtrahend in Montgomery form. + /// @return ret The result of the Montgomery subtraction. + function montgomerySub(minuend, subtrahend) -> ret { + ret := montgomeryAdd(minuend, sub(P(), subtrahend)) + } + + /// @notice Computes the Montgomery multiplication using the Montgomery reduction algorithm (REDC). + /// @dev See https://en.wikipedia.org/wiki/Montgomery_modular_multiplication#The_REDC_algorithm for further details on the Montgomery multiplication. + /// @param multiplicand The multiplicand in Montgomery form. + /// @param multiplier The multiplier in Montgomery form. + /// @return ret The result of the Montgomery multiplication. + function montgomeryMul(multiplicand, multiplier) -> ret { + let higherHalfOfProduct := getHighestHalfOfMultiplication(multiplicand, multiplier) + let lowestHalfOfProduct := mul(multiplicand, multiplier) + ret := REDC(lowestHalfOfProduct, higherHalfOfProduct) + } + + /// @notice Computes the Montgomery modular inverse skipping the Montgomery reduction step. + /// @dev The Montgomery reduction step is skept because a modification in the binary extended Euclidean algorithm is used to compute the modular inverse. + /// @dev See the function `binaryExtendedEuclideanAlgorithm` for further details. + /// @param a The field element in Montgomery form to compute the modular inverse of. + /// @return invmod The result of the Montgomery modular inverse (in Montgomery form). + function montgomeryModularInverse(a) -> invmod { + invmod := binaryExtendedEuclideanAlgorithm(a) + } + + /// @notice Computes the Montgomery division. + /// @dev The Montgomery division is computed by multiplying the dividend with the modular inverse of the divisor. + /// @param dividend The dividend in Montgomery form. + /// @param divisor The divisor in Montgomery form. + /// @return quotient The result of the Montgomery division. + function montgomeryDiv(dividend, divisor) -> quotient { + quotient := montgomeryMul(dividend, montgomeryModularInverse(divisor)) + } + + //////////////////////////////////////////////////////////////// + // FALLBACK + //////////////////////////////////////////////////////////////// + + // Retrieve the coordinates from the calldata + let x1 := calldataload(0) + let y1 := calldataload(32) + let x2 := calldataload(64) + let y2 := calldataload(96) + + let p1IsInfinity := isInfinity(x1, y1) + let p2IsInfinity := isInfinity(x2, y2) + + if and(p1IsInfinity, p2IsInfinity) { + // Infinity + Infinity = Infinity + mstore(0, 0) + mstore(32, 0) + return(0, 64) + } + if and(p1IsInfinity, iszero(p2IsInfinity)) { + // Infinity + P = P + + // Ensure that the coordinates are between 0 and the field order. + if or(iszero(isOnFieldOrder(x2)), iszero(isOnFieldOrder(y2))) { + burnGas() + } + + let m_x2 := intoMontgomeryForm(x2) + let m_y2 := intoMontgomeryForm(y2) + + // Ensure that the point is in the curve (Y^2 = X^3 + 3). + if iszero(pointIsInCurve(m_x2, m_y2)) { + burnGas() + } + + // We just need to go into the Montgomery form to perform the + // computations in pointIsInCurve, but we do not need to come back. + + mstore(0, x2) + mstore(32, y2) + return(0, 64) + } + if and(iszero(p1IsInfinity), p2IsInfinity) { + // P + Infinity = P + + // Ensure that the coordinates are between 0 and the field order. + if or(iszero(isOnFieldOrder(x1)), iszero(isOnFieldOrder(y1))) { + burnGas() + } + + let m_x1 := intoMontgomeryForm(x1) + let m_y1 := intoMontgomeryForm(y1) + + // Ensure that the point is in the curve (Y^2 = X^3 + 3). + if iszero(pointIsInCurve(m_x1, m_y1)) { + burnGas() + } + + // We just need to go into the Montgomery form to perform the + // computations in pointIsInCurve, but we do not need to come back. + + mstore(0, x1) + mstore(32, y1) + return(0, 64) + } + + // Ensure that the coordinates are between 0 and the field order. + if or(iszero(isOnFieldOrder(x1)), iszero(isOnFieldOrder(y1))) { + burnGas() + } + + // Ensure that the coordinates are between 0 and the field order. + if or(iszero(isOnFieldOrder(x2)), iszero(isOnFieldOrder(y2))) { + burnGas() + } + + // There's no need for transforming into Montgomery form + // for this case. + if and(eq(x1, x2), eq(submod(0, y1, P()), y2)) { + // P + (-P) = Infinity + + let m_x1 := intoMontgomeryForm(x1) + let m_y1 := intoMontgomeryForm(y1) + let m_x2 := intoMontgomeryForm(x2) + let m_y2 := intoMontgomeryForm(y2) + + // Ensure that the points are in the curve (Y^2 = X^3 + 3). + if or(iszero(pointIsInCurve(m_x1, m_y1)), iszero(pointIsInCurve(m_x2, m_y2))) { + burnGas() + } + + // We just need to go into the Montgomery form to perform the + // computations in pointIsInCurve, but we do not need to come back. + + mstore(0, 0) + mstore(32, 0) + return(0, 64) + } + + if and(eq(x1, x2), and(iszero(eq(y1, y2)), iszero(eq(y1, submod(0, y2, P()))))) { + burnGas() + } + + if and(eq(x1, x2), eq(y1, y2)) { + // P + P = 2P + + let x := intoMontgomeryForm(x1) + let y := intoMontgomeryForm(y1) + + // Ensure that the points are in the curve (Y^2 = X^3 + 3). + if iszero(pointIsInCurve(x, y)) { + burnGas() + } + + // (3 * x1^2 + a) / (2 * y1) + let x1_squared := montgomeryMul(x, x) + let slope := montgomeryDiv(addmod(x1_squared, addmod(x1_squared, x1_squared, P()), P()), addmod(y, y, P())) + // x3 = slope^2 - 2 * x1 + let x3 := submod(montgomeryMul(slope, slope), addmod(x, x, P()), P()) + // y3 = slope * (x1 - x3) - y1 + let y3 := submod(montgomeryMul(slope, submod(x, x3, P())), y, P()) + + x3 := outOfMontgomeryForm(x3) + y3 := outOfMontgomeryForm(y3) + + mstore(0, x3) + mstore(32, y3) + return(0, 64) + } + + // P1 + P2 = P3 + + x1 := intoMontgomeryForm(x1) + y1 := intoMontgomeryForm(y1) + x2 := intoMontgomeryForm(x2) + y2 := intoMontgomeryForm(y2) + + // Ensure that the points are in the curve (Y^2 = X^3 + 3). + if or(iszero(pointIsInCurve(x1, y1)), iszero(pointIsInCurve(x2, y2))) { + burnGas() + } + + // (y2 - y1) / (x2 - x1) + let slope := montgomeryDiv(submod(y2, y1, P()), submod(x2, x1, P())) + // x3 = slope^2 - x1 - x2 + let x3 := submod(montgomeryMul(slope, slope), addmod(x1, x2, P()), P()) + // y3 = slope * (x1 - x3) - y1 + let y3 := submod(montgomeryMul(slope, submod(x1, x3, P())), y1, P()) + + x3 := outOfMontgomeryForm(x3) + y3 := outOfMontgomeryForm(y3) + + mstore(0, x3) + mstore(32, y3) + return(0, 64) + } + } +} diff --git a/contracts/precompiles/EcMul.yul b/contracts/precompiles/EcMul.yul new file mode 100644 index 00000000..83c45ff0 --- /dev/null +++ b/contracts/precompiles/EcMul.yul @@ -0,0 +1,495 @@ +object "EcMul" { + code { + return(0, 0) + } + object "EcMul_deployed" { + code { + //////////////////////////////////////////////////////////////// + // CONSTANTS + //////////////////////////////////////////////////////////////// + + /// @notice Constant function for value one in Montgomery form. + /// @dev This value was precomputed using Python. + /// @return m_one The value one in Montgomery form. + function MONTGOMERY_ONE() -> m_one { + m_one := 6350874878119819312338956282401532409788428879151445726012394534686998597021 + } + + /// @notice Constant function for value three in Montgomery form. + /// @dev This value was precomputed using Python. + /// @return m_three The value three in Montgomery form. + function MONTGOMERY_THREE() -> m_three { + m_three := 19052624634359457937016868847204597229365286637454337178037183604060995791063 + } + + /// @notice Constant function for value 3*b (i.e. 9) in Montgomery form. + /// @dev This value was precomputed using Python. + /// @return m_b3 The value 9 in Montgomery form. + function MONTGOMERY_B3() -> m_b3 { + m_b3 := 13381388159399823366557795051099241510703237597767364208733475022892534956023 + } + + /// @notice Constant function for the alt_bn128 field order. + /// @dev See https://eips.ethereum.org/EIPS/eip-196 for further details. + /// @return ret The alt_bn128 field order. + function P() -> ret { + ret := 21888242871839275222246405745257275088696311157297823662689037894645226208583 + } + + /// @notice Constant function for the pre-computation of R^2 % N for the Montgomery REDC algorithm. + /// @dev R^2 is the Montgomery residue of the value 2^512. + /// @dev See https://en.wikipedia.org/wiki/Montgomery_modular_multiplication#The_REDC_algorithm for further detals. + /// @dev This value was precomputed using Python. + /// @return ret The value R^2 modulus the curve field order. + function R2_MOD_P() -> ret { + ret := 3096616502983703923843567936837374451735540968419076528771170197431451843209 + } + + /// @notice Constant function for the pre-computation of N' for the Montgomery REDC algorithm. + /// @dev N' is a value such that NN' = -1 mod R, with N being the curve field order. + /// @dev See https://en.wikipedia.org/wiki/Montgomery_modular_multiplication#The_REDC_algorithm for further detals. + /// @dev This value was precomputed using Python. + /// @return ret The value N'. + function N_PRIME() -> ret { + ret := 111032442853175714102588374283752698368366046808579839647964533820976443843465 + } + + // //////////////////////////////////////////////////////////////// + // HELPER FUNCTIONS + // //////////////////////////////////////////////////////////////// + + /// @dev Executes the `precompileCall` opcode. + function precompileCall(precompileParams, gasToBurn) -> ret { + // Compiler simulation for calling `precompileCall` opcode + ret := verbatim_2i_1o("precompile", precompileParams, gasToBurn) + } + + /// @notice Burns remaining gas until revert. + /// @dev This function is used to burn gas in the case of a failed precompile call. + function burnGas() { + // Precompiles that do not have a circuit counterpart + // will burn the provided gas by calling this function. + precompileCall(0, gas()) + } + + /// @notice Retrieves the highest half of the multiplication result. + /// @param multiplicand The value to multiply. + /// @param multiplier The multiplier. + /// @return ret The highest half of the multiplication result. + function getHighestHalfOfMultiplication(multiplicand, multiplier) -> ret { + ret := verbatim_2i_1o("mul_high", multiplicand, multiplier) + } + + /// @notice Computes an addition and checks for overflow. + /// @param augend The value to add to. + /// @param addend The value to add. + /// @return sum The sum of the two values. + /// @return overflowed True if the addition overflowed, false otherwise. + function overflowingAdd(augend, addend) -> sum, overflowed { + sum := add(augend, addend) + overflowed := lt(sum, augend) + } + + /// @notice Checks if the LSB of a number is 1. + /// @param x The number to check. + /// @return ret True if the LSB is 1, false otherwise. + function lsbIsOne(x) -> ret { + ret := and(x, 1) + } + + /// @notice Computes the inverse in Montgomery Form of a number in Montgomery Form. + /// @dev Reference: https://github.com/lambdaclass/lambdaworks/blob/main/math/src/field/fields/montgomery_backed_prime_fields.rs#L169 + /// @dev Let `base` be a number in Montgomery Form, then base = a*R mod P() being `a` the base number (not in Montgomery Form) + /// @dev Let `inv` be the inverse of a number `a` in Montgomery Form, then inv = a^(-1)*R mod P() + /// @dev The original binary extended euclidean algorithms takes a number a and returns a^(-1) mod N + /// @dev In our case N is P(), and we'd like the input and output to be in Montgomery Form (a*R mod P() + /// @dev and a^(-1)*R mod P() respectively). + /// @dev If we just pass the input as a number in Montgomery Form the result would be a^(-1)*R^(-1) mod P(), + /// @dev but we want it to be a^(-1)*R mod P(). + /// @dev For that, we take advantage of the algorithm's linearity and multiply the result by R^2 mod P() + /// @dev to get R^2*a^(-1)*R^(-1) mod P() = a^(-1)*R mod P() as the desired result in Montgomery Form. + /// @dev `inv` takes the value of `b` or `c` being the result sometimes `b` and sometimes `c`. In paper + /// @dev multiplying `b` or `c` by R^2 mod P() results on starting their values as b = R2_MOD_P() and c = 0. + /// @param base A number `a` in Montgomery Form, then base = a*R mod P(). + /// @return inv The inverse of a number `a` in Montgomery Form, then inv = a^(-1)*R mod P(). + function binaryExtendedEuclideanAlgorithm(base) -> inv { + let modulus := P() + let u := base + let v := modulus + // Avoids unnecessary reduction step. + let b := R2_MOD_P() + let c := 0 + + for {} and(iszero(eq(u, 1)), iszero(eq(v, 1))) {} { + for {} iszero(and(u, 1)) {} { + u := shr(1, u) + let current := b + switch and(current, 1) + case 0 { + b := shr(1, b) + } + case 1 { + b := shr(1, add(b, modulus)) + } + } + + for {} iszero(and(v, 1)) {} { + v := shr(1, v) + let current := c + switch and(current, 1) + case 0 { + c := shr(1, c) + } + case 1 { + c := shr(1, add(c, modulus)) + } + } + + switch gt(v, u) + case 0 { + u := sub(u, v) + if lt(b, c) { + b := add(b, modulus) + } + b := sub(b, c) + } + case 1 { + v := sub(v, u) + if lt(c, b) { + c := add(c, modulus) + } + c := sub(c, b) + } + } + + switch eq(u, 1) + case 0 { + inv := c + } + case 1 { + inv := b + } + } + + /// @notice Implementation of the Montgomery reduction algorithm (a.k.a. REDC). + /// @dev See https://en.wikipedia.org/wiki/Montgomery_modular_multiplication#The_The_REDC_algorithm + /// @param lowestHalfOfT The lowest half of the value T. + /// @param higherHalfOfT The higher half of the value T. + /// @return S The result of the Montgomery reduction. + function REDC(lowestHalfOfT, higherHalfOfT) -> S { + let m := mul(lowestHalfOfT, N_PRIME()) + let hi := add(higherHalfOfT, getHighestHalfOfMultiplication(m, P())) + let lo, overflowed := overflowingAdd(lowestHalfOfT, mul(m, P())) + if overflowed { + hi := add(hi, 1) + } + S := hi + if iszero(lt(hi, P())) { + S := sub(hi, P()) + } + } + + /// @notice Encodes a field element into the Montgomery form using the Montgomery reduction algorithm (REDC). + /// @dev See https://en.wikipedia.org/wiki/Montgomery_modular_multiplication#The_The_REDC_algorithm for further details on transforming a field element into the Montgomery form. + /// @param a The field element to encode. + /// @return ret The field element in Montgomery form. + function intoMontgomeryForm(a) -> ret { + let hi := getHighestHalfOfMultiplication(a, R2_MOD_P()) + let lo := mul(a, R2_MOD_P()) + ret := REDC(lo, hi) + } + + /// @notice Decodes a field element out of the Montgomery form using the Montgomery reduction algorithm (REDC). + /// @dev See https://en.wikipedia.org/wiki/Montgomery_modular_multiplication#The_The_REDC_algorithm for further details on transforming a field element out of the Montgomery form. + /// @param m The field element in Montgomery form to decode. + /// @return ret The decoded field element. + function outOfMontgomeryForm(m) -> ret { + let hi := 0 + let lo := m + ret := REDC(lo, hi) + } + + /// @notice Computes the Montgomery addition. + /// @dev See https://en.wikipedia.org/wiki/Montgomery_modular_multiplication#The_The_REDC_algorithm for further details on the Montgomery multiplication. + /// @param augend The augend in Montgomery form. + /// @param addend The addend in Montgomery form. + /// @return ret The result of the Montgomery addition. + function montgomeryAdd(augend, addend) -> ret { + ret := add(augend, addend) + if iszero(lt(ret, P())) { + ret := sub(ret, P()) + } + } + + /// @notice Computes the Montgomery subtraction. + /// @dev See https://en.wikipedia.org/wiki/Montgomery_modular_multiplication#The_The_REDC_algorithm for further details on the Montgomery multiplication. + /// @param minuend The minuend in Montgomery form. + /// @param subtrahend The subtrahend in Montgomery form. + /// @return ret The result of the Montgomery subtraction. + function montgomerySub(minuend, subtrahend) -> ret { + ret := montgomeryAdd(minuend, sub(P(), subtrahend)) + } + + /// @notice Computes the Montgomery multiplication using the Montgomery reduction algorithm (REDC). + /// @dev See https://en.wikipedia.org/wiki/Montgomery_modular_multiplication#The_The_REDC_algorithm for further details on the Montgomery multiplication. + /// @param multiplicand The multiplicand in Montgomery form. + /// @param multiplier The multiplier in Montgomery form. + /// @return ret The result of the Montgomery multiplication. + function montgomeryMul(multiplicand, multiplier) -> ret { + let hi := getHighestHalfOfMultiplication(multiplicand, multiplier) + let lo := mul(multiplicand, multiplier) + ret := REDC(lo, hi) + } + + /// @notice Computes the Montgomery modular inverse skipping the Montgomery reduction step. + /// @dev The Montgomery reduction step is skept because a modification in the binary extended Euclidean algorithm is used to compute the modular inverse. + /// @dev See the function `binaryExtendedEuclideanAlgorithm` for further details. + /// @param a The field element in Montgomery form to compute the modular inverse of. + /// @return invmod The result of the Montgomery modular inverse (in Montgomery form). + function montgomeryModularInverse(a) -> invmod { + invmod := binaryExtendedEuclideanAlgorithm(a) + } + + /// @notice Checks if a coordinate is on the curve field order. + /// @dev A coordinate is on the curve field order if it is on the range [0, curveFieldOrder). + /// @param coordinate The coordinate to check. + /// @return ret True if the coordinate is in the range, false otherwise. + function coordinateIsOnFieldOrder(coordinate) -> ret { + ret := lt(coordinate, P()) + } + + /// @notice Checks if affine coordinates are on the curve field order. + /// @dev Affine coordinates are on the curve field order if both coordinates are on the range [0, curveFieldOrder). + /// @param x The x coordinate to check. + /// @param y The y coordinate to check. + /// @return ret True if the coordinates are in the range, false otherwise. + function affinePointCoordinatesAreOnFieldOrder(x, y) -> ret { + ret := and(coordinateIsOnFieldOrder(x), coordinateIsOnFieldOrder(y)) + } + + /// @notice Checks if projective coordinates are on the curve field order. + /// @dev Projective coordinates are on the curve field order if the coordinates are on the range [0, curveFieldOrder) and the z coordinate is not zero. + /// @param x The x coordinate to check. + /// @param y The y coordinate to check. + /// @param z The z coordinate to check. + /// @return ret True if the coordinates are in the range, false otherwise. + function projectivePointCoordinatesAreOnFieldOrder(x, y, z) -> ret { + let _x, _y := projectiveIntoAffine(x, y, z) + ret := and(z, affinePointCoordinatesAreOnFieldOrder(_x, _y)) + } + + // @notice Checks if a point in affine coordinates in Montgomery form is on the curve. + // @dev The curve in question is the alt_bn128 curve. + // @dev The Short Weierstrass equation of the curve is y^2 = x^3 + 3. + // @param x The x coordinate of the point in Montgomery form. + // @param y The y coordinate of the point in Montgomery form. + // @return ret True if the point is on the curve, false otherwise. + function affinePointIsOnCurve(x, y) -> ret { + let ySquared := montgomeryMul(y, y) + let xSquared := montgomeryMul(x, x) + let xQubed := montgomeryMul(xSquared, x) + let xQubedPlusThree := montgomeryAdd(xQubed, MONTGOMERY_THREE()) + + ret := eq(ySquared, xQubedPlusThree) + } + + /// @notice Checks if a point in affine coordinates is the point at infinity. + /// @dev The point at infinity is defined as the point (0, 0). + /// @dev See https://eips.ethereum.org/EIPS/eip-196 for further details. + /// @param x The x coordinate of the point in Montgomery form. + /// @param y The y coordinate of the point in Montgomery form. + /// @return ret True if the point is the point at infinity, false otherwise. + function affinePointIsInfinity(x, y) -> ret { + ret := and(iszero(x), iszero(y)) + } + + /// @notice Checks if a point in projective coordinates in Montgomery form is the point at infinity. + /// @dev The point at infinity is defined as the point (0, 0, 0). + /// @param x The x coordinate of the point in Montgomery form. + /// @param y The y coordinate of the point in Montgomery form. + /// @param z The z coordinate of the point in Montgomery form. + /// @return ret True if the point is the point at infinity, false otherwise. + function projectivePointIsInfinity(x, y, z) -> ret { + ret := iszero(z) + } + + /// @notice Converts a point in affine coordinates to projective coordinates in Montgomery form. + /// @dev The point at infinity is defined as the point (0, 0, 0). + /// @dev For performance reasons, the point is assumed to be previously checked to be on the + /// @dev curve and not the point at infinity. + /// @param xp The x coordinate of the point P in affine coordinates in Montgomery form. + /// @param yp The y coordinate of the point P in affine coordinates in Montgomery form. + /// @return xr The x coordinate of the point P in projective coordinates in Montgomery form. + /// @return yr The y coordinate of the point P in projective coordinates in Montgomery form. + /// @return zr The z coordinate of the point P in projective coordinates in Montgomery form. + function projectiveFromAffine(xp, yp) -> xr, yr, zr { + xr := xp + yr := yp + zr := MONTGOMERY_ONE() + } + + /// @notice Converts a point in projective coordinates to affine coordinates in Montgomery form. + /// @dev See https://www.nayuki.io/page/elliptic-curve-point-addition-in-projective-coordinates for further details. + /// @dev Reverts if the point is not on the curve. + /// @param xp The x coordinate of the point P in projective coordinates in Montgomery form. + /// @param yp The y coordinate of the point P in projective coordinates in Montgomery form. + /// @param zp The z coordinate of the point P in projective coordinates in Montgomery form. + /// @return xr The x coordinate of the point P in affine coordinates in Montgomery form. + /// @return yr The y coordinate of the point P in affine coordinates in Montgomery form. + function projectiveIntoAffine(xp, yp, zp) -> xr, yr { + if zp { + let zp_inv := montgomeryModularInverse(zp) + xr := montgomeryMul(xp, zp_inv) + yr := montgomeryMul(yp, zp_inv) + } + } + + /// @notice Doubles a point in projective coordinates in Montgomery form. + /// @dev See Algorithm 9 in https://eprint.iacr.org/2015/1060.pdf for further details. + /// @dev The point is assumed to be on the curve. + /// @dev It works correctly for the point at infinity. + /// @param xp The x coordinate of the point P in projective coordinates in Montgomery form. + /// @param yp The y coordinate of the point P in projective coordinates in Montgomery form. + /// @param zp The z coordinate of the point P in projective coordinates in Montgomery form. + /// @return xr The x coordinate of the point 2P in projective coordinates in Montgomery form. + /// @return yr The y coordinate of the point 2P in projective coordinates in Montgomery form. + /// @return zr The z coordinate of the point 2P in projective coordinates in Montgomery form. + function projectiveDouble(xp, yp, zp) -> xr, yr, zr { + let t0 := montgomeryMul(yp, yp) + zr := montgomeryAdd(t0, t0) + zr := montgomeryAdd(zr, zr) + zr := montgomeryAdd(zr, zr) + let t1 := montgomeryMul(yp, zp) + let t2 := montgomeryMul(zp, zp) + t2 := montgomeryMul(MONTGOMERY_B3(), t2) + xr := montgomeryMul(t2, zr) + yr := montgomeryAdd(t0, t2) + zr := montgomeryMul(t1, zr) + t1 := montgomeryAdd(t2, t2) + t2 := montgomeryAdd(t1, t2) + t0 := montgomerySub(t0, t2) + yr := montgomeryMul(t0, yr) + yr := montgomeryAdd(xr, yr) + t1 := montgomeryMul(xp, yp) + xr := montgomeryMul(t0, t1) + xr := montgomeryAdd(xr, xr) + } + + //////////////////////////////////////////////////////////////// + // FALLBACK + //////////////////////////////////////////////////////////////// + + // Retrieve the coordinates from the calldata + let x := calldataload(0) + let y := calldataload(32) + if iszero(affinePointCoordinatesAreOnFieldOrder(x, y)) { + burnGas() + } + let scalar := calldataload(64) + + if affinePointIsInfinity(x, y) { + // Infinity * scalar = Infinity + return(0x00, 0x40) + } + + let m_x := intoMontgomeryForm(x) + let m_y := intoMontgomeryForm(y) + + // Ensure that the point is in the curve (Y^2 = X^3 + 3). + if iszero(affinePointIsOnCurve(m_x, m_y)) { + burnGas() + } + + if eq(scalar, 0) { + // P * 0 = Infinity + return(0x00, 0x40) + } + if eq(scalar, 1) { + // P * 1 = P + mstore(0x00, x) + mstore(0x20, y) + return(0x00, 0x40) + } + + let xp, yp, zp := projectiveFromAffine(m_x, m_y) + + if eq(scalar, 2) { + let xr, yr, zr := projectiveDouble(xp, yp, zp) + + xr, yr := projectiveIntoAffine(xr, yr, zr) + xr := outOfMontgomeryForm(xr) + yr := outOfMontgomeryForm(yr) + + mstore(0x00, xr) + mstore(0x20, yr) + return(0x00, 0x40) + } + + let xq := xp + let yq := yp + let zq := zp + let xr := 0 + let yr := MONTGOMERY_ONE() + let zr := 0 + for {} scalar {} { + if lsbIsOne(scalar) { + let rIsInfinity := projectivePointIsInfinity(xr, yr, zr) + + if rIsInfinity { + // Infinity + P = P + xr := xq + yr := yq + zr := zq + + xq, yq, zq := projectiveDouble(xq, yq, zq) + // Check next bit + scalar := shr(1, scalar) + continue + } + + let t0 := montgomeryMul(yq, zr) + let t1 := montgomeryMul(yr, zq) + let t := montgomerySub(t0, t1) + let u0 := montgomeryMul(xq, zr) + let u1 := montgomeryMul(xr, zq) + let u := montgomerySub(u0, u1) + + // t = (yq*zr - yr*zq); u = (xq*zr - xr*zq) + if iszero(or(t, u)) { + // P + P = 2P + xr, yr, zr := projectiveDouble(xr, yr, zr) + + xq := xr + yq := yr + zq := zr + // Check next bit + scalar := shr(1, scalar) + continue + } + + // P1 + P2 = P3 + let u2 := montgomeryMul(u, u) + let u3 := montgomeryMul(u2, u) + let v := montgomeryMul(zq, zr) + let w := montgomerySub(montgomeryMul(montgomeryMul(t, t), v), montgomeryMul(u2, montgomeryAdd(u0, u1))) + + xr := montgomeryMul(u, w) + yr := montgomerySub(montgomeryMul(t, montgomerySub(montgomeryMul(u0, u2), w)), montgomeryMul(t0, u3)) + zr := montgomeryMul(u3, v) + } + + xq, yq, zq := projectiveDouble(xq, yq, zq) + // Check next bit + scalar := shr(1, scalar) + } + + xr, yr := projectiveIntoAffine(xr, yr, zr) + xr := outOfMontgomeryForm(xr) + yr := outOfMontgomeryForm(yr) + + mstore(0, xr) + mstore(32, yr) + return(0, 64) + } + } +} diff --git a/contracts/precompiles/Ecrecover.yul b/contracts/precompiles/Ecrecover.yul index 8f8889d5..d0e5924b 100644 --- a/contracts/precompiles/Ecrecover.yul +++ b/contracts/precompiles/Ecrecover.yul @@ -1,10 +1,13 @@ /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice The contract used to emulate EVM's ecrecover precompile. * @dev It uses `precompileCall` to call the zkEVM built-in precompiles. */ object "Ecrecover" { - code { } + code { + return(0, 0) + } object "Ecrecover_deployed" { code { //////////////////////////////////////////////////////////////// diff --git a/contracts/precompiles/Keccak256.yul b/contracts/precompiles/Keccak256.yul index 15c39029..b078d580 100644 --- a/contracts/precompiles/Keccak256.yul +++ b/contracts/precompiles/Keccak256.yul @@ -1,12 +1,15 @@ /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice The contract used to emulate EVM's keccak256 opcode. * @dev It accepts the data to be hashed, pad it by the specification * and uses `precompileCall` to call the zkEVM built-in precompiles. * @dev Thus keccak256 precompile circuit operates over padded data to perform efficient sponge round computation. */ object "Keccak256" { - code { } + code { + return(0, 0) + } object "Keccak256_deployed" { code { //////////////////////////////////////////////////////////////// diff --git a/contracts/precompiles/SHA256.yul b/contracts/precompiles/SHA256.yul index d594f55d..fba02d5e 100644 --- a/contracts/precompiles/SHA256.yul +++ b/contracts/precompiles/SHA256.yul @@ -1,12 +1,15 @@ /** * @author Matter Labs + * @custom:security-contact security@matterlabs.dev * @notice The contract used to emulate EVM's sha256 precompile. * @dev It accepts the data to be hashed, pad it by the specification * and uses `precompileCall` to call the zkEVM built-in precompiles. * @dev Thus sha256 precompile circuit operates over padded data to perform efficient sponge round computation. */ object "SHA256" { - code { } + code { + return(0, 0) + } object "SHA256_deployed" { code { //////////////////////////////////////////////////////////////// diff --git a/contracts/test-contracts/Callable.sol b/contracts/test-contracts/Callable.sol new file mode 100644 index 00000000..e7477e0c --- /dev/null +++ b/contracts/test-contracts/Callable.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.20; + +contract Callable { + event Called(uint256 value, bytes data); + + fallback() external payable { + uint256 len; + assembly { + len := calldatasize() + } + bytes memory data = new bytes(len); + assembly { + calldatacopy(add(data, 0x20), 0, len) + } + emit Called(msg.value, data); + } +} diff --git a/contracts/test-contracts/DelegateCaller.sol b/contracts/test-contracts/DelegateCaller.sol new file mode 100644 index 00000000..caa5aae6 --- /dev/null +++ b/contracts/test-contracts/DelegateCaller.sol @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8.0; + +contract DelegateCaller { + function delegateCall(address _to) external payable { + assembly { + calldatacopy(0, 0, calldatasize()) + let result := delegatecall(gas(), _to, 0, calldatasize(), 0, 0) + returndatacopy(0, 0, returndatasize()) + switch result + case 0 { + revert(0, returndatasize()) + } + default { + return(0, returndatasize()) + } + } + } +} diff --git a/contracts/test-contracts/Deployable.sol b/contracts/test-contracts/Deployable.sol new file mode 100644 index 00000000..be35861a --- /dev/null +++ b/contracts/test-contracts/Deployable.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.20; + +contract Deployable { + event Deployed(uint256 value, bytes data); + + constructor() payable { + uint256 len; + assembly { + len := codesize() + } + bytes memory data = new bytes(len); + assembly { + codecopy(add(data, 0x20), 0, len) + } + emit Deployed(msg.value, data); + } +} diff --git a/contracts/test-contracts/DummyUpgrade.sol b/contracts/test-contracts/DummyUpgrade.sol new file mode 100644 index 00000000..b369f9a9 --- /dev/null +++ b/contracts/test-contracts/DummyUpgrade.sol @@ -0,0 +1,11 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.20; + +contract DummyUpgrade { + event Upgraded(); + + function performUpgrade() public { + emit Upgraded(); + } +} diff --git a/contracts/test-contracts/EventWriterTest.sol b/contracts/test-contracts/EventWriterTest.sol new file mode 100644 index 00000000..faf09cd7 --- /dev/null +++ b/contracts/test-contracts/EventWriterTest.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.20; + +contract EventWriterTest { + event ZeroTopics(bytes data) anonymous; + event OneTopic(bytes data); + event TwoTopics(uint256 indexed topic1, bytes data); + event ThreeTopics(uint256 indexed topic1, uint256 indexed topic2, bytes data); + event FourTopics(uint256 indexed topic1, uint256 indexed topic2, uint256 indexed topic3, bytes data); + + function zeroTopics(bytes calldata data) external { + emit ZeroTopics(data); + } + + function oneTopic(bytes calldata data) external { + emit OneTopic(data); + } + + function twoTopics(uint256 topic1, bytes calldata data) external { + emit TwoTopics(topic1, data); + } + + function threeTopics(uint256 topic1, uint256 topic2, bytes calldata data) external { + emit ThreeTopics(topic1, topic2, data); + } + + function fourTopics(uint256 topic1, uint256 topic2, uint256 topic3, bytes calldata data) external { + emit FourTopics(topic1, topic2, topic3, data); + } +} diff --git a/contracts/test-contracts/MockERC20Approve.sol b/contracts/test-contracts/MockERC20Approve.sol new file mode 100644 index 00000000..c9931389 --- /dev/null +++ b/contracts/test-contracts/MockERC20Approve.sol @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.20; + +contract MockERC20Approve { + event Approved(address to, uint256 value); + + function approve(address spender, uint256 value) external returns (bool) { + emit Approved(spender, value); + return true; + } + + function allowance(address owner, address spender) external view returns (uint256) { + return 0; + } +} diff --git a/contracts/test-contracts/MockKnownCodesStorage.sol b/contracts/test-contracts/MockKnownCodesStorage.sol new file mode 100644 index 00000000..7cec142e --- /dev/null +++ b/contracts/test-contracts/MockKnownCodesStorage.sol @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.20; + +contract MockKnownCodesStorage { + event MockBytecodePublished(bytes32 indexed bytecodeHash); + + function markBytecodeAsPublished(bytes32 _bytecodeHash) external { + emit MockBytecodePublished(_bytecodeHash); + } + + // To be able to deploy original know codes storage again + function getMarker(bytes32) public pure returns (uint256 marker) { + return 1; + } + + // To prevent failing during calls from the bootloader + fallback() external {} +} diff --git a/contracts/test-contracts/MockL1Messenger.sol b/contracts/test-contracts/MockL1Messenger.sol new file mode 100644 index 00000000..b24da511 --- /dev/null +++ b/contracts/test-contracts/MockL1Messenger.sol @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.20; + +contract MockL1Messenger { + event MockBytecodeL1Published(bytes32 indexed bytecodeHash); + + function requestBytecodeL1Publication(bytes32 _bytecodeHash) external { + emit MockBytecodeL1Published(_bytecodeHash); + } + + // To prevent failing during calls from the bootloader + function sendToL1(bytes calldata) external returns (bytes32) { + return bytes32(0); + } +} diff --git a/contracts/test-contracts/NotSystemCaller.sol b/contracts/test-contracts/NotSystemCaller.sol new file mode 100644 index 00000000..0c85deb6 --- /dev/null +++ b/contracts/test-contracts/NotSystemCaller.sol @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.20; + +contract NotSystemCaller { + address immutable to; + + constructor(address _to) { + to = _to; + } + + fallback() external payable { + address _to = to; + assembly { + calldatacopy(0, 0, calldatasize()) + + let result := call(gas(), _to, callvalue(), 0, calldatasize(), 0, 0) + + returndatacopy(0, 0, returndatasize()) + + switch result + case 0 { + revert(0, returndatasize()) + } + default { + return(0, returndatasize()) + } + } + } +} diff --git a/contracts/test-contracts/SystemCaller.sol b/contracts/test-contracts/SystemCaller.sol new file mode 100644 index 00000000..58adfce2 --- /dev/null +++ b/contracts/test-contracts/SystemCaller.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.20; + +import {SystemContractsCaller} from "../libraries/SystemContractsCaller.sol"; + +contract SystemCaller { + address immutable to; + + constructor(address _to) { + to = _to; + } + + fallback() external payable { + bytes memory result = SystemContractsCaller.systemCallWithPropagatedRevert( + uint32(gasleft()), + to, + uint128(msg.value), + msg.data + ); + assembly { + return(add(result, 0x20), mload(result)) + } + } +} diff --git a/contracts/test-contracts/TestSystemContract.sol b/contracts/test-contracts/TestSystemContract.sol index f4e08c62..8eba841d 100644 --- a/contracts/test-contracts/TestSystemContract.sol +++ b/contracts/test-contracts/TestSystemContract.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.20; import "../Constants.sol"; @@ -29,7 +29,7 @@ contract TestSystemContract is ISystemContract { { uint256 gasBefore = gasleft(); - SystemContractHelper.precompileCall(0, 10000); + SystemContractHelper.unsafePrecompileCall(0, 10000); uint256 gasAfter = gasleft(); require(gasBefore - gasAfter > 10000, "Did not spend enough gas"); require(gasBefore - gasAfter < 10100, "Spent too much gas"); diff --git a/contracts/test-contracts/TestSystemContractHelper.sol b/contracts/test-contracts/TestSystemContractHelper.sol index 6a114e4b..2f9f7073 100644 --- a/contracts/test-contracts/TestSystemContractHelper.sol +++ b/contracts/test-contracts/TestSystemContractHelper.sol @@ -1,6 +1,6 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8; +pragma solidity 0.8.20; import {MAX_SYSTEM_CONTRACT_ADDRESS, MSG_VALUE_SYSTEM_CONTRACT} from "../Constants.sol"; diff --git a/contracts/tests/Counter.sol b/contracts/tests/Counter.sol deleted file mode 100644 index 736a8b78..00000000 --- a/contracts/tests/Counter.sol +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8.0; - -contract Counter { - uint256 public counter; - - function increment() public { - counter += 1; - } -} diff --git a/contracts/tests/TransactionHelperTest.sol b/contracts/tests/TransactionHelperTest.sol deleted file mode 100644 index df8e7e67..00000000 --- a/contracts/tests/TransactionHelperTest.sol +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: MIT - -pragma solidity ^0.8.0; - -import "../libraries/TransactionHelper.sol"; - -contract TransactionHelperTest { - using TransactionHelper for Transaction; - - function encodeHash(Transaction calldata _transaction) public view returns (bytes32 resultHash) { - resultHash = _transaction.encodeHash(); - } -} diff --git a/hardhat.config.ts b/hardhat.config.ts index 4fa0df56..73c7c0e8 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -1,37 +1,55 @@ -import '@nomiclabs/hardhat-solpp'; -import 'hardhat-typechain'; -import '@nomiclabs/hardhat-ethers'; -import '@matterlabs/hardhat-zksync-solc'; +import "@matterlabs/hardhat-zksync-chai-matchers"; +import "@matterlabs/hardhat-zksync-solc"; +import "@nomiclabs/hardhat-ethers"; +import "@nomiclabs/hardhat-solpp"; +import "@typechain/hardhat"; -const systemConfig = require('./SystemConfig.json'); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const systemConfig = require("./SystemConfig.json"); export default { - zksolc: { - version: '1.3.11', - compilerSource: 'binary', - settings: { - isSystem: true - } + zksolc: { + version: "1.3.14", + compilerSource: "binary", + settings: { + isSystem: true, }, - zkSyncDeploy: { - zkSyncNetwork: 'http://localhost:3050', - ethNetwork: 'http://localhost:8545' + }, + zkSyncDeploy: { + zkSyncNetwork: "http://localhost:3050", + ethNetwork: "http://localhost:8545", + }, + solidity: { + version: "0.8.20", + settings: { + optimizer: { + enabled: true, + runs: 9999999, + }, + outputSelection: { + "*": { + "*": ["storageLayout"], + }, + }, }, - solidity: { - version: '0.8.17' + }, + solpp: { + defs: (() => { + return { + ECRECOVER_COST_GAS: systemConfig.ECRECOVER_COST_GAS, + KECCAK_ROUND_COST_GAS: systemConfig.KECCAK_ROUND_COST_GAS, + SHA256_ROUND_COST_GAS: systemConfig.SHA256_ROUND_COST_GAS, + }; + })(), + }, + networks: { + hardhat: { + zksync: true, }, - solpp: { - defs: (() => { - return { - ECRECOVER_COST_GAS: systemConfig.ECRECOVER_COST_GAS, - KECCAK_ROUND_COST_GAS: systemConfig.KECCAK_ROUND_COST_GAS, - SHA256_ROUND_COST_GAS: systemConfig.SHA256_ROUND_COST_GAS - } - })() + zkSyncTestNode: { + url: "http://127.0.0.1:8011", + ethNetwork: "", + zksync: true, }, - networks: { - hardhat: { - zksync: true - } - } + }, }; diff --git a/package.json b/package.json index b4df9b82..ad977d73 100644 --- a/package.json +++ b/package.json @@ -8,22 +8,36 @@ "@nomiclabs/hardhat-solpp": "^2.0.1", "commander": "^9.4.1", "ethers": "^5.7.0", - "hardhat": "^2.11.0", + "hardhat": "=2.16.0", "preprocess": "^3.2.0", - "zksync-web3": "^0.13.0" + "zksync-web3": "^0.14.3" }, "devDependencies": { + "@matterlabs/eslint-config-typescript": "^1.1.2", + "@matterlabs/hardhat-zksync-chai-matchers": "^0.1.4", "@matterlabs/hardhat-zksync-solc": "^0.4.2", + "@matterlabs/prettier-config": "^1.0.3", + "@nomicfoundation/hardhat-chai-matchers": "^1.0.3", "@nomiclabs/hardhat-ethers": "^2.0.6", "@typechain/ethers-v5": "^10.0.0", + "@typechain/hardhat": "^7.0.0", "@types/chai": "^4.3.1", + "@types/lodash": "^4.14.199", "@types/mocha": "^9.1.1", "@types/node": "^17.0.34", + "@typescript-eslint/eslint-plugin": "^6.7.4", + "@typescript-eslint/parser": "^6.7.4", "chai": "^4.3.6", - "hardhat-typechain": "^0.3.5", + "eslint": "^8.51.0", + "eslint-import-resolver-typescript": "^3.6.1", + "eslint-plugin-import": "^2.29.0", + "eslint-plugin-prettier": "^5.0.1", + "lodash": "^4.17.21", + "markdownlint-cli": "^0.33.0", "mocha": "^10.0.0", - "prettier": "^2.3.0", - "prettier-plugin-solidity": "^1.0.0-alpha.27", + "prettier": "^3.0.3", + "prettier-plugin-solidity": "^1.1.3", + "solhint": "^3.6.2", "template-file": "^6.0.1", "ts-generator": "^0.1.1", "ts-node": "^10.7.0", @@ -40,12 +54,25 @@ ] }, "scripts": { - "test": "zk f mocha test/system-contract-test.test.ts", - "build": "hardhat compile", - "clean": "hardhat clean", - "fmt": "prettier --config prettier.js --write contracts/*.sol contracts/**/*.sol", - "preprocess": "rm -rf ./bootloader/build && yarn ts-node scripts/process.ts", + "build": "yarn build:sol && yarn build:yul", + "build:sol": "hardhat compile", + "build:yul": "yarn preprocess:yul && yarn compile-yul", + "calculate-hashes:check": "ts-node scripts/calculate-hashes.ts --check-only", + "calculate-hashes:fix": "ts-node scripts/calculate-hashes.ts", + "clean": "yarn clean:sol && yarn clean:yul", + "clean:sol": "hardhat clean", + "clean:yul": "rm -rf ./bootloader/build ./bootloader/tests/artifacts ./contracts/artifacts ./contracts/precompiles/artifacts", + "compile-yul": "ts-node scripts/compile-yul.ts", "deploy-preimages": "ts-node scripts/deploy-preimages.ts", - "compile-yul": "ts-node scripts/compile-yul.ts" + "lint:check": "yarn lint:md && yarn lint:sol && yarn lint:ts && yarn prettier:check", + "lint:fix": "yarn lint:md --fix && yarn lint:sol --fix && yarn lint:ts --fix && yarn prettier:fix", + "lint:md": "markdownlint \"**/*.md\"", + "lint:sol": "solhint \"contracts/**/*.sol\"", + "lint:ts": "eslint .", + "preprocess:yul": "rm -rf ./bootloader/build && yarn ts-node scripts/process.ts", + "prettier:check": "prettier --check \"**/*.{js,json,md,sol,ts,yaml}\"", + "prettier:fix": "prettier --write \"**/*.{js,json,md,sol,ts,yaml}\"", + "test": "hardhat test --network zkSyncTestNode", + "test:bootloader": "cd bootloader/test_infra && cargo run" } } diff --git a/prettier.js b/prettier.js deleted file mode 100644 index 521a8ba9..00000000 --- a/prettier.js +++ /dev/null @@ -1,8 +0,0 @@ -module.exports = { - "printWidth": 120, - "tabWidth": 4, - "useTabs": false, - "singleQuote": false, - "bracketSpacing": false, - "explicitTypes": "always" -}; diff --git a/scripts/calculate-hashes.ts b/scripts/calculate-hashes.ts new file mode 100644 index 00000000..bc7fb007 --- /dev/null +++ b/scripts/calculate-hashes.ts @@ -0,0 +1,230 @@ +import { ethers } from "ethers"; +import * as fs from "fs"; +import _ from "lodash"; +import os from "os"; +import { join } from "path"; +import { hashBytecode } from "zksync-web3/build/src/utils"; + +type ContractDetails = { + contractName: string; + bytecodePath: string; + sourceCodePath: string; +}; + +type Hashes = { + bytecodeHash: string; + sourceCodeHash: string; +}; + +type SystemContractHashes = ContractDetails & Hashes; + +const findDirsEndingWith = + (endingWith: string) => + (path: string): string[] => { + const absolutePath = makePathAbsolute(path); + try { + const dirs = fs.readdirSync(absolutePath, { withFileTypes: true }).filter((dirent) => dirent.isDirectory()); + const dirsEndingWithSol = dirs.filter((dirent) => dirent.name.endsWith(endingWith)); + return dirsEndingWithSol.map((dirent) => dirent.name); + } catch (err) { + const msg = err instanceof Error ? err.message : "Unknown error"; + throw new Error(`Failed to read directory: ${absolutePath} Error: ${msg}`); + } + }; + +const SOLIDITY_ARTIFACTS_DIR = "artifacts-zk"; + +const getSolidityContractDetails = (dir: string, contractName: string): ContractDetails => { + const bytecodePath = join(SOLIDITY_ARTIFACTS_DIR, dir, contractName + ".sol", contractName + ".json"); + const sourceCodePath = join(dir, contractName + ".sol"); + return { + contractName, + bytecodePath, + sourceCodePath, + }; +}; + +const getSolidityContractsDetails = (dir: string): ContractDetails[] => { + const bytecodesDir = join(SOLIDITY_ARTIFACTS_DIR, dir); + const dirsEndingWithSol = findDirsEndingWith(".sol")(bytecodesDir); + const contractNames = dirsEndingWithSol.map((d) => d.replace(".sol", "")); + const solidityContractsDetails = contractNames.map((c) => getSolidityContractDetails(dir, c)); + return solidityContractsDetails; +}; + +const YUL_ARTIFACTS_DIR = "artifacts"; + +const getYulContractDetails = (dir: string, contractName: string): ContractDetails => { + const bytecodePath = join(dir, YUL_ARTIFACTS_DIR, contractName + ".yul", contractName + ".yul.zbin"); + const sourceCodePath = join(dir, contractName + ".yul"); + return { + contractName, + bytecodePath, + sourceCodePath, + }; +}; + +const getYulContractsDetails = (dir: string): ContractDetails[] => { + const bytecodesDir = join(dir, YUL_ARTIFACTS_DIR); + const dirsEndingWithYul = findDirsEndingWith(".yul")(bytecodesDir); + const contractNames = dirsEndingWithYul.map((d) => d.replace(".yul", "")); + const yulContractsDetails = contractNames.map((c) => getYulContractDetails(dir, c)); + return yulContractsDetails; +}; + +const makePathAbsolute = (path: string): string => { + return join(__dirname, "..", path); +}; + +const readSourceCode = (details: ContractDetails): string => { + const absolutePath = makePathAbsolute(details.sourceCodePath); + try { + return ethers.utils.hexlify(fs.readFileSync(absolutePath)); + } catch (err) { + const msg = err instanceof Error ? err.message : "Unknown error"; + throw new Error(`Failed to read source code for ${details.contractName}: ${absolutePath} Error: ${msg}`); + } +}; + +const readBytecode = (details: ContractDetails): string => { + const absolutePath = makePathAbsolute(details.bytecodePath); + try { + if (details.bytecodePath.endsWith(".json")) { + const jsonFile = fs.readFileSync(absolutePath, "utf8"); + return ethers.utils.hexlify(JSON.parse(jsonFile).bytecode); + } else { + return ethers.utils.hexlify(fs.readFileSync(absolutePath)); + } + } catch (err) { + const msg = err instanceof Error ? err.message : "Unknown error"; + throw new Error(`Failed to read bytecode for ${details.contractName}: ${details.bytecodePath} Error: ${msg}`); + } +}; + +const getHashes = (contractName: string, sourceCode: string, bytecode: string): Hashes => { + try { + return { + bytecodeHash: ethers.utils.hexlify(hashBytecode(bytecode)), + // The extra checks performed by the hashBytecode function are not needed for the source code, therefore + // sha256 is used for simplicity + sourceCodeHash: ethers.utils.sha256(sourceCode), + }; + } catch (err) { + const msg = err instanceof Error ? err.message : "Unknown error"; + throw new Error(`Failed to calculate hashes for ${contractName} Error: ${msg}`); + } +}; + +const getSystemContractsHashes = (systemContractsDetails: ContractDetails[]): SystemContractHashes[] => + systemContractsDetails.map((contractDetails) => { + const sourceCode = readSourceCode(contractDetails); + const bytecode = readBytecode(contractDetails); + const hashes = getHashes(contractDetails.contractName, sourceCode, bytecode); + + const systemContractHashes: SystemContractHashes = { + ...contractDetails, + ...hashes, + }; + + return systemContractHashes; + }); + +const readSystemContractsHashesFile = (path: string): SystemContractHashes[] => { + const absolutePath = makePathAbsolute(path); + try { + const file = fs.readFileSync(absolutePath, "utf8"); + const parsedFile = JSON.parse(file); + return parsedFile; + } catch (err) { + const msg = err instanceof Error ? err.message : "Unknown error"; + throw new Error(`Failed to read file: ${absolutePath} Error: ${msg}`); + } +}; + +const saveSystemContractsHashesFile = (path: string, systemContractsHashes: SystemContractHashes[]) => { + const absolutePath = makePathAbsolute(path); + try { + fs.writeFileSync(absolutePath, JSON.stringify(systemContractsHashes, null, 2) + os.EOL); + } catch (err) { + const msg = err instanceof Error ? err.message : "Unknown error"; + throw new Error(`Failed to save file: ${absolutePath} Error: ${msg}`); + } +}; + +const findDifferences = (newHashes: SystemContractHashes[], oldHashes: SystemContractHashes[]) => { + const differentElements = _.xorWith(newHashes, oldHashes, _.isEqual); + + const differentUniqueElements = _.uniqWith(differentElements, (a, b) => a.contractName === b.contractName); + + const differencesList = differentUniqueElements.map((diffElem) => { + const newHashesElem = newHashes.find((elem) => elem.contractName === diffElem.contractName); + + const oldHashesElem = oldHashes.find((elem) => elem.contractName === diffElem.contractName); + + const differingFields = _.xorWith( + Object.entries(newHashesElem || {}), + Object.entries(oldHashesElem || {}), + _.isEqual + ); + + const differingFieldsUniqueKeys = _.uniq(differingFields.map(([key]) => key)); + + return { + contract: diffElem.contractName, + differingFields: differingFieldsUniqueKeys, + old: oldHashesElem || {}, + new: newHashesElem || {}, + }; + }); + + return differencesList; +}; + +const SOLIDITY_SOURCE_CODE_PATHS = ["cache-zk/solpp-generated-contracts"]; +const YUL_SOURCE_CODE_PATHS = ["contracts", "contracts/precompiles", "bootloader/build"]; +const OUTPUT_FILE_PATH = "SystemContractsHashes.json"; + +const main = async () => { + const args = process.argv; + if (args.length > 3 || (args.length == 3 && !args.includes("--check-only"))) { + console.log( + "This command can be used with no arguments or with the --check-only flag. Use the --check-only flag to check the hashes without updating the SystemContractsHashes.json file." + ); + process.exit(1); + } + const checkOnly = args.includes("--check-only"); + + const solidityContractsDetails = _.flatten(SOLIDITY_SOURCE_CODE_PATHS.map(getSolidityContractsDetails)); + const yulContractsDetails = _.flatten(YUL_SOURCE_CODE_PATHS.map(getYulContractsDetails)); + const systemContractsDetails = [...solidityContractsDetails, ...yulContractsDetails]; + + const newSystemContractsHashes = getSystemContractsHashes(systemContractsDetails); + const oldSystemContractsHashes = readSystemContractsHashesFile(OUTPUT_FILE_PATH); + if (_.isEqual(newSystemContractsHashes, oldSystemContractsHashes)) { + console.log("Calculated hashes match the hashes in the SystemContractsHashes.json file."); + console.log("Exiting..."); + return; + } + const differences = findDifferences(newSystemContractsHashes, oldSystemContractsHashes); + console.log("Calculated hashes differ from the hashes in the SystemContractsHashes.json file. Differences:"); + console.log(differences); + if (checkOnly) { + console.log("You can use the `yarn calculate-hashes:fix` command to update the SystemContractsHashes.json file."); + console.log("Exiting..."); + process.exit(1); + } else { + console.log("Updating..."); + saveSystemContractsHashesFile(OUTPUT_FILE_PATH, newSystemContractsHashes); + console.log("Update finished"); + console.log("Exiting..."); + return; + } +}; + +main() + .then(() => process.exit(0)) + .catch((err) => { + console.error("Error:", err.message || err); + console.log("Please make sure to run `yarn build` before running this script."); + process.exit(1); + }); diff --git a/scripts/compile-yul.ts b/scripts/compile-yul.ts index b3919b75..31ea720b 100644 --- a/scripts/compile-yul.ts +++ b/scripts/compile-yul.ts @@ -1,94 +1,101 @@ -import * as hre from 'hardhat'; -import * as fs from 'fs'; -import { exec as _exec, spawn as _spawn } from 'child_process'; +import * as hre from "hardhat"; -import { getZksolcPath, getZksolcUrl, saltFromUrl } from '@matterlabs/hardhat-zksync-solc'; +import { getZksolcUrl, saltFromUrl } from "@matterlabs/hardhat-zksync-solc"; +import { spawn as _spawn } from "child_process"; +import * as fs from "fs"; +import { getCompilersDir } from "hardhat/internal/util/global-dir"; +import path from "path"; -const COMPILER_VERSION = '1.3.11'; +const COMPILER_VERSION = "1.3.14"; const IS_COMPILER_PRE_RELEASE = false; async function compilerLocation(): Promise { - if(IS_COMPILER_PRE_RELEASE) { - const url = getZksolcUrl('https://github.com/matter-labs/zksolc-prerelease', hre.config.zksolc.version); - const salt = saltFromUrl(url); - return await getZksolcPath(COMPILER_VERSION, salt); - } else { - return await getZksolcPath(COMPILER_VERSION, ''); - } + const compilersCache = await getCompilersDir(); + + let salt = ""; + + if (IS_COMPILER_PRE_RELEASE) { + // @ts-ignore + const url = getZksolcUrl("https://github.com/matter-labs/zksolc-prerelease", hre.config.zksolc.version); + salt = saltFromUrl(url); + } + + return path.join(compilersCache, "zksolc", `zksolc-v${COMPILER_VERSION}${salt ? "-" : ""}${salt}`); } // executes a command in a new shell // but pipes data to parent's stdout/stderr export function spawn(command: string) { - command = command.replace(/\n/g, ' '); - const child = _spawn(command, { stdio: 'inherit', shell: true }); - return new Promise((resolve, reject) => { - child.on('error', reject); - child.on('close', (code) => { - code == 0 ? resolve(code) : reject(`Child process exited with code ${code}`); - }); + command = command.replace(/\n/g, " "); + const child = _spawn(command, { stdio: "inherit", shell: true }); + return new Promise((resolve, reject) => { + child.on("error", reject); + child.on("close", (code) => { + code == 0 ? resolve(code) : reject(`Child process exited with code ${code}`); }); + }); } export async function compileYul(path: string, files: string[], outputDirName: string | null) { - if (!files.length) { - console.log(`No test files provided in folder ${path}.`); - return; - } - let paths = preparePaths(path, files, outputDirName); - - const zksolcLocation = await compilerLocation(); - await spawn( - `${zksolcLocation} ${paths.absolutePathSources}/${paths.outputDir} --optimization 3 --system-mode --yul --bin --overwrite -o ${paths.absolutePathArtifacts}/${paths.outputDir}` - ); + if (!files.length) { + console.log(`No test files provided in folder ${path}.`); + return; + } + const paths = preparePaths(path, files, outputDirName); + + const zksolcLocation = await compilerLocation(); + await spawn( + `${zksolcLocation} ${paths.absolutePathSources}/${paths.outputDir} --optimization 3 --system-mode --yul --bin --overwrite -o ${paths.absolutePathArtifacts}/${paths.outputDir}` + ); } export async function compileYulFolder(path: string) { - let files: string[] = (await fs.promises.readdir(path)).filter((fn) => fn.endsWith('.yul')); - for (const file of files) { - await compileYul(path, [file], `${file}`); - } + const files: string[] = (await fs.promises.readdir(path)).filter((fn) => fn.endsWith(".yul")); + for (const file of files) { + await compileYul(path, [file], `${file}`); + } } - function preparePaths(path: string, files: string[], outputDirName: string | null): CompilerPaths { - const filePaths = files - .map((val, _) => { - return `sources/${val}`; - }) - .join(' '); - const outputDir = outputDirName || files[0]; - let absolutePathSources = `${process.env.ZKSYNC_HOME}/etc/system-contracts/${path}`; + const filePaths = files + .map((val) => { + return `sources/${val}`; + }) + .join(" "); + const currentWorkingDirectory = process.cwd(); + console.log(`Yarn project directory: ${currentWorkingDirectory}`); - let absolutePathArtifacts = `${process.env.ZKSYNC_HOME}/etc/system-contracts/${path}/artifacts`; + const outputDir = outputDirName || files[0]; + // This script is located in `system-contracts/scripts`, so we get one directory back. + const absolutePathSources = `${__dirname}/../${path}`; + const absolutePathArtifacts = `${__dirname}/../${path}/artifacts`; - return new CompilerPaths(filePaths, outputDir, absolutePathSources, absolutePathArtifacts); + return new CompilerPaths(filePaths, outputDir, absolutePathSources, absolutePathArtifacts); } class CompilerPaths { - public filePath: string; - public outputDir: string; - public absolutePathSources: string; - public absolutePathArtifacts: string; - constructor(filePath: string, outputDir: string, absolutePathSources: string, absolutePathArtifacts: string) { - this.filePath = filePath; - this.outputDir = outputDir; - this.absolutePathSources = absolutePathSources; - this.absolutePathArtifacts = absolutePathArtifacts; - } + public filePath: string; + public outputDir: string; + public absolutePathSources: string; + public absolutePathArtifacts: string; + constructor(filePath: string, outputDir: string, absolutePathSources: string, absolutePathArtifacts: string) { + this.filePath = filePath; + this.outputDir = outputDir; + this.absolutePathSources = absolutePathSources; + this.absolutePathArtifacts = absolutePathArtifacts; + } } - async function main() { - await compileYulFolder('contracts'); - await compileYulFolder('contracts/precompiles'); - await compileYulFolder('bootloader/build'); - await compileYulFolder('bootloader/tests'); + await compileYulFolder("contracts"); + await compileYulFolder("contracts/precompiles"); + await compileYulFolder("bootloader/build"); + await compileYulFolder("bootloader/tests"); } main() - .then(() => process.exit(0)) - .catch((err) => { - console.error('Error:', err.message || err); - process.exit(1); - }); + .then(() => process.exit(0)) + .catch((err) => { + console.error("Error:", err.message || err); + process.exit(1); + }); diff --git a/scripts/constants.ts b/scripts/constants.ts index 27b1044c..dd089d97 100644 --- a/scripts/constants.ts +++ b/scripts/constants.ts @@ -1,128 +1,129 @@ -import { BigNumberish, BytesLike, constants, ethers } from 'ethers'; +import type { BigNumberish, BytesLike } from "ethers"; +import { constants, ethers } from "ethers"; -export const BOOTLOADER_FORMAL_ADDRESS = '0x0000000000000000000000000000000000008001'; +export const BOOTLOADER_FORMAL_ADDRESS = "0x0000000000000000000000000000000000008001"; export const ETH_ADDRESS = constants.AddressZero; export enum Language { - Solidity = 'solidity', - Yul = 'yul' + Solidity = "solidity", + Yul = "yul", } export interface SystemContractDescription { - address: string; - codeName: string; + address: string; + codeName: string; } export interface YulContractDescrption extends SystemContractDescription { - lang: Language.Yul; - path: string; + lang: Language.Yul; + path: string; } export interface SolidityContractDescription extends SystemContractDescription { - lang: Language.Solidity; + lang: Language.Solidity; } interface ISystemContracts { - [key: string]: YulContractDescrption | SolidityContractDescription; + [key: string]: YulContractDescrption | SolidityContractDescription; } export const SYSTEM_CONTRACTS: ISystemContracts = { - zeroAddress: { - // zero address has EmptyContract code - address: '0x0000000000000000000000000000000000000000', - codeName: 'EmptyContract', - lang: Language.Solidity - }, - ecrecover: { - address: '0x0000000000000000000000000000000000000001', - codeName: 'Ecrecover', - lang: Language.Yul, - path: 'precompiles' - }, - sha256: { - address: '0x0000000000000000000000000000000000000002', - codeName: 'SHA256', - lang: Language.Yul, - path: 'precompiles' - }, - bootloader: { - // Bootloader has EmptyContract code - address: '0x0000000000000000000000000000000000008001', - codeName: 'EmptyContract', - lang: Language.Solidity - }, - accountCodeStorage: { - address: '0x0000000000000000000000000000000000008002', - codeName: 'AccountCodeStorage', - lang: Language.Solidity - }, - nonceHolder: { - address: '0x0000000000000000000000000000000000008003', - codeName: 'NonceHolder', - lang: Language.Solidity - }, - knownCodesStorage: { - address: '0x0000000000000000000000000000000000008004', - codeName: 'KnownCodesStorage', - lang: Language.Solidity - }, - immutableSimulator: { - address: '0x0000000000000000000000000000000000008005', - codeName: 'ImmutableSimulator', - lang: Language.Solidity - }, - contractDeployer: { - address: '0x0000000000000000000000000000000000008006', - codeName: 'ContractDeployer', - lang: Language.Solidity - }, - l1Messenger: { - address: '0x0000000000000000000000000000000000008008', - codeName: 'L1Messenger', - lang: Language.Solidity - }, - msgValueSimulator: { - address: '0x0000000000000000000000000000000000008009', - codeName: 'MsgValueSimulator', - lang: Language.Solidity - }, - l2EthToken: { - address: '0x000000000000000000000000000000000000800a', - codeName: 'L2EthToken', - lang: Language.Solidity - }, - systemContext: { - address: '0x000000000000000000000000000000000000800b', - codeName: 'SystemContext', - lang: Language.Solidity - }, - bootloaderUtilities: { - address: '0x000000000000000000000000000000000000800c', - codeName: 'BootloaderUtilities', - lang: Language.Solidity - }, - eventWriter: { - address: '0x000000000000000000000000000000000000800d', - codeName: 'EventWriter', - lang: Language.Yul, - path: '' - }, - bytecodeCompressor: { - address: '0x000000000000000000000000000000000000800e', - codeName: 'BytecodeCompressor', - lang: Language.Solidity, - }, - complexUpgrader: { - address: '0x000000000000000000000000000000000000800f', - codeName: 'ComplexUpgrader', - lang: Language.Solidity, - }, - keccak256: { - address: '0x0000000000000000000000000000000000008010', - codeName: 'Keccak256', - lang: Language.Yul, - path: 'precompiles' - } + zeroAddress: { + // zero address has EmptyContract code + address: "0x0000000000000000000000000000000000000000", + codeName: "EmptyContract", + lang: Language.Solidity, + }, + ecrecover: { + address: "0x0000000000000000000000000000000000000001", + codeName: "Ecrecover", + lang: Language.Yul, + path: "precompiles", + }, + sha256: { + address: "0x0000000000000000000000000000000000000002", + codeName: "SHA256", + lang: Language.Yul, + path: "precompiles", + }, + bootloader: { + // Bootloader has EmptyContract code + address: "0x0000000000000000000000000000000000008001", + codeName: "EmptyContract", + lang: Language.Solidity, + }, + accountCodeStorage: { + address: "0x0000000000000000000000000000000000008002", + codeName: "AccountCodeStorage", + lang: Language.Solidity, + }, + nonceHolder: { + address: "0x0000000000000000000000000000000000008003", + codeName: "NonceHolder", + lang: Language.Solidity, + }, + knownCodesStorage: { + address: "0x0000000000000000000000000000000000008004", + codeName: "KnownCodesStorage", + lang: Language.Solidity, + }, + immutableSimulator: { + address: "0x0000000000000000000000000000000000008005", + codeName: "ImmutableSimulator", + lang: Language.Solidity, + }, + contractDeployer: { + address: "0x0000000000000000000000000000000000008006", + codeName: "ContractDeployer", + lang: Language.Solidity, + }, + l1Messenger: { + address: "0x0000000000000000000000000000000000008008", + codeName: "L1Messenger", + lang: Language.Solidity, + }, + msgValueSimulator: { + address: "0x0000000000000000000000000000000000008009", + codeName: "MsgValueSimulator", + lang: Language.Solidity, + }, + l2EthToken: { + address: "0x000000000000000000000000000000000000800a", + codeName: "L2EthToken", + lang: Language.Solidity, + }, + systemContext: { + address: "0x000000000000000000000000000000000000800b", + codeName: "SystemContext", + lang: Language.Solidity, + }, + bootloaderUtilities: { + address: "0x000000000000000000000000000000000000800c", + codeName: "BootloaderUtilities", + lang: Language.Solidity, + }, + eventWriter: { + address: "0x000000000000000000000000000000000000800d", + codeName: "EventWriter", + lang: Language.Yul, + path: "", + }, + compressor: { + address: "0x000000000000000000000000000000000000800e", + codeName: "Compressor", + lang: Language.Solidity, + }, + complexUpgrader: { + address: "0x000000000000000000000000000000000000800f", + codeName: "ComplexUpgrader", + lang: Language.Solidity, + }, + keccak256: { + address: "0x0000000000000000000000000000000000008010", + codeName: "Keccak256", + lang: Language.Yul, + path: "precompiles", + }, } as const; export const EIP712_TX_ID = 113; @@ -130,180 +131,182 @@ export const CHAIN_ID = 270; // For now, these types are hardcoded, but maybe it will make sense export const EIP712_DOMAIN = { - name: 'zkSync', - version: '2', - chainId: CHAIN_ID - // zkSync contract doesn't verify EIP712 signatures. + name: "zkSync", + version: "2", + chainId: CHAIN_ID, + // zkSync contract doesn't verify EIP712 signatures. }; export interface TransactionData { - txType: BigNumberish; - from: BigNumberish; - to: BigNumberish; - gasLimit: BigNumberish; - gasPerPubdataByteLimit: BigNumberish; - gasPrice: BigNumberish; - // In the future, we might want to add some - // new fields to the struct. The `txData` struct - // is to be passed to account and any changes to its structure - // would mean a breaking change to these accounts. In order to prevent this, - // we should keep some fields as "reserved". - // It is also recommended that their length is fixed, since - // it would allow easier proof integration (in case we will need - // some special circuit for preprocessing transactions). - reserved: BigNumberish[]; - data: BytesLike; - signature: BytesLike; - // Reserved dynamic type for the future use-case. Using it should be avoided, - // But it is still here, just in case we want to enable some additional functionality. - reservedDynamic: BytesLike; + txType: BigNumberish; + from: BigNumberish; + to: BigNumberish; + gasLimit: BigNumberish; + gasPerPubdataByteLimit: BigNumberish; + gasPrice: BigNumberish; + // In the future, we might want to add some + // new fields to the struct. The `txData` struct + // is to be passed to account and any changes to its structure + // would mean a breaking change to these accounts. In order to prevent this, + // we should keep some fields as "reserved". + // It is also recommended that their length is fixed, since + // it would allow easier proof integration (in case we will need + // some special circuit for preprocessing transactions). + reserved: BigNumberish[]; + data: BytesLike; + signature: BytesLike; + // Reserved dynamic type for the future use-case. Using it should be avoided, + // But it is still here, just in case we want to enable some additional functionality. + reservedDynamic: BytesLike; } export interface EIP712Tx { - txType: BigNumberish; - from: BigNumberish; - to: BigNumberish; - value: BigNumberish; - gasLimit: BigNumberish; - gasPerPubdataByteLimit: BigNumberish; - gasPrice: BigNumberish; - nonce: BigNumberish; - data: BytesLike; - signature: BytesLike; + txType: BigNumberish; + from: BigNumberish; + to: BigNumberish; + value: BigNumberish; + gasLimit: BigNumberish; + gasPerPubdataByteLimit: BigNumberish; + gasPrice: BigNumberish; + nonce: BigNumberish; + data: BytesLike; + signature: BytesLike; } export type Address = string; export const EIP712_TX_TYPE = { - Transaction: [ - { name: 'txType', type: 'uint8' }, - { name: 'to', type: 'uint256' }, - { name: 'value', type: 'uint256' }, - { name: 'data', type: 'bytes' }, - { name: 'gasLimit', type: 'uint256' }, - { name: 'gasPerPubdataByteLimit', type: 'uint256' }, - { name: 'gasPrice', type: 'uint256' }, - { name: 'nonce', type: 'uint256' } - ] + Transaction: [ + { name: "txType", type: "uint8" }, + { name: "to", type: "uint256" }, + { name: "value", type: "uint256" }, + { name: "data", type: "bytes" }, + { name: "gasLimit", type: "uint256" }, + { name: "gasPerPubdataByteLimit", type: "uint256" }, + { name: "gasPrice", type: "uint256" }, + { name: "nonce", type: "uint256" }, + ], }; -export type DynamicType = 'bytes' | 'bytes32[]'; -export type FixedType = 'address' | 'uint256' | 'uint128' | 'uint32'; +export type DynamicType = "bytes" | "bytes32[]"; +export type FixedType = "address" | "uint256" | "uint128" | "uint32"; export type FieldType = FixedType | DynamicType; function isDynamicType(x: FieldType): x is DynamicType { - return x == 'bytes' || x == 'bytes32[]'; + return x == "bytes" || x == "bytes32[]"; } function isFixedType(x: FieldType): x is FixedType { - return !isDynamicType(x); + return !isDynamicType(x); } -export const TransactionFields: Record = { - txType: 'uint256', - from: 'address', - to: 'address', - gasLimit: 'uint32', - gasPerPubdataByteLimit: 'uint32', - maxFeePerGas: 'uint256', - maxPriorityFeePerGas: 'uint256', - paymaster: 'address', - // In the future, we might want to add some - // new fields to the struct. The `txData` struct - // is to be passed to account and any changes to its structure - // would mean a breaking change to these accounts. In order to prevent this, - // we should keep some fields as "reserved". - // It is also recommended that their length is fixed, since - // it would allow easier proof integration (in case we will need - // some special circuit for preprocessing transactions). - reserved: Array(6).fill('uint256'), - data: 'bytes', - signature: 'bytes', - factoryDeps: 'bytes32[]', - paymasterInput: 'bytes', - // Reserved dynamic type for the future use-case. Using it should be avoided, - // But it is still here, just in case we want to enable some additional functionality. - reservedDynamic: 'bytes' -} +export const TransactionFields: Record = { + txType: "uint256", + from: "address", + to: "address", + gasLimit: "uint32", + gasPerPubdataByteLimit: "uint32", + maxFeePerGas: "uint256", + maxPriorityFeePerGas: "uint256", + paymaster: "address", + // In the future, we might want to add some + // new fields to the struct. The `txData` struct + // is to be passed to account and any changes to its structure + // would mean a breaking change to these accounts. In order to prevent this, + // we should keep some fields as "reserved". + // It is also recommended that their length is fixed, since + // it would allow easier proof integration (in case we will need + // some special circuit for preprocessing transactions). + reserved: Array(6).fill("uint256"), + data: "bytes", + signature: "bytes", + factoryDeps: "bytes32[]", + paymasterInput: "bytes", + // Reserved dynamic type for the future use-case. Using it should be avoided, + // But it is still here, just in case we want to enable some additional functionality. + reservedDynamic: "bytes", +}; function capitalize(s: string) { - if(!s.length) { - return s; - } - return `${s[0].toUpperCase()}${s.substring(1)}`; + if (!s.length) { + return s; + } + return `${s[0].toUpperCase()}${s.substring(1)}`; } function memPosFromOffset(offset: number) { - return offset === 0 ? 'innerTxDataOffset' : `add(innerTxDataOffset, ${offset})`; + return offset === 0 ? "innerTxDataOffset" : `add(innerTxDataOffset, ${offset})`; } function getGetterName(fieldName: string) { - return `get${capitalize(fieldName)}`; + return `get${capitalize(fieldName)}`; } function getPtrGetterName(fieldName: string) { - return `get${capitalize(fieldName)}Ptr`; + return `get${capitalize(fieldName)}Ptr`; } function getGetter(fieldName: string, offset: number) { - const getterName = getGetterName(fieldName); - const memPos = memPosFromOffset(offset); - return ` + const getterName = getGetterName(fieldName); + const memPos = memPosFromOffset(offset); + return ` function ${getterName}(innerTxDataOffset) -> ret { ret := mload(${memPos}) } - ` + `; } function getPtrGetter(fieldName: string, offset: number) { - const getterName = getPtrGetterName(fieldName); - const memPos = memPosFromOffset(offset); - return ` + const getterName = getPtrGetterName(fieldName); + const memPos = memPosFromOffset(offset); + return ` function ${getterName}(innerTxDataOffset) -> ret { ret := mload(${memPos}) ret := add(innerTxDataOffset, ret) } - ` + `; } function getTypeValidationMethodName(type: FieldType) { - if(type == 'bytes32[]'){ - return 'validateBytes32Array' - } else { - return `validate${capitalize(type)}`; - } + if (type == "bytes32[]") { + return "validateBytes32Array"; + } else { + return `validate${capitalize(type)}`; + } } function getBytesLengthGetterName(fieldName: string): string { - return `get${capitalize(fieldName)}BytesLength`; + return `get${capitalize(fieldName)}BytesLength`; } function getBytesLengthGetter(fieldName: string, type: DynamicType) { - let lengthToBytes: string; - if(type == 'bytes') { - lengthToBytes = `lengthToWords(mload(ptr))`; - } else if(type == 'bytes32[]') { - lengthToBytes = `mul(mload(ptr),32)`; - } else { - throw new Error(`Type ${type} is not supported`) - } - - const getterName = getBytesLengthGetterName(fieldName); - return ` + let lengthToBytes: string; + if (type == "bytes") { + lengthToBytes = "lengthToWords(mload(ptr))"; + } else if (type == "bytes32[]") { + lengthToBytes = "mul(mload(ptr),32)"; + } else { + throw new Error(`Type ${type} is not supported`); + } + + const getterName = getBytesLengthGetterName(fieldName); + return ` function ${getterName}(innerTxDataOffset) -> ret { let ptr := ${getPtrGetterName(fieldName)}(innerTxDataOffset) ret := ${lengthToBytes} } - ` + `; } function getDataLength(baseLength: number, dynamicFields: [string, DynamicType][]) { - const ptrAdders = dynamicFields.map(([fieldName,]) => { - return ` - ret := add(ret, ${getBytesLengthGetterName(fieldName)}(innerTxDataOffset))` - }).join(''); - - return ` + const ptrAdders = dynamicFields + .map(([fieldName]) => { + return ` + ret := add(ret, ${getBytesLengthGetterName(fieldName)}(innerTxDataOffset))`; + }) + .join(""); + + return ` function getDataLength(innerTxDataOffset) -> ret { // To get the length of the txData in bytes, we can simply // get the number of fields * 32 + the length of the dynamic types @@ -312,17 +315,17 @@ function getDataLength(baseLength: number, dynamicFields: [string, DynamicType][ ${ptrAdders} } - ` + `; } function validateFixedSizeField(fieldName: string, type: FixedType): string { - if(type == 'uint256') { - // There is no validation for uint256 - return ``; - } - const assertionErrorStr = getEncodingError(fieldName); - const fieldValue = `${fieldName}Value` - return ` + if (type == "uint256") { + // There is no validation for uint256 + return ""; + } + const assertionErrorStr = getEncodingError(fieldName); + const fieldValue = `${fieldName}Value`; + return ` let ${fieldValue} := ${getGetterName(fieldName)}(innerTxDataOffset) if iszero(${getTypeValidationMethodName(type)}(${fieldValue})) { assertionError("${assertionErrorStr}") @@ -331,37 +334,39 @@ function validateFixedSizeField(fieldName: string, type: FixedType): string { } function getEncodingError(fieldName: string) { - // Unfortunately we have to keep this not-so-readable name - // because the maximum length is 32. - const assertionError = `Encoding ${fieldName}`; + // Unfortunately we have to keep this not-so-readable name + // because the maximum length is 32. + const assertionError = `Encoding ${fieldName}`; - if(assertionError.length > 32) { - throw new Error(`Assertion str too long: ${assertionError}`) - } + if (assertionError.length > 32) { + throw new Error(`Assertion str too long: ${assertionError}`); + } - return assertionError; + return assertionError; } function getValidateTxStructure( - fixedFieldsChecks: string, - fixedLenPart: number, - dynamicFields: [string, DynamicType][] + fixedFieldsChecks: string, + fixedLenPart: number, + dynamicFields: [string, DynamicType][] ): string { - const dynamicChecks = dynamicFields.map(([fieldName, type]) => { - const lengthPos = `${fieldName}LengthPos`; - const assertionError = getEncodingError(fieldName); - const validationMethod = getTypeValidationMethodName(type); + const dynamicChecks = dynamicFields + .map(([fieldName, type]) => { + const lengthPos = `${fieldName}LengthPos`; + const assertionError = getEncodingError(fieldName); + const validationMethod = getTypeValidationMethodName(type); - return ` + return ` let ${lengthPos} := ${getPtrGetterName(fieldName)}(innerTxDataOffset) if iszero(eq(${lengthPos}, expectedDynamicLenPtr)) { assertionError("${assertionError}") } expectedDynamicLenPtr := ${validationMethod}(${lengthPos}) - ` - }).join('\n'); + `; + }) + .join("\n"); - return ` + return ` /// This method checks that the transaction's structure is correct /// and tightly packed function validateAbiEncoding(innerTxDataOffset) -> ret { @@ -373,46 +378,42 @@ function getValidateTxStructure( } export function getTransactionUtils(): string { - let result = `/// + let result = `/// /// TransactionData utilities ///\n`; - let innerOffsetBytes = 0; - let checksStr = ``; - - const dynamicFields: [string, DynamicType][] = []; - for(const [key, value] of Object.entries(TransactionFields)) { - if (Array.isArray(value)) { - // We assume that the - for(let i = 0; i < value.length; i++) { - const keyName = `${key}${i}`; - result += getGetter(keyName, innerOffsetBytes); - checksStr += validateFixedSizeField(keyName, value[i]); - innerOffsetBytes += 32; - } - } else if (isFixedType(value)) { - result += getGetter(key, innerOffsetBytes); - checksStr += validateFixedSizeField(key, value); - innerOffsetBytes += 32; - } else { - result += getPtrGetter(key, innerOffsetBytes); - result += getBytesLengthGetter(key, value); - dynamicFields.push([key, value]); - innerOffsetBytes += 32; - } + let innerOffsetBytes = 0; + let checksStr = ""; + + const dynamicFields: [string, DynamicType][] = []; + for (const [key, value] of Object.entries(TransactionFields)) { + if (Array.isArray(value)) { + // We assume that the + for (let i = 0; i < value.length; i++) { + const keyName = `${key}${i}`; + result += getGetter(keyName, innerOffsetBytes); + checksStr += validateFixedSizeField(keyName, value[i]); + innerOffsetBytes += 32; + } + } else if (isFixedType(value)) { + result += getGetter(key, innerOffsetBytes); + checksStr += validateFixedSizeField(key, value); + innerOffsetBytes += 32; + } else { + result += getPtrGetter(key, innerOffsetBytes); + result += getBytesLengthGetter(key, value); + dynamicFields.push([key, value]); + innerOffsetBytes += 32; } + } - result += getValidateTxStructure( - checksStr, - innerOffsetBytes, - dynamicFields - ); + result += getValidateTxStructure(checksStr, innerOffsetBytes, dynamicFields); - result += getDataLength(innerOffsetBytes, dynamicFields); + result += getDataLength(innerOffsetBytes, dynamicFields); - return result; + return result; } export function getRevertSelector(): string { - return ethers.utils.keccak256(ethers.utils.toUtf8Bytes('Error(string)')).substring(0, 10); + return ethers.utils.keccak256(ethers.utils.toUtf8Bytes("Error(string)")).substring(0, 10); } diff --git a/scripts/deploy-preimages.ts b/scripts/deploy-preimages.ts index ac1c1093..716533c7 100644 --- a/scripts/deploy-preimages.ts +++ b/scripts/deploy-preimages.ts @@ -1,316 +1,302 @@ -import * as hre from 'hardhat'; - -import { Command } from 'commander'; -import {Provider, Wallet} from 'zksync-web3'; -import { Deployer } from '@matterlabs/hardhat-zksync-deploy'; - -import * as path from 'path'; -import * as fs from 'fs'; - -import { Language, SYSTEM_CONTRACTS } from './constants'; -import { formatUnits, parseUnits } from 'ethers/lib/utils'; -import { BigNumber, ethers } from 'ethers'; -import {readYulBytecode, publishFactoryDeps, DeployedDependency, Dependency, filterPublishedFactoryDeps } from './utils'; -import { hashBytecode } from 'zksync-web3/build/src/utils'; - -const testConfigPath = path.join(process.env.ZKSYNC_HOME as string, `etc/test_config/constant`); -const ethTestConfig = JSON.parse(fs.readFileSync(`${testConfigPath}/eth.json`, { encoding: 'utf-8' })); +import * as hre from "hardhat"; + +import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; +import { Command } from "commander"; +import type { BigNumber } from "ethers"; +import { ethers } from "ethers"; +import { formatUnits, parseUnits } from "ethers/lib/utils"; +import * as fs from "fs"; +import * as path from "path"; +import { Provider, Wallet } from "zksync-web3"; +import { hashBytecode } from "zksync-web3/build/src/utils"; +import { Language, SYSTEM_CONTRACTS } from "./constants"; +import type { Dependency, DeployedDependency } from "./utils"; +import { filterPublishedFactoryDeps, publishFactoryDeps, readYulBytecode } from "./utils"; + +const testConfigPath = path.join(process.env.ZKSYNC_HOME as string, "etc/test_config/constant"); +const ethTestConfig = JSON.parse(fs.readFileSync(`${testConfigPath}/eth.json`, { encoding: "utf-8" })); // Maximum length of the combined length of dependencies const MAX_COMBINED_LENGTH = 90000; -const DEFAULT_ACCOUNT_CONTRACT_NAME = 'DefaultAccount'; -const BOOTLOADER_CONTRACT_NAME = 'Bootloader'; +const DEFAULT_ACCOUNT_CONTRACT_NAME = "DefaultAccount"; +const BOOTLOADER_CONTRACT_NAME = "Bootloader"; class ZkSyncDeployer { - deployer: Deployer; - gasPrice: BigNumber; - nonce: number; - dependenciesToUpgrade: DeployedDependency[]; - defaultAccountToUpgrade?: DeployedDependency; - bootloaderToUpgrade?: DeployedDependency; - constructor(deployer: Deployer, gasPrice: BigNumber, nonce: number) { - this.deployer = deployer; - this.gasPrice = gasPrice; - this.nonce = nonce; - this.dependenciesToUpgrade = []; - } - - async publishFactoryDeps( - dependencies: Dependency[], - ) { - await publishFactoryDeps( - dependencies, - this.deployer, - this.nonce, - this.gasPrice - ); - this.nonce += 1; - } - - // Returns the current default account bytecode on zkSync - async currentDefaultAccountBytecode(): Promise { - const zkSync = await this.deployer.zkWallet.getMainContract(); - return await zkSync.getL2DefaultAccountBytecodeHash() - } - - // If needed, appends the default account bytecode to the upgrade - async checkShouldUpgradeDefaultAA(defaultAccountBytecode: string) { - const bytecodeHash = ethers.utils.hexlify(hashBytecode(defaultAccountBytecode)); - const currentDefaultAccountBytecode = ethers.utils.hexlify(await this.currentDefaultAccountBytecode()); - - // If the bytecode is not the same as the one deployed on zkSync, we need to add it to the deployment - if (bytecodeHash.toLowerCase() !== currentDefaultAccountBytecode) { - this.defaultAccountToUpgrade = { - name: DEFAULT_ACCOUNT_CONTRACT_NAME, - bytecodeHashes: [bytecodeHash] - } - } - } - - // Publish default account bytecode - async publishDefaultAA(defaultAccountBytecode: string) { - const [defaultAccountBytecodes, ] = await filterPublishedFactoryDeps(DEFAULT_ACCOUNT_CONTRACT_NAME, [defaultAccountBytecode], this.deployer); - - if (defaultAccountBytecodes.length == 0) { - console.log('Default account bytecode is already published, skipping'); - return; - } - - await this.publishFactoryDeps( - [{ - name: DEFAULT_ACCOUNT_CONTRACT_NAME, - bytecodes: defaultAccountBytecodes, - }], - ); - this.nonce += 1; - } - - // Publishes the bytecode of default AA and appends it to the deployed bytecodes if needed. - async processDefaultAA() { - const defaultAccountBytecode = (await this.deployer.loadArtifact(DEFAULT_ACCOUNT_CONTRACT_NAME)).bytecode; - - await this.publishDefaultAA(defaultAccountBytecode); - await this.checkShouldUpgradeDefaultAA(defaultAccountBytecode); + deployer: Deployer; + gasPrice: BigNumber; + nonce: number; + dependenciesToUpgrade: DeployedDependency[]; + defaultAccountToUpgrade?: DeployedDependency; + bootloaderToUpgrade?: DeployedDependency; + constructor(deployer: Deployer, gasPrice: BigNumber, nonce: number) { + this.deployer = deployer; + this.gasPrice = gasPrice; + this.nonce = nonce; + this.dependenciesToUpgrade = []; + } + + async publishFactoryDeps(dependencies: Dependency[]) { + await publishFactoryDeps(dependencies, this.deployer, this.nonce, this.gasPrice); + this.nonce += 1; + } + + // Returns the current default account bytecode on zkSync + async currentDefaultAccountBytecode(): Promise { + const zkSync = await this.deployer.zkWallet.getMainContract(); + return await zkSync.getL2DefaultAccountBytecodeHash(); + } + + // If needed, appends the default account bytecode to the upgrade + async checkShouldUpgradeDefaultAA(defaultAccountBytecode: string) { + const bytecodeHash = ethers.utils.hexlify(hashBytecode(defaultAccountBytecode)); + const currentDefaultAccountBytecode = ethers.utils.hexlify(await this.currentDefaultAccountBytecode()); + + // If the bytecode is not the same as the one deployed on zkSync, we need to add it to the deployment + if (bytecodeHash.toLowerCase() !== currentDefaultAccountBytecode) { + this.defaultAccountToUpgrade = { + name: DEFAULT_ACCOUNT_CONTRACT_NAME, + bytecodeHashes: [bytecodeHash], + }; } - - async currentBootloaderBytecode(): Promise { - const zkSync = await this.deployer.zkWallet.getMainContract(); - return await zkSync.getL2BootloaderBytecodeHash(); + } + + // Publish default account bytecode + async publishDefaultAA(defaultAccountBytecode: string) { + const [defaultAccountBytecodes] = await filterPublishedFactoryDeps( + DEFAULT_ACCOUNT_CONTRACT_NAME, + [defaultAccountBytecode], + this.deployer + ); + + if (defaultAccountBytecodes.length == 0) { + console.log("Default account bytecode is already published, skipping"); + return; } - async checkShouldUpgradeBootloader(bootloaderCode: string) { - const bytecodeHash = ethers.utils.hexlify(hashBytecode(bootloaderCode)); - const currentBootloaderBytecode = ethers.utils.hexlify(await this.currentBootloaderBytecode()); - - // If the bytecode is not the same as the one deployed on zkSync, we need to add it to the deployment - if (bytecodeHash.toLowerCase() !== currentBootloaderBytecode) { - this.bootloaderToUpgrade = { - name: BOOTLOADER_CONTRACT_NAME, - bytecodeHashes: [bytecodeHash] - } - } + await this.publishFactoryDeps([ + { + name: DEFAULT_ACCOUNT_CONTRACT_NAME, + bytecodes: defaultAccountBytecodes, + }, + ]); + this.nonce += 1; + } + + // Publishes the bytecode of default AA and appends it to the deployed bytecodes if needed. + async processDefaultAA() { + const defaultAccountBytecode = (await this.deployer.loadArtifact(DEFAULT_ACCOUNT_CONTRACT_NAME)).bytecode; + + await this.publishDefaultAA(defaultAccountBytecode); + await this.checkShouldUpgradeDefaultAA(defaultAccountBytecode); + } + + async currentBootloaderBytecode(): Promise { + const zkSync = await this.deployer.zkWallet.getMainContract(); + return await zkSync.getL2BootloaderBytecodeHash(); + } + + async checkShouldUpgradeBootloader(bootloaderCode: string) { + const bytecodeHash = ethers.utils.hexlify(hashBytecode(bootloaderCode)); + const currentBootloaderBytecode = ethers.utils.hexlify(await this.currentBootloaderBytecode()); + + // If the bytecode is not the same as the one deployed on zkSync, we need to add it to the deployment + if (bytecodeHash.toLowerCase() !== currentBootloaderBytecode) { + this.bootloaderToUpgrade = { + name: BOOTLOADER_CONTRACT_NAME, + bytecodeHashes: [bytecodeHash], + }; } + } - async publishBootloader(bootloaderCode: string) { - console.log('\nPublishing bootloader bytecode:'); - - const [deps, ] = await filterPublishedFactoryDeps(BOOTLOADER_CONTRACT_NAME, [bootloaderCode], this.deployer); + async publishBootloader(bootloaderCode: string) { + console.log("\nPublishing bootloader bytecode:"); - if (deps.length == 0) { - console.log('Default bootloader bytecode is already published, skipping'); - return; - } - - await this.publishFactoryDeps( - [{ - name: BOOTLOADER_CONTRACT_NAME, - bytecodes: deps, - }], - ); - } - - async processBootloader() { - const bootloaderCode = ethers.utils.hexlify(fs.readFileSync('./bootloader/build/artifacts/proved_block.yul/proved_block.yul.zbin')); - - await this.publishBootloader(bootloaderCode); - await this.checkShouldUpgradeBootloader(bootloaderCode); - } + const [deps] = await filterPublishedFactoryDeps(BOOTLOADER_CONTRACT_NAME, [bootloaderCode], this.deployer); - async shouldUpgradeSystemContract( - contractAddress: string, - expectedBytecodeHash: string - ): Promise { - // We could have also used the `getCode` method of the JSON-RPC, but in the context - // of system upgrades looking into account code storage is more robust - const currentBytecodeHash = await this.deployer.zkWallet.provider.getStorageAt( - SYSTEM_CONTRACTS.accountCodeStorage.address, - contractAddress - ); - - return expectedBytecodeHash.toLowerCase() !== currentBytecodeHash.toLowerCase(); + if (deps.length == 0) { + console.log("Default bootloader bytecode is already published, skipping"); + return; } - // Returns the contracts to be published. - async prepareContractsForPublishing(): Promise { - const dependenciesToPublish: Dependency[] = []; - for(const contract of Object.values(SYSTEM_CONTRACTS)) { - let contractName = contract.codeName; - let factoryDeps: string[] = []; - if (contract.lang == Language.Solidity) { - const artifact = await this.deployer.loadArtifact(contractName); - factoryDeps = [ - ...await this.deployer.extractFactoryDeps(artifact), - artifact.bytecode - ]; - } else { - // Yul files have only one dependency - factoryDeps = [ - readYulBytecode(contract) - ]; - } - - const contractBytecodeHash = ethers.utils.hexlify(hashBytecode(factoryDeps[factoryDeps.length - 1])); - if (await this.shouldUpgradeSystemContract(contract.address, contractBytecodeHash)) { - this.dependenciesToUpgrade.push({ - name: contractName, - bytecodeHashes: [contractBytecodeHash], - address: contract.address - }) - } - - let [bytecodesToPublish, currentLength] = await filterPublishedFactoryDeps(contractName, factoryDeps, this.deployer); - if (bytecodesToPublish.length == 0) { - console.log(`All bytecodes for ${contractName} are already published, skipping`); - continue; - } - if(currentLength > MAX_COMBINED_LENGTH) { - throw new Error(`Can not publish dependencies of contract ${contractName}`); - } - - dependenciesToPublish.push({ - name: contractName, - bytecodes: bytecodesToPublish, - address: contract.address - }); - } - - return dependenciesToPublish; + await this.publishFactoryDeps([ + { + name: BOOTLOADER_CONTRACT_NAME, + bytecodes: deps, + }, + ]); + } + + async processBootloader() { + const bootloaderCode = ethers.utils.hexlify( + fs.readFileSync("./bootloader/build/artifacts/proved_batch.yul/proved_batch.yul.zbin") + ); + + await this.publishBootloader(bootloaderCode); + await this.checkShouldUpgradeBootloader(bootloaderCode); + } + + async shouldUpgradeSystemContract(contractAddress: string, expectedBytecodeHash: string): Promise { + // We could have also used the `getCode` method of the JSON-RPC, but in the context + // of system upgrades looking into account code storage is more robust + const currentBytecodeHash = await this.deployer.zkWallet.provider.getStorageAt( + SYSTEM_CONTRACTS.accountCodeStorage.address, + contractAddress + ); + + return expectedBytecodeHash.toLowerCase() !== currentBytecodeHash.toLowerCase(); + } + + // Returns the contracts to be published. + async prepareContractsForPublishing(): Promise { + const dependenciesToPublish: Dependency[] = []; + for (const contract of Object.values(SYSTEM_CONTRACTS)) { + const contractName = contract.codeName; + let factoryDeps: string[] = []; + if (contract.lang == Language.Solidity) { + const artifact = await this.deployer.loadArtifact(contractName); + factoryDeps = [...(await this.deployer.extractFactoryDeps(artifact)), artifact.bytecode]; + } else { + // Yul files have only one dependency + factoryDeps = [readYulBytecode(contract)]; + } + + const contractBytecodeHash = ethers.utils.hexlify(hashBytecode(factoryDeps[factoryDeps.length - 1])); + if (await this.shouldUpgradeSystemContract(contract.address, contractBytecodeHash)) { + this.dependenciesToUpgrade.push({ + name: contractName, + bytecodeHashes: [contractBytecodeHash], + address: contract.address, + }); + } + + const [bytecodesToPublish, currentLength] = await filterPublishedFactoryDeps( + contractName, + factoryDeps, + this.deployer + ); + if (bytecodesToPublish.length == 0) { + console.log(`All bytecodes for ${contractName} are already published, skipping`); + continue; + } + if (currentLength > MAX_COMBINED_LENGTH) { + throw new Error(`Can not publish dependencies of contract ${contractName}`); + } + + dependenciesToPublish.push({ + name: contractName, + bytecodes: bytecodesToPublish, + address: contract.address, + }); } - async publishDependencies(dependenciesToPublish: Dependency[]) { - let currentLength = 0; - let currentDependencies: Dependency[] = []; - // We iterate over dependencies and try to batch the publishing of those in order to save up on gas as well as time. - for (let dependency of dependenciesToPublish) { - const dependencyLength = dependency.bytecodes.reduce((prev, dep) => prev + ethers.utils.arrayify(dep).length, 0); - if (currentLength + dependencyLength > MAX_COMBINED_LENGTH) { - await this.publishFactoryDeps( - currentDependencies, - ); - currentLength = dependencyLength; - currentDependencies = [dependency]; - } else { - currentLength += dependencyLength; - currentDependencies.push(dependency); - } - } - if (currentDependencies.length > 0) { - await this.publishFactoryDeps( - currentDependencies, - ); - } + return dependenciesToPublish; + } + + async publishDependencies(dependenciesToPublish: Dependency[]) { + let currentLength = 0; + let currentDependencies: Dependency[] = []; + // We iterate over dependencies and try to batch the publishing of those in order to save up on gas as well as time. + for (const dependency of dependenciesToPublish) { + const dependencyLength = dependency.bytecodes.reduce((prev, dep) => prev + ethers.utils.arrayify(dep).length, 0); + if (currentLength + dependencyLength > MAX_COMBINED_LENGTH) { + await this.publishFactoryDeps(currentDependencies); + currentLength = dependencyLength; + currentDependencies = [dependency]; + } else { + currentLength += dependencyLength; + currentDependencies.push(dependency); + } } - - returnResult() { - return { - systemContracts: this.dependenciesToUpgrade, - defaultAA: this.defaultAccountToUpgrade, - bootloader: this.bootloaderToUpgrade, - } + if (currentDependencies.length > 0) { + await this.publishFactoryDeps(currentDependencies); } + } + + returnResult() { + return { + systemContracts: this.dependenciesToUpgrade, + defaultAA: this.defaultAccountToUpgrade, + bootloader: this.bootloaderToUpgrade, + }; + } } - export function l1RpcUrl() { - return process.env.ETH_CLIENT_WEB3_URL as string; + return process.env.ETH_CLIENT_WEB3_URL as string; } export function l2RpcUrl() { - return process.env.API_WEB3_JSON_RPC_HTTP_URL as string; + return process.env.API_WEB3_JSON_RPC_HTTP_URL as string; } async function main() { - const program = new Command(); - - program.version('0.1.0').name('publish preimages').description('publish preimages for the L2 contracts'); - - program - .option('--private-key ') - .option('--gas-price ') - .option('--nonce ') - .option('--l1Rpc ') - .option('--l2Rpc ') - .option('--bootloader') - .option('--default-aa') - .option('--system-contracts') - .option('--file ') - .action(async (cmd) => { - const l1Rpc = cmd.l1Rpc ? cmd.l1Rpc : l1RpcUrl(); - const l2Rpc = cmd.l2Rpc ? cmd.l2Rpc : l2RpcUrl(); - const providerL1 = new ethers.providers.JsonRpcProvider(l1Rpc); - const providerL2 = new Provider(l2Rpc); - const wallet= cmd.privateKey - ? new Wallet(cmd.privateKey) - : Wallet.fromMnemonic( - process.env.MNEMONIC ? process.env.MNEMONIC : ethTestConfig.mnemonic, - "m/44'/60'/0'/0/1" - ); - wallet.connect(providerL2); - wallet.connectToL1(providerL1); - - const deployer = new Deployer(hre, wallet); - deployer.zkWallet = deployer.zkWallet.connect(providerL2).connectToL1(providerL1); - deployer.ethWallet = deployer.ethWallet.connect(providerL1); - const ethWallet = deployer.ethWallet; - - console.log(`Using deployer wallet: ${ethWallet.address}`); - - const gasPrice = cmd.gasPrice ? parseUnits(cmd.gasPrice, 'gwei') : await providerL1.getGasPrice(); - console.log(`Using gas price: ${formatUnits(gasPrice, 'gwei')} gwei`); - - let nonce = cmd.nonce ? parseInt(cmd.nonce) : await ethWallet.getTransactionCount(); - console.log(`Using nonce: ${nonce}`); - - const zkSyncDeployer = new ZkSyncDeployer(deployer, gasPrice, nonce); - if (cmd.bootloader) { - await zkSyncDeployer.processBootloader(); - } - - if (cmd.defaultAa) { - await zkSyncDeployer.processDefaultAA(); - } - - if (cmd.systemContracts) { - const dependenciesToPublish = await zkSyncDeployer.prepareContractsForPublishing(); - await zkSyncDeployer.publishDependencies(dependenciesToPublish); - } - - const result = zkSyncDeployer.returnResult(); - console.log(JSON.stringify(result, null, 2)); - if (cmd.file) { - fs.writeFileSync(cmd.file, JSON.stringify(result, null, 2)); - } - console.log('\nPublishing factory dependencies complete!'); - - }); + const program = new Command(); + + program.version("0.1.0").name("publish preimages").description("publish preimages for the L2 contracts"); + + program + .option("--private-key ") + .option("--gas-price ") + .option("--nonce ") + .option("--l1Rpc ") + .option("--l2Rpc ") + .option("--bootloader") + .option("--default-aa") + .option("--system-contracts") + .option("--file ") + .action(async (cmd) => { + const l1Rpc = cmd.l1Rpc ? cmd.l1Rpc : l1RpcUrl(); + const l2Rpc = cmd.l2Rpc ? cmd.l2Rpc : l2RpcUrl(); + const providerL1 = new ethers.providers.JsonRpcProvider(l1Rpc); + const providerL2 = new Provider(l2Rpc); + const wallet = cmd.privateKey + ? new Wallet(cmd.privateKey) + : Wallet.fromMnemonic(process.env.MNEMONIC ? process.env.MNEMONIC : ethTestConfig.mnemonic, "m/44'/60'/0'/0/1"); + wallet.connect(providerL2); + wallet.connectToL1(providerL1); + + const deployer = new Deployer(hre, wallet); + deployer.zkWallet = deployer.zkWallet.connect(providerL2).connectToL1(providerL1); + deployer.ethWallet = deployer.ethWallet.connect(providerL1); + const ethWallet = deployer.ethWallet; + + console.log(`Using deployer wallet: ${ethWallet.address}`); + + const gasPrice = cmd.gasPrice ? parseUnits(cmd.gasPrice, "gwei") : await providerL1.getGasPrice(); + console.log(`Using gas price: ${formatUnits(gasPrice, "gwei")} gwei`); + + const nonce = cmd.nonce ? parseInt(cmd.nonce) : await ethWallet.getTransactionCount(); + console.log(`Using nonce: ${nonce}`); + + const zkSyncDeployer = new ZkSyncDeployer(deployer, gasPrice, nonce); + if (cmd.bootloader) { + await zkSyncDeployer.processBootloader(); + } + + if (cmd.defaultAa) { + await zkSyncDeployer.processDefaultAA(); + } + + if (cmd.systemContracts) { + const dependenciesToPublish = await zkSyncDeployer.prepareContractsForPublishing(); + await zkSyncDeployer.publishDependencies(dependenciesToPublish); + } + + const result = zkSyncDeployer.returnResult(); + console.log(JSON.stringify(result, null, 2)); + if (cmd.file) { + fs.writeFileSync(cmd.file, JSON.stringify(result, null, 2)); + } + console.log("\nPublishing factory dependencies complete!"); + }); - await program.parseAsync(process.argv); + await program.parseAsync(process.argv); } main() - .then(() => process.exit(0)) - .catch((err) => { - console.error('Error:', err); - process.exit(1); - }); + .then(() => process.exit(0)) + .catch((err) => { + console.error("Error:", err); + process.exit(1); + }); diff --git a/scripts/process.ts b/scripts/process.ts index 2358e6d1..f7339f99 100644 --- a/scripts/process.ts +++ b/scripts/process.ts @@ -1,177 +1,256 @@ -const preprocess = require('preprocess'); +import * as hre from "hardhat"; -import { existsSync, mkdirSync, write, writeFileSync } from 'fs'; -import { SYSTEM_CONTRACTS, getRevertSelector, getTransactionUtils } from './constants'; -import * as hre from 'hardhat'; -import { ethers } from 'ethers'; -import { renderFile } from 'template-file'; -import { utils } from 'zksync-web3'; -import { ForceDeployment } from './utils'; -const OUTPUT_DIR = 'bootloader/build'; +import { ethers } from "ethers"; +import { existsSync, mkdirSync, writeFileSync } from "fs"; +import { join } from "path"; +import { renderFile } from "template-file"; +import { utils } from "zksync-web3"; +import { SYSTEM_CONTRACTS, getRevertSelector, getTransactionUtils } from "./constants"; +import type { ForceDeployment } from "./utils"; +/* eslint-disable @typescript-eslint/no-var-requires */ +const preprocess = require("preprocess"); +const SYSTEM_PARAMS = require("../SystemConfig.json"); +/* eslint-enable@typescript-eslint/no-var-requires */ + +const OUTPUT_DIR = "bootloader/build"; + +function path(...args: string[]): string { + return join(__dirname, ...args); +} function getSelector(contractName: string, method: string): string { - const artifact = hre.artifacts.readArtifactSync(contractName); - const contractInterface = new ethers.utils.Interface(artifact.abi); + const artifact = hre.artifacts.readArtifactSync(contractName); + const contractInterface = new ethers.utils.Interface(artifact.abi); - return contractInterface.getSighash(method); + return contractInterface.getSighash(method); } // Methods from ethers do zero pad from left, but we need to pad from the right function padZeroRight(hexData: string, length: number): string { - while (hexData.length < length) { - hexData += '0'; - } + while (hexData.length < length) { + hexData += "0"; + } - return hexData; + return hexData; } const PADDED_SELECTOR_LENGTH = 32 * 2 + 2; function getPaddedSelector(contractName: string, method: string): string { - let result = getSelector(contractName, method); + const result = getSelector(contractName, method); - return padZeroRight(result, PADDED_SELECTOR_LENGTH) + return padZeroRight(result, PADDED_SELECTOR_LENGTH); } -const SYSTEM_PARAMS = require('../SystemConfig.json'); - function getSystemContextExpectedHash() { - const artifact = hre.artifacts.readArtifactSync('SystemContext'); - return ethers.utils.hexlify(utils.hashBytecode(artifact.bytecode)); + const artifact = hre.artifacts.readArtifactSync("SystemContext"); + return ethers.utils.hexlify(utils.hashBytecode(artifact.bytecode)); } function upgradeSystemContextCalldata() { - // Here we need to encode the force deployment for the system context contract as well as transform - // it into writing of the calldata into the bootloader memory. - - const newHash = getSystemContextExpectedHash(); - const artifact = new ethers.utils.Interface(hre.artifacts.readArtifactSync('ContractDeployer').abi); - - const forceDeplyment: ForceDeployment = { - bytecodeHash: newHash, - newAddress: SYSTEM_CONTRACTS.systemContext.address, - callConstructor: false, - value: 0, - input: '0x' - }; - - let calldata = artifact.encodeFunctionData('forceDeployOnAddresses', [[forceDeplyment]]); - const originalLength = (calldata.length - 2) / 2; - - // Padding calldata from the right. We really need to do it, since Yul would "implicitly" pad it from the left and it - // it is not what we want. - while((calldata.length - 2) % 64 != 0) { - calldata += '0'; - } + // Here we need to encode the force deployment for the system context contract as well as transform + // it into writing of the calldata into the bootloader memory. - // We will apply tabulation to make the compiled bootloader code more readable - const TABULATION = '\t\t\t\t\t'; - // In the first slot we need to store the calldata's length - let data = `mstore(0x00, ${originalLength})\n`; - - const slices = (calldata.length - 2) / 64; + const newHash = getSystemContextExpectedHash(); + const artifact = new ethers.utils.Interface(hre.artifacts.readArtifactSync("ContractDeployer").abi); - for(let slice = 0; slice < slices; slice++) { - const offset = slice * 32; - const sliceHex = calldata.slice(2 + offset * 2, 2 + offset * 2 + 64); + const forceDeplyment: ForceDeployment = { + bytecodeHash: newHash, + newAddress: SYSTEM_CONTRACTS.systemContext.address, + callConstructor: false, + value: 0, + input: "0x", + }; - data += `${TABULATION}mstore(${offset + 32}, 0x${sliceHex})\n`; - } + let calldata = artifact.encodeFunctionData("forceDeployOnAddresses", [[forceDeplyment]]); + const originalLength = (calldata.length - 2) / 2; + + // Padding calldata from the right. We really need to do it, since Yul would "implicitly" pad it from the left and it + // it is not what we want. + while ((calldata.length - 2) % 64 != 0) { + calldata += "0"; + } + + // We will apply tabulation to make the compiled bootloader code more readable + const TABULATION = "\t\t\t\t\t"; + // In the first slot we need to store the calldata's length + let data = `mstore(0x00, ${originalLength})\n`; - return data; + const slices = (calldata.length - 2) / 64; + + for (let slice = 0; slice < slices; slice++) { + const offset = slice * 32; + const sliceHex = calldata.slice(2 + offset * 2, 2 + offset * 2 + 64); + + data += `${TABULATION}mstore(${offset + 32}, 0x${sliceHex})\n`; + } + + return data; } // Maybe in the future some of these params will be passed // in a JSON file. For now, a simple object is ok here. -let params = { - MARK_BATCH_AS_REPUBLISHED_SELECTOR: getSelector('KnownCodesStorage', 'markFactoryDeps'), - VALIDATE_TX_SELECTOR: getSelector('IAccount', 'validateTransaction'), - EXECUTE_TX_SELECTOR: getSelector('DefaultAccount', 'executeTransaction'), - RIGHT_PADDED_GET_ACCOUNT_VERSION_SELECTOR: getPaddedSelector('ContractDeployer','extendedAccountVersion'), - RIGHT_PADDED_GET_RAW_CODE_HASH_SELECTOR: getPaddedSelector('AccountCodeStorage', 'getRawCodeHash'), - PAY_FOR_TX_SELECTOR: getSelector('DefaultAccount', 'payForTransaction'), - PRE_PAYMASTER_SELECTOR: getSelector('DefaultAccount', 'prepareForPaymaster'), - VALIDATE_AND_PAY_PAYMASTER: getSelector('IPaymaster', 'validateAndPayForPaymasterTransaction'), - // It doesn't used directly now but is important to keep the way to regenerate it when needed - TX_UTILITIES: getTransactionUtils(), - RIGHT_PADDED_POST_TRANSACTION_SELECTOR: getPaddedSelector('IPaymaster', 'postTransaction'), - RIGHT_PADDED_SET_TX_ORIGIN: getPaddedSelector('SystemContext', 'setTxOrigin'), - RIGHT_PADDED_SET_GAS_PRICE: getPaddedSelector('SystemContext', 'setGasPrice'), - RIGHT_PADDED_SET_NEW_BATCH_SELECTOR: getPaddedSelector('SystemContext', 'setNewBatch'), - RIGHT_PADDED_OVERRIDE_BATCH_SELECTOR: getPaddedSelector('SystemContext', 'unsafeOverrideBatch'), - // Error - REVERT_ERROR_SELECTOR: padZeroRight(getRevertSelector(), PADDED_SELECTOR_LENGTH), - RIGHT_PADDED_VALIDATE_NONCE_USAGE_SELECTOR: getPaddedSelector('INonceHolder', 'validateNonceUsage'), - RIGHT_PADDED_MINT_ETHER_SELECTOR: getPaddedSelector('L2EthToken', 'mint'), - GET_TX_HASHES_SELECTOR: getSelector('BootloaderUtilities', 'getTransactionHashes'), - CREATE_SELECTOR: getSelector('ContractDeployer','create'), - CREATE2_SELECTOR: getSelector('ContractDeployer','create2'), - CREATE_ACCOUNT_SELECTOR: getSelector('ContractDeployer','createAccount'), - CREATE2_ACCOUNT_SELECTOR: getSelector('ContractDeployer','create2Account'), - PADDED_TRANSFER_FROM_TO_SELECTOR: getPaddedSelector('L2EthToken', 'transferFromTo'), - SUCCESSFUL_ACCOUNT_VALIDATION_MAGIC_VALUE: getPaddedSelector('IAccount', 'validateTransaction'), - SUCCESSFUL_PAYMASTER_VALIDATION_MAGIC_VALUE: getPaddedSelector('IPaymaster', 'validateAndPayForPaymasterTransaction'), - PUBLISH_COMPRESSED_BYTECODE_SELECTOR: getSelector('BytecodeCompressor', 'publishCompressedBytecode'), - GET_MARKER_PADDED_SELECTOR: getPaddedSelector('KnownCodesStorage', 'getMarker'), - RIGHT_PADDED_SET_L2_BLOCK_SELECTOR: getPaddedSelector('SystemContext', 'setL2Block'), - RIGHT_PADDED_APPEND_TRANSACTION_TO_L2_BLOCK_SELECTOR: getPaddedSelector('SystemContext', 'appendTransactionToCurrentL2Block'), - RIGHT_PADDED_PUBLISH_BATCH_DATA_TO_L1_SELECTOR: getPaddedSelector('SystemContext', 'publishBatchDataToL1'), - COMPRESSED_BYTECODES_SLOTS: 32768, - ENSURE_RETURNED_MAGIC: 1, - FORBID_ZERO_GAS_PER_PUBDATA: 1, - SYSTEM_CONTEXT_EXPECTED_CODE_HASH: getSystemContextExpectedHash(), - UPGRADE_SYSTEM_CONTEXT_CALLDATA: upgradeSystemContextCalldata(), - ...SYSTEM_PARAMS +const params = { + MARK_BATCH_AS_REPUBLISHED_SELECTOR: getSelector("KnownCodesStorage", "markFactoryDeps"), + VALIDATE_TX_SELECTOR: getSelector("IAccount", "validateTransaction"), + EXECUTE_TX_SELECTOR: getSelector("DefaultAccount", "executeTransaction"), + RIGHT_PADDED_GET_ACCOUNT_VERSION_SELECTOR: getPaddedSelector("ContractDeployer", "extendedAccountVersion"), + RIGHT_PADDED_GET_RAW_CODE_HASH_SELECTOR: getPaddedSelector("AccountCodeStorage", "getRawCodeHash"), + PAY_FOR_TX_SELECTOR: getSelector("DefaultAccount", "payForTransaction"), + PRE_PAYMASTER_SELECTOR: getSelector("DefaultAccount", "prepareForPaymaster"), + VALIDATE_AND_PAY_PAYMASTER: getSelector("IPaymaster", "validateAndPayForPaymasterTransaction"), + // It doesn't used directly now but is important to keep the way to regenerate it when needed + TX_UTILITIES: getTransactionUtils(), + RIGHT_PADDED_POST_TRANSACTION_SELECTOR: getPaddedSelector("IPaymaster", "postTransaction"), + RIGHT_PADDED_SET_TX_ORIGIN: getPaddedSelector("SystemContext", "setTxOrigin"), + RIGHT_PADDED_SET_GAS_PRICE: getPaddedSelector("SystemContext", "setGasPrice"), + RIGHT_PADDED_INCREMENT_TX_NUMBER_IN_BLOCK_SELECTOR: getPaddedSelector("SystemContext", "incrementTxNumberInBatch"), + RIGHT_PADDED_RESET_TX_NUMBER_IN_BLOCK_SELECTOR: getPaddedSelector("SystemContext", "resetTxNumberInBatch"), + RIGHT_PADDED_SEND_L2_TO_L1_LOG_SELECTOR: getPaddedSelector("L1Messenger", "sendL2ToL1Log"), + PUBLISH_PUBDATA_SELECTOR: getSelector("L1Messenger", "publishPubdataAndClearState"), + RIGHT_PADDED_SET_NEW_BATCH_SELECTOR: getPaddedSelector("SystemContext", "setNewBatch"), + RIGHT_PADDED_OVERRIDE_BATCH_SELECTOR: getPaddedSelector("SystemContext", "unsafeOverrideBatch"), + // Error + REVERT_ERROR_SELECTOR: padZeroRight(getRevertSelector(), PADDED_SELECTOR_LENGTH), + RIGHT_PADDED_VALIDATE_NONCE_USAGE_SELECTOR: getPaddedSelector("INonceHolder", "validateNonceUsage"), + RIGHT_PADDED_MINT_ETHER_SELECTOR: getPaddedSelector("L2EthToken", "mint"), + GET_TX_HASHES_SELECTOR: getSelector("BootloaderUtilities", "getTransactionHashes"), + CREATE_SELECTOR: getSelector("ContractDeployer", "create"), + CREATE2_SELECTOR: getSelector("ContractDeployer", "create2"), + CREATE_ACCOUNT_SELECTOR: getSelector("ContractDeployer", "createAccount"), + CREATE2_ACCOUNT_SELECTOR: getSelector("ContractDeployer", "create2Account"), + PADDED_TRANSFER_FROM_TO_SELECTOR: getPaddedSelector("L2EthToken", "transferFromTo"), + SUCCESSFUL_ACCOUNT_VALIDATION_MAGIC_VALUE: getPaddedSelector("IAccount", "validateTransaction"), + SUCCESSFUL_PAYMASTER_VALIDATION_MAGIC_VALUE: getPaddedSelector("IPaymaster", "validateAndPayForPaymasterTransaction"), + PUBLISH_COMPRESSED_BYTECODE_SELECTOR: getSelector("Compressor", "publishCompressedBytecode"), + GET_MARKER_PADDED_SELECTOR: getPaddedSelector("KnownCodesStorage", "getMarker"), + RIGHT_PADDED_SET_L2_BLOCK_SELECTOR: getPaddedSelector("SystemContext", "setL2Block"), + RIGHT_PADDED_APPEND_TRANSACTION_TO_L2_BLOCK_SELECTOR: getPaddedSelector( + "SystemContext", + "appendTransactionToCurrentL2Block" + ), + RIGHT_PADDED_PUBLISH_TIMESTAMP_DATA_TO_L1_SELECTOR: getPaddedSelector("SystemContext", "publishTimestampDataToL1"), + COMPRESSED_BYTECODES_SLOTS: 32768, + ENSURE_RETURNED_MAGIC: 1, + FORBID_ZERO_GAS_PER_PUBDATA: 1, + SYSTEM_CONTEXT_EXPECTED_CODE_HASH: getSystemContextExpectedHash(), + UPGRADE_SYSTEM_CONTEXT_CALLDATA: upgradeSystemContextCalldata(), + // One of "worst case" scenarios for the number of state diffs in a batch is when 120kb of pubdata is spent + // on repeated writes, that are all zeroed out. In this case, the number of diffs is 120k / 5 = 24k. This means that they will have + // accoomdate 6528000 bytes of calldata for the uncompressed state diffs. Adding 120k on top leaves us with + // roughly 6650000 bytes needed for calldata. 207813 slots are needed to accomodate this amount of data. + // We round up to 208000 slots just in case. + // + // In theory though much more calldata could be used (if for instance 1 byte is used for enum index). It is the responsibility of the + // operator to ensure that it can form the correct calldata for the L1Messenger. + OPERATOR_PROVIDED_L1_MESSENGER_PUBDATA_SLOTS: 208000, + ...SYSTEM_PARAMS, }; -async function main() { - const bootloader = await renderFile('bootloader/bootloader.yul', params); - // The overhead is unknown for gas tests and so it should be zero to calculate it - const gasTestBootloaderTemplate = await renderFile('bootloader/bootloader.yul', { - ...params, - L2_TX_INTRINSIC_GAS: 0, - L2_TX_INTRINSIC_PUBDATA: 0, - L1_TX_INTRINSIC_L2_GAS: 0, - L1_TX_INTRINSIC_PUBDATA: 0, - FORBID_ZERO_GAS_PER_PUBDATA: 0 - }) - - const feeEstimationBootloaderTemplate = await renderFile('bootloader/bootloader.yul', { - ...params, - ENSURE_RETURNED_MAGIC: 0 - }); - - console.log('Preprocessing production bootloader'); - const provedBatchBootloader = preprocess.preprocess( - bootloader, - { BOOTLOADER_TYPE: 'proved_batch' } - ); - console.log('Preprocessing playground block bootloader'); - const playgroundBatchBootloader = preprocess.preprocess( - bootloader, - { BOOTLOADER_TYPE: 'playground_batch' } - ); - console.log('Preprocessing gas test bootloader'); - const gasTestBootloader = preprocess.preprocess( - gasTestBootloaderTemplate, - { BOOTLOADER_TYPE: 'proved_batch' } - ); - console.log('Preprocessing fee estimation bootloader'); - const feeEstimationBootloader = preprocess.preprocess( - feeEstimationBootloaderTemplate, - { BOOTLOADER_TYPE: 'playground_batch' } - ); - - if(!existsSync(OUTPUT_DIR)) { - mkdirSync(OUTPUT_DIR); +function extractTestFunctionNames(sourceCode: string): string[] { + // Remove single-line comments + sourceCode = sourceCode.replace(/\/\/[^\n]*/g, ""); + + // Remove multi-line comments + sourceCode = sourceCode.replace(/\/\*[\s\S]*?\*\//g, ""); + + const regexPatterns = [/function\s+(TEST\w+)/g]; + + const results: string[] = []; + for (const pattern of regexPatterns) { + let match; + while ((match = pattern.exec(sourceCode)) !== null) { + results.push(match[1]); + } + } + + return [...new Set(results)]; // Remove duplicates +} + +function createTestFramework(tests: string[]): string { + let testFramework = ` + let test_id:= mload(0) + + switch test_id + case 0 { + testing_totalTests(${tests.length}) } + `; + + tests.forEach((value, index) => { + testFramework += ` + case ${index + 1} { + testing_start("${value}") + ${value}() + } + `; + }); + + testFramework += ` + default { + } + return (0, 0) + `; + + return testFramework; +} + +async function main() { + const bootloader = await renderFile("bootloader/bootloader.yul", params); + // The overhead is unknown for gas tests and so it should be zero to calculate it + const gasTestBootloaderTemplate = await renderFile("bootloader/bootloader.yul", { + ...params, + L2_TX_INTRINSIC_GAS: 0, + L2_TX_INTRINSIC_PUBDATA: 0, + L1_TX_INTRINSIC_L2_GAS: 0, + L1_TX_INTRINSIC_PUBDATA: 0, + FORBID_ZERO_GAS_PER_PUBDATA: 0, + }); + + const feeEstimationBootloaderTemplate = await renderFile("bootloader/bootloader.yul", { + ...params, + ENSURE_RETURNED_MAGIC: 0, + }); + + console.log("Preprocessing production bootloader"); + const provedBatchBootloader = preprocess.preprocess(bootloader, { BOOTLOADER_TYPE: "proved_batch" }); + console.log("Preprocessing playground block bootloader"); + const playgroundBatchBootloader = preprocess.preprocess(bootloader, { BOOTLOADER_TYPE: "playground_batch" }); + console.log("Preprocessing gas test bootloader"); + const gasTestBootloader = preprocess.preprocess(gasTestBootloaderTemplate, { BOOTLOADER_TYPE: "proved_batch" }); + console.log("Preprocessing fee estimation bootloader"); + const feeEstimationBootloader = preprocess.preprocess(feeEstimationBootloaderTemplate, { + BOOTLOADER_TYPE: "playground_batch", + }); + + console.log("Preprocessing bootloader tests"); + const bootloaderTests = await renderFile("bootloader/tests/bootloader/bootloader_test.yul", {}); + + const testMethods = extractTestFunctionNames(bootloaderTests); + + console.log("Found tests: " + testMethods); + + const testFramework = createTestFramework(testMethods); + + const bootloaderTestUtils = await renderFile("bootloader/tests/utils/test_utils.yul", {}); + + const bootloaderWithTests = await renderFile("bootloader/bootloader.yul", { + ...params, + CODE_START_PLACEHOLDER: "\n" + bootloaderTestUtils + "\n" + bootloaderTests + "\n" + testFramework, + }); + const provedBootloaderWithTests = preprocess.preprocess(bootloaderWithTests, { BOOTLOADER_TYPE: "proved_batch" }); + + if (!existsSync(OUTPUT_DIR)) { + mkdirSync(OUTPUT_DIR); + } - writeFileSync(`${OUTPUT_DIR}/proved_batch.yul`, provedBatchBootloader); - writeFileSync(`${OUTPUT_DIR}/playground_batch.yul`, playgroundBatchBootloader); - writeFileSync(`${OUTPUT_DIR}/gas_test.yul`, gasTestBootloader); - writeFileSync(`${OUTPUT_DIR}/fee_estimate.yul`, feeEstimationBootloader); + writeFileSync(path(`../${OUTPUT_DIR}/bootloader_test.yul`), provedBootloaderWithTests); + writeFileSync(path(`../${OUTPUT_DIR}/proved_batch.yul`), provedBatchBootloader); + writeFileSync(path(`../${OUTPUT_DIR}/playground_batch.yul`), playgroundBatchBootloader); + writeFileSync(path(`../${OUTPUT_DIR}/gas_test.yul`), gasTestBootloader); + writeFileSync(path(`../${OUTPUT_DIR}/fee_estimate.yul`), feeEstimationBootloader); - console.log('Preprocessing done!'); + console.log("Preprocessing done!"); } main(); diff --git a/scripts/quick-setup.sh b/scripts/quick-setup.sh new file mode 100755 index 00000000..341d77d2 --- /dev/null +++ b/scripts/quick-setup.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# install rust +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + +rustup toolchain install nightly + +# install era-test-node +cargo +nightly install --git https://github.com/matter-labs/era-test-node.git --locked --branch boojum-integration + +yarn +yarn build +era_test_node run > /dev/null 2>&1 & export TEST_NODE_PID=$! +yarn test +kill $TEST_NODE_PID diff --git a/scripts/utils.ts b/scripts/utils.ts index b48a3d01..81e855e0 100644 --- a/scripts/utils.ts +++ b/scripts/utils.ts @@ -1,173 +1,183 @@ -import {Language, SYSTEM_CONTRACTS, YulContractDescrption} from "./constants"; -import {BigNumber, BigNumberish, BytesLike, ethers} from "ethers"; +import * as hre from "hardhat"; + +import type { Deployer } from "@matterlabs/hardhat-zksync-deploy"; +import type { BigNumberish, BytesLike } from "ethers"; +import { BigNumber, ethers } from "ethers"; import * as fs from "fs"; -import {hashBytecode} from "zksync-web3/build/src/utils"; -import * as hre from 'hardhat'; -import {Deployer} from "@matterlabs/hardhat-zksync-deploy"; +import { hashBytecode } from "zksync-web3/build/src/utils"; +import type { YulContractDescrption } from "./constants"; +import { Language, SYSTEM_CONTRACTS } from "./constants"; export interface Dependency { - name: string; - bytecodes: BytesLike[]; - address?: string; + name: string; + bytecodes: BytesLike[]; + address?: string; } export interface DeployedDependency { - name: string; - bytecodeHashes: string[]; - address?: string; + name: string; + bytecodeHashes: string[]; + address?: string; } export function readYulBytecode(description: YulContractDescrption) { - const contractName = description.codeName; - const path = `contracts/${description.path}/artifacts/${contractName}.yul/${contractName}.yul.zbin`; - return ethers.utils.hexlify(fs.readFileSync(path)); + const contractName = description.codeName; + const path = `contracts/${description.path}/artifacts/${contractName}.yul/${contractName}.yul.zbin`; + return ethers.utils.hexlify(fs.readFileSync(path)); } // The struct used to represent the parameters of a forced deployment -- a deployment during upgrade // which sets a bytecode onto an address. Typically used for updating system contracts. export interface ForceDeployment { - // The bytecode hash to put on an address - bytecodeHash: BytesLike; - // The address on which to deploy the bytecodehash to - newAddress: string; - // Whether to call the constructor - callConstructor: boolean; - // The value with which to initialize a contract - value: BigNumberish; - // The constructor calldata - input: BytesLike; + // The bytecode hash to put on an address + bytecodeHash: BytesLike; + // The address on which to deploy the bytecodehash to + newAddress: string; + // Whether to call the constructor + callConstructor: boolean; + // The value with which to initialize a contract + value: BigNumberish; + // The constructor calldata + input: BytesLike; } export async function outputSystemContracts(): Promise { - const upgradeParamsPromises: Promise[] = Object.values(SYSTEM_CONTRACTS).map(async (systemContractInfo) => { - let bytecode: string; - - if (systemContractInfo.lang === Language.Yul) { - bytecode = readYulBytecode(systemContractInfo); - } else { - bytecode = (await hre.artifacts.readArtifact(systemContractInfo.codeName)).bytecode; - } - const bytecodeHash = hashBytecode(bytecode); - - return { - bytecodeHash: ethers.utils.hexlify(bytecodeHash), - newAddress: systemContractInfo.address, - value: "0", - input: '0x', - callConstructor: false - } - }); - - return await Promise.all(upgradeParamsPromises); + const upgradeParamsPromises: Promise[] = Object.values(SYSTEM_CONTRACTS).map( + async (systemContractInfo) => { + let bytecode: string; + + if (systemContractInfo.lang === Language.Yul) { + bytecode = readYulBytecode(systemContractInfo); + } else { + bytecode = (await hre.artifacts.readArtifact(systemContractInfo.codeName)).bytecode; + } + const bytecodeHash = hashBytecode(bytecode); + + return { + bytecodeHash: ethers.utils.hexlify(bytecodeHash), + newAddress: systemContractInfo.address, + value: "0", + input: "0x", + callConstructor: false, + }; + } + ); + + return await Promise.all(upgradeParamsPromises); } // Script that publishes preimages for all the system contracts on zkSync // and outputs the JSON that can be used for performing the necessary upgrade const DEFAULT_L2_TX_GAS_LIMIT = 2097152; - -// For the given dependencies, returns an array of tuples (bytecodeHash, marker), where +// For the given dependencies, returns an array of tuples (bytecodeHash, marker), where // for each dependency the bytecodeHash is its versioned hash and marker is whether // the hash has been published before. export async function getMarkers(dependencies: BytesLike[], deployer: Deployer): Promise<[string, boolean][]> { - const contract = new ethers.Contract( - SYSTEM_CONTRACTS.knownCodesStorage.address, - (await hre.artifacts.readArtifact('KnownCodesStorage')).abi, - deployer.zkWallet - ); + const contract = new ethers.Contract( + SYSTEM_CONTRACTS.knownCodesStorage.address, + (await hre.artifacts.readArtifact("KnownCodesStorage")).abi, + deployer.zkWallet + ); - const promises = dependencies.map(async (dep) => { - const hash = ethers.utils.hexlify(hashBytecode(dep)); - const marker = BigNumber.from(await contract.getMarker(hash)); + const promises = dependencies.map(async (dep) => { + const hash = ethers.utils.hexlify(hashBytecode(dep)); + const marker = BigNumber.from(await contract.getMarker(hash)); - return [hash, marker.eq(1)] as [string, boolean]; - }); + return [hash, marker.eq(1)] as [string, boolean]; + }); - return await Promise.all(promises); + return await Promise.all(promises); } // Checks whether the marker has been set correctly in the KnownCodesStorage // system contract export async function checkMarkers(dependencies: BytesLike[], deployer: Deployer) { - const markers = await getMarkers(dependencies, deployer); + const markers = await getMarkers(dependencies, deployer); - for(const [bytecodeHash, marker] of markers) { - if(!marker) { - throw new Error(`Failed to mark ${bytecodeHash}`); - } + for (const [bytecodeHash, marker] of markers) { + if (!marker) { + throw new Error(`Failed to mark ${bytecodeHash}`); } + } } export function totalBytesLength(dependencies: BytesLike[]): number { - return dependencies.reduce((prev, curr) => prev + ethers.utils.arrayify(curr).length, 0); + return dependencies.reduce((prev, curr) => prev + ethers.utils.arrayify(curr).length, 0); } export function getBytecodes(dependencies: Dependency[]): BytesLike[] { - return dependencies.map((dep) => dep.bytecodes).flat(); + return dependencies.map((dep) => dep.bytecodes).flat(); } export async function publishFactoryDeps( - dependencies: Dependency[], - deployer: Deployer, - nonce: number, - gasPrice: BigNumber, + dependencies: Dependency[], + deployer: Deployer, + nonce: number, + gasPrice: BigNumber ) { - if(dependencies.length == 0) { - return []; - } - const bytecodes = getBytecodes(dependencies); - const combinedLength = totalBytesLength(bytecodes); - - console.log(`\nPublishing dependencies for contracts ${dependencies.map((dep) => {return dep.name}).join(', ')}`); - console.log(`Combined length ${combinedLength}`); - - const txHandle = await deployer.zkWallet.requestExecute({ - contractAddress: ethers.constants.AddressZero, - calldata: '0x', - l2GasLimit: DEFAULT_L2_TX_GAS_LIMIT, - factoryDeps: bytecodes, - overrides: { - nonce, - gasPrice, - gasLimit: 3000000 - } - }) - console.log(`Transaction hash: ${txHandle.hash}`); - - // Waiting for the transaction to be processed by the server - await txHandle.wait(); - - console.log('Transaction complete! Checking markers on L2...'); - - // Double checking that indeed the dependencies have been marked as known - await checkMarkers(bytecodes, deployer); + if (dependencies.length == 0) { + return []; + } + const bytecodes = getBytecodes(dependencies); + const combinedLength = totalBytesLength(bytecodes); + + console.log( + `\nPublishing dependencies for contracts ${dependencies + .map((dep) => { + return dep.name; + }) + .join(", ")}` + ); + console.log(`Combined length ${combinedLength}`); + + const txHandle = await deployer.zkWallet.requestExecute({ + contractAddress: ethers.constants.AddressZero, + calldata: "0x", + l2GasLimit: DEFAULT_L2_TX_GAS_LIMIT, + factoryDeps: bytecodes, + overrides: { + nonce, + gasPrice, + gasLimit: 3000000, + }, + }); + console.log(`Transaction hash: ${txHandle.hash}`); + + // Waiting for the transaction to be processed by the server + await txHandle.wait(); + + console.log("Transaction complete! Checking markers on L2..."); + + // Double checking that indeed the dependencies have been marked as known + await checkMarkers(bytecodes, deployer); } // Returns an array of bytecodes that should be published along with their total length in bytes export async function filterPublishedFactoryDeps( - contractName: string, - factoryDeps: string[], - deployer: Deployer, + contractName: string, + factoryDeps: string[], + deployer: Deployer ): Promise<[string[], number]> { - console.log(`\nFactory dependencies for contract ${contractName}:`); - let currentLength = 0; + console.log(`\nFactory dependencies for contract ${contractName}:`); + let currentLength = 0; - let bytecodesToDeploy: string[] = []; + const bytecodesToDeploy: string[] = []; - const hashesAndMarkers = await getMarkers(factoryDeps, deployer); + const hashesAndMarkers = await getMarkers(factoryDeps, deployer); - for(let i = 0; i < factoryDeps.length; i++) { - const depLength = ethers.utils.arrayify(factoryDeps[i]).length; - const [hash, marker] = hashesAndMarkers[i]; - console.log(`${hash} (length: ${depLength} bytes) (deployed: ${marker})`); + for (let i = 0; i < factoryDeps.length; i++) { + const depLength = ethers.utils.arrayify(factoryDeps[i]).length; + const [hash, marker] = hashesAndMarkers[i]; + console.log(`${hash} (length: ${depLength} bytes) (deployed: ${marker})`); - if(!marker) { - currentLength += depLength; - bytecodesToDeploy.push(factoryDeps[i]); - } + if (!marker) { + currentLength += depLength; + bytecodesToDeploy.push(factoryDeps[i]); } + } - console.log(`Combined length to deploy: ${currentLength}`); + console.log(`Combined length to deploy: ${currentLength}`); - return [bytecodesToDeploy, currentLength]; + return [bytecodesToDeploy, currentLength]; } diff --git a/test/AccountCodeStorage.spec.ts b/test/AccountCodeStorage.spec.ts new file mode 100644 index 00000000..2be7c650 --- /dev/null +++ b/test/AccountCodeStorage.spec.ts @@ -0,0 +1,231 @@ +import { expect } from "chai"; +import { ethers, network } from "hardhat"; +import type { Wallet } from "zksync-web3"; +import type { AccountCodeStorage } from "../typechain-types"; +import { DEPLOYER_SYSTEM_CONTRACT_ADDRESS, EMPTY_STRING_KECCAK } from "./shared/constants"; +import { deployContract, getWallets } from "./shared/utils"; + +describe("AccountCodeStorage tests", function () { + let wallet: Wallet; + let accountCodeStorage: AccountCodeStorage; + let deployerAccount: ethers.Signer; + + const CONSTRUCTING_BYTECODE_HASH = "0x0101FFFFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF"; + const CONSTRUCTED_BYTECODE_HASH = "0x0100FFFFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF"; + const RANDOM_ADDRESS = "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"; + + before(async () => { + wallet = getWallets()[0]; + accountCodeStorage = (await deployContract("AccountCodeStorage")) as AccountCodeStorage; + + await network.provider.request({ + method: "hardhat_impersonateAccount", + params: [DEPLOYER_SYSTEM_CONTRACT_ADDRESS], + }); + deployerAccount = await ethers.getSigner(DEPLOYER_SYSTEM_CONTRACT_ADDRESS); + }); + + after(async () => { + await network.provider.request({ + method: "hardhat_stopImpersonatingAccount", + params: [DEPLOYER_SYSTEM_CONTRACT_ADDRESS], + }); + }); + + describe("storeAccountConstructingCodeHash", function () { + it("non-deployer failed to call", async () => { + await expect( + accountCodeStorage.storeAccountConstructingCodeHash(RANDOM_ADDRESS, CONSTRUCTING_BYTECODE_HASH) + ).to.be.revertedWith("Callable only by the deployer system contract"); + }); + + it("failed to set with constructed bytecode", async () => { + await expect( + accountCodeStorage + .connect(deployerAccount) + .storeAccountConstructingCodeHash(RANDOM_ADDRESS, CONSTRUCTED_BYTECODE_HASH) + ).to.be.revertedWith("Code hash is not for a contract on constructor"); + }); + + it("successfully stored", async () => { + await accountCodeStorage + .connect(deployerAccount) + .storeAccountConstructingCodeHash(RANDOM_ADDRESS, CONSTRUCTING_BYTECODE_HASH); + + expect(await accountCodeStorage.getRawCodeHash(RANDOM_ADDRESS)).to.be.eq( + CONSTRUCTING_BYTECODE_HASH.toLowerCase() + ); + + await unsetCodeHash(accountCodeStorage, RANDOM_ADDRESS); + }); + }); + + describe("storeAccountConstructedCodeHash", function () { + it("non-deployer failed to call", async () => { + await expect( + accountCodeStorage.storeAccountConstructedCodeHash(RANDOM_ADDRESS, CONSTRUCTING_BYTECODE_HASH) + ).to.be.revertedWith("Callable only by the deployer system contract"); + }); + + it("failed to set with constructing bytecode", async () => { + await expect( + accountCodeStorage + .connect(deployerAccount) + .storeAccountConstructedCodeHash(RANDOM_ADDRESS, CONSTRUCTING_BYTECODE_HASH) + ).to.be.revertedWith("Code hash is not for a constructed contract"); + }); + + it("successfully stored", async () => { + await accountCodeStorage + .connect(deployerAccount) + .storeAccountConstructedCodeHash(RANDOM_ADDRESS, CONSTRUCTED_BYTECODE_HASH); + + expect(await accountCodeStorage.getRawCodeHash(RANDOM_ADDRESS)).to.be.eq(CONSTRUCTED_BYTECODE_HASH.toLowerCase()); + + await unsetCodeHash(accountCodeStorage, RANDOM_ADDRESS); + }); + }); + + describe("markAccountCodeHashAsConstructed", function () { + it("non-deployer failed to call", async () => { + await expect(accountCodeStorage.markAccountCodeHashAsConstructed(RANDOM_ADDRESS)).to.be.revertedWith( + "Callable only by the deployer system contract" + ); + }); + + it("failed to mark already constructed bytecode", async () => { + await accountCodeStorage + .connect(deployerAccount) + .storeAccountConstructedCodeHash(RANDOM_ADDRESS, CONSTRUCTED_BYTECODE_HASH); + + await expect( + accountCodeStorage.connect(deployerAccount).markAccountCodeHashAsConstructed(RANDOM_ADDRESS) + ).to.be.revertedWith("Code hash is not for a contract on constructor"); + + await unsetCodeHash(accountCodeStorage, RANDOM_ADDRESS); + }); + + describe("getCodeHash", function () { + it("precompile", async () => { + // Check that the smallest precompile has EMPTY_STRING_KECCAK hash + expect(await accountCodeStorage.getCodeHash("0x0000000000000000000000000000000000000001")).to.be.eq( + EMPTY_STRING_KECCAK + ); + + // Check that the upper end of the precompile range has EMPTY_STRING_KECCAK hash + expect(await accountCodeStorage.getCodeHash("0x00000000000000000000000000000000000000ff")).to.be.eq( + EMPTY_STRING_KECCAK + ); + }); + + it("successfully marked", async () => { + await accountCodeStorage + .connect(deployerAccount) + .storeAccountConstructingCodeHash(RANDOM_ADDRESS, CONSTRUCTING_BYTECODE_HASH); + + await accountCodeStorage.connect(deployerAccount).markAccountCodeHashAsConstructed(RANDOM_ADDRESS); + + expect(await accountCodeStorage.getRawCodeHash(RANDOM_ADDRESS)).to.be.eq( + CONSTRUCTED_BYTECODE_HASH.toLowerCase() + ); + + await unsetCodeHash(accountCodeStorage, RANDOM_ADDRESS); + }); + }); + }); + + describe("getRawCodeHash", function () { + it("zero", async () => { + expect(await accountCodeStorage.getRawCodeHash(RANDOM_ADDRESS)).to.be.eq(ethers.constants.HashZero); + }); + + it("non-zero", async () => { + await accountCodeStorage + .connect(deployerAccount) + .storeAccountConstructedCodeHash(RANDOM_ADDRESS, CONSTRUCTED_BYTECODE_HASH); + + expect(await accountCodeStorage.getRawCodeHash(RANDOM_ADDRESS)).to.be.eq(CONSTRUCTED_BYTECODE_HASH.toLowerCase()); + + await unsetCodeHash(accountCodeStorage, RANDOM_ADDRESS); + }); + }); + + describe("getCodeHash", function () { + it("precompile", async () => { + expect(await accountCodeStorage.getCodeHash("0x0000000000000000000000000000000000000001")).to.be.eq( + EMPTY_STRING_KECCAK + ); + }); + + it("EOA with non-zero nonce", async () => { + // This address at least deployed this contract + expect(await accountCodeStorage.getCodeHash(wallet.address)).to.be.eq(EMPTY_STRING_KECCAK); + }); + + it("address in the constructor", async () => { + await accountCodeStorage + .connect(deployerAccount) + .storeAccountConstructingCodeHash(RANDOM_ADDRESS, CONSTRUCTING_BYTECODE_HASH); + + expect(await accountCodeStorage.getCodeHash(RANDOM_ADDRESS)).to.be.eq(EMPTY_STRING_KECCAK); + + await unsetCodeHash(accountCodeStorage, RANDOM_ADDRESS); + }); + + it("constructed code hash", async () => { + await accountCodeStorage + .connect(deployerAccount) + .storeAccountConstructedCodeHash(RANDOM_ADDRESS, CONSTRUCTED_BYTECODE_HASH); + + expect(await accountCodeStorage.getCodeHash(RANDOM_ADDRESS)).to.be.eq(CONSTRUCTED_BYTECODE_HASH.toLowerCase()); + + await unsetCodeHash(accountCodeStorage, RANDOM_ADDRESS); + }); + + it("zero", async () => { + expect(await accountCodeStorage.getCodeHash(RANDOM_ADDRESS)).to.be.eq(ethers.constants.HashZero); + }); + }); + + describe("getCodeSize", function () { + it("zero address", async () => { + expect(await accountCodeStorage.getCodeSize(ethers.constants.AddressZero)).to.be.eq(0); + }); + + it("precompile", async () => { + expect(await accountCodeStorage.getCodeSize("0x0000000000000000000000000000000000000001")).to.be.eq(0); + }); + + it("address in the constructor", async () => { + await accountCodeStorage + .connect(deployerAccount) + .storeAccountConstructingCodeHash(RANDOM_ADDRESS, CONSTRUCTING_BYTECODE_HASH); + + expect(await accountCodeStorage.getCodeSize(RANDOM_ADDRESS)).to.be.eq(0); + + await unsetCodeHash(accountCodeStorage, RANDOM_ADDRESS); + }); + + it("non-zero size", async () => { + await accountCodeStorage + .connect(deployerAccount) + .storeAccountConstructedCodeHash(RANDOM_ADDRESS, CONSTRUCTED_BYTECODE_HASH); + + expect(await accountCodeStorage.getCodeSize(RANDOM_ADDRESS)).to.be.eq(65535 * 32); + + await unsetCodeHash(accountCodeStorage, RANDOM_ADDRESS); + }); + + it("zero", async () => { + expect(await accountCodeStorage.getCodeSize(RANDOM_ADDRESS)).to.be.eq(0); + }); + }); +}); + +// Utility function to unset code hash for the specified address. +// Deployer system contract should be impersonated +async function unsetCodeHash(accountCodeStorage: AccountCodeStorage, address: string) { + const deployerAccount = await ethers.getImpersonatedSigner(DEPLOYER_SYSTEM_CONTRACT_ADDRESS); + + await accountCodeStorage.connect(deployerAccount).storeAccountConstructedCodeHash(address, ethers.constants.HashZero); +} diff --git a/test/BootloaderUtilities.spec.ts b/test/BootloaderUtilities.spec.ts new file mode 100644 index 00000000..b1914978 --- /dev/null +++ b/test/BootloaderUtilities.spec.ts @@ -0,0 +1,182 @@ +import { expect } from "chai"; +import { ethers } from "hardhat"; +import * as zksync from "zksync-web3"; +import type { Wallet } from "zksync-web3"; +import { serialize } from "zksync-web3/build/src/utils"; +import type { BootloaderUtilities } from "../typechain-types"; +import { signedTxToTransactionData } from "./shared/transactions"; +import { deployContract, getWallets } from "./shared/utils"; + +describe("BootloaderUtilities tests", function () { + let wallet: Wallet; + let bootloaderUtilities: BootloaderUtilities; + + before(async () => { + wallet = getWallets()[0]; + bootloaderUtilities = (await deployContract("BootloaderUtilities")) as BootloaderUtilities; + }); + + describe("EIP-712 transaction", function () { + it("check hashes", async () => { + const eip712Tx = await wallet.populateTransaction({ + type: 113, + to: wallet.address, + from: wallet.address, + data: "0x", + value: 0, + maxFeePerGas: 12000, + maxPriorityFeePerGas: 100, + customData: { + gasPerPubdata: zksync.utils.DEFAULT_GAS_PER_PUBDATA_LIMIT, + }, + }); + const signedEip712Tx = await wallet.signTransaction(eip712Tx); + const parsedEIP712tx = zksync.utils.parseTransaction(signedEip712Tx); + + const eip712TxData = signedTxToTransactionData(parsedEIP712tx)!; + const expectedEIP712TxHash = parsedEIP712tx.hash; + const expectedEIP712SignedHash = zksync.EIP712Signer.getSignedDigest(eip712Tx); + + const proposedEIP712Hashes = await bootloaderUtilities.getTransactionHashes(eip712TxData); + + expect(proposedEIP712Hashes.txHash).to.be.eq(expectedEIP712TxHash); + expect(proposedEIP712Hashes.signedTxHash).to.be.eq(expectedEIP712SignedHash); + }); + }); + + describe("legacy transaction", function () { + it("check hashes", async () => { + const legacyTx = await wallet.populateTransaction({ + type: 0, + to: wallet.address, + from: wallet.address, + data: "0x", + value: 0, + gasLimit: 50000, + }); + const txBytes = await wallet.signTransaction(legacyTx); + const parsedTx = zksync.utils.parseTransaction(txBytes); + const txData = signedTxToTransactionData(parsedTx)!; + + const expectedTxHash = parsedTx.hash; + delete legacyTx.from; + const expectedSignedHash = ethers.utils.keccak256(serialize(legacyTx)); + + const proposedHashes = await bootloaderUtilities.getTransactionHashes(txData); + expect(proposedHashes.txHash).to.be.eq(expectedTxHash); + expect(proposedHashes.signedTxHash).to.be.eq(expectedSignedHash); + }); + + it("invalid v signature value", async () => { + const legacyTx = await wallet.populateTransaction({ + type: 0, + to: wallet.address, + from: wallet.address, + data: "0x", + value: 0, + gasLimit: 50000, + }); + const txBytes = await wallet.signTransaction(legacyTx); + const parsedTx = zksync.utils.parseTransaction(txBytes); + const txData = signedTxToTransactionData(parsedTx)!; + + const signature = ethers.utils.arrayify(txData.signature); + signature[64] = 29; + txData.signature = signature; + + await expect(bootloaderUtilities.getTransactionHashes(txData)).to.be.revertedWith("Invalid v value"); + }); + }); + + describe("EIP-1559 transaction", function () { + it("check hashes", async () => { + const eip1559Tx = await wallet.populateTransaction({ + type: 2, + to: wallet.address, + from: wallet.address, + data: "0x", + value: 0, + maxFeePerGas: 12000, + maxPriorityFeePerGas: 100, + }); + const signedEip1559Tx = await wallet.signTransaction(eip1559Tx); + const parsedEIP1559tx = zksync.utils.parseTransaction(signedEip1559Tx); + + const EIP1559TxData = signedTxToTransactionData(parsedEIP1559tx)!; + delete eip1559Tx.from; + const expectedEIP1559TxHash = parsedEIP1559tx.hash; + const expectedEIP1559SignedHash = ethers.utils.keccak256(serialize(eip1559Tx)); + + const proposedEIP1559Hashes = await bootloaderUtilities.getTransactionHashes(EIP1559TxData); + expect(proposedEIP1559Hashes.txHash).to.be.eq(expectedEIP1559TxHash); + expect(proposedEIP1559Hashes.signedTxHash).to.be.eq(expectedEIP1559SignedHash); + }); + + it("invalid v signature value", async () => { + const eip1559Tx = await wallet.populateTransaction({ + type: 2, + to: wallet.address, + from: wallet.address, + data: "0x", + value: 0, + maxFeePerGas: 12000, + maxPriorityFeePerGas: 100, + }); + const signedEip1559Tx = await wallet.signTransaction(eip1559Tx); + const parsedEIP1559tx = zksync.utils.parseTransaction(signedEip1559Tx); + + const EIP1559TxData = signedTxToTransactionData(parsedEIP1559tx)!; + const signature = ethers.utils.arrayify(EIP1559TxData.signature); + signature[64] = 0; + EIP1559TxData.signature = signature; + + await expect(bootloaderUtilities.getTransactionHashes(EIP1559TxData)).to.be.revertedWith("Invalid v value"); + }); + }); + + describe("EIP-1559 transaction", function () { + it("check hashes", async () => { + const eip2930Tx = await wallet.populateTransaction({ + type: 1, + to: wallet.address, + from: wallet.address, + data: "0x", + value: 0, + gasLimit: 50000, + gasPrice: 55000, + }); + const signedEip2930Tx = await wallet.signTransaction(eip2930Tx); + const parsedEIP2930tx = zksync.utils.parseTransaction(signedEip2930Tx); + + const EIP2930TxData = signedTxToTransactionData(parsedEIP2930tx)!; + delete eip2930Tx.from; + const expectedEIP2930TxHash = parsedEIP2930tx.hash; + const expectedEIP2930SignedHash = ethers.utils.keccak256(serialize(eip2930Tx)); + + const proposedEIP2930Hashes = await bootloaderUtilities.getTransactionHashes(EIP2930TxData); + expect(proposedEIP2930Hashes.txHash).to.be.eq(expectedEIP2930TxHash); + expect(proposedEIP2930Hashes.signedTxHash).to.be.eq(expectedEIP2930SignedHash); + }); + + it("invalid v signature value", async () => { + const eip2930Tx = await wallet.populateTransaction({ + type: 1, + to: wallet.address, + from: wallet.address, + data: "0x", + value: 0, + gasLimit: 50000, + gasPrice: 55000, + }); + const signedEip2930Tx = await wallet.signTransaction(eip2930Tx); + const parsedEIP2930tx = zksync.utils.parseTransaction(signedEip2930Tx); + + const EIP2930TxData = signedTxToTransactionData(parsedEIP2930tx)!; + const signature = ethers.utils.arrayify(EIP2930TxData.signature); + signature[64] = 100; + EIP2930TxData.signature = signature; + + await expect(bootloaderUtilities.getTransactionHashes(EIP2930TxData)).to.be.revertedWith("Invalid v value"); + }); + }); +}); diff --git a/test/ComplexUpgrader.spec.ts b/test/ComplexUpgrader.spec.ts new file mode 100644 index 00000000..20a341f4 --- /dev/null +++ b/test/ComplexUpgrader.spec.ts @@ -0,0 +1,43 @@ +import { expect } from "chai"; +import { ethers, network } from "hardhat"; +import type { ComplexUpgrader, DummyUpgrade } from "../typechain-types"; +import { FORCE_DEPLOYER_ADDRESS } from "./shared/constants"; +import { deployContract } from "./shared/utils"; + +describe("ComplexUpgrader tests", function () { + let complexUpgrader: ComplexUpgrader; + let dummyUpgrade: DummyUpgrade; + + before(async () => { + complexUpgrader = (await deployContract("ComplexUpgrader")) as ComplexUpgrader; + dummyUpgrade = (await deployContract("DummyUpgrade")) as DummyUpgrade; + }); + + describe("upgrade", function () { + it("non force deployer failed to call", async () => { + await expect( + complexUpgrader.upgrade(dummyUpgrade.address, dummyUpgrade.interface.encodeFunctionData("performUpgrade")) + ).to.be.revertedWith("Can only be called by FORCE_DEPLOYER"); + }); + + it("successfully upgraded", async () => { + await network.provider.request({ + method: "hardhat_impersonateAccount", + params: [FORCE_DEPLOYER_ADDRESS], + }); + + const force_deployer = await ethers.getSigner(FORCE_DEPLOYER_ADDRESS); + + await expect( + complexUpgrader + .connect(force_deployer) + .upgrade(dummyUpgrade.address, dummyUpgrade.interface.encodeFunctionData("performUpgrade")) + ).to.emit(dummyUpgrade.attach(complexUpgrader.address), "Upgraded"); + + await network.provider.request({ + method: "hardhat_stopImpersonatingAccount", + params: [FORCE_DEPLOYER_ADDRESS], + }); + }); + }); +}); diff --git a/test/Compressor.spec.ts b/test/Compressor.spec.ts new file mode 100644 index 00000000..90621c8e --- /dev/null +++ b/test/Compressor.spec.ts @@ -0,0 +1,513 @@ +import { expect } from "chai"; +import type { BytesLike } from "ethers"; +import { BigNumber } from "ethers"; +import { ethers, network } from "hardhat"; +import * as zksync from "zksync-web3"; +import type { Wallet } from "zksync-web3"; +import type { Compressor } from "../typechain-types"; +import { MockKnownCodesStorage__factory } from "../typechain-types"; +import { + BOOTLOADER_FORMAL_ADDRESS, + KNOWN_CODE_STORAGE_CONTRACT_ADDRESS, + L1_MESSENGER_SYSTEM_CONTRACT_ADDRESS, + TWO_IN_256, +} from "./shared/constants"; +import { deployContract, getCode, getWallets, loadArtifact, setCode } from "./shared/utils"; + +describe("Compressor tests", function () { + let wallet: Wallet; + let compressor: Compressor; + let bootloader: ethers.Signer; + let l1Messenger: ethers.Signer; + + let _knownCodesStorageCode: string; + + before(async () => { + wallet = getWallets()[0]; + compressor = (await deployContract("Compressor")) as Compressor; + _knownCodesStorageCode = await getCode(KNOWN_CODE_STORAGE_CONTRACT_ADDRESS); + const mockKnownCodesStorageArtifact = await loadArtifact("MockKnownCodesStorage"); + await setCode(KNOWN_CODE_STORAGE_CONTRACT_ADDRESS, mockKnownCodesStorageArtifact.bytecode); + + await network.provider.request({ + method: "hardhat_impersonateAccount", + params: [BOOTLOADER_FORMAL_ADDRESS], + }); + bootloader = await ethers.getSigner(BOOTLOADER_FORMAL_ADDRESS); + + await network.provider.request({ + method: "hardhat_impersonateAccount", + params: [L1_MESSENGER_SYSTEM_CONTRACT_ADDRESS], + }); + l1Messenger = await ethers.getSigner(L1_MESSENGER_SYSTEM_CONTRACT_ADDRESS); + }); + + after(async function () { + await network.provider.request({ + method: "hardhat_stopImpersonatingAccount", + params: [BOOTLOADER_FORMAL_ADDRESS], + }); + + await network.provider.request({ + method: "hardhat_stopImpersonatingAccount", + params: [L1_MESSENGER_SYSTEM_CONTRACT_ADDRESS], + }); + + await setCode(KNOWN_CODE_STORAGE_CONTRACT_ADDRESS, _knownCodesStorageCode); + }); + + describe("publishCompressedBytecode", function () { + it("non-bootloader failed to call", async () => { + await expect(compressor.publishCompressedBytecode("0x", "0x0000")).to.be.revertedWith( + "Callable only by the bootloader" + ); + }); + + it("invalid encoded length", async () => { + const BYTECODE = "0xdeadbeefdeadbeef"; + const COMPRESSED_BYTECODE = "0x0001deadbeefdeadbeef00000000"; + await expect( + compressor.connect(bootloader).publishCompressedBytecode(BYTECODE, COMPRESSED_BYTECODE) + ).to.be.revertedWith("Encoded data length should be 4 times shorter than the original bytecode"); + }); + + it("chunk index is out of bounds", async () => { + await network.provider.request({ + method: "hardhat_impersonateAccount", + params: [BOOTLOADER_FORMAL_ADDRESS], + }); + + const bootloader = await ethers.getSigner(BOOTLOADER_FORMAL_ADDRESS); + + const BYTECODE = "0xdeadbeefdeadbeef"; + const COMPRESSED_BYTECODE = "0x0001deadbeefdeadbeef0001"; + await expect( + compressor.connect(bootloader).publishCompressedBytecode(BYTECODE, COMPRESSED_BYTECODE) + ).to.be.revertedWith("Encoded chunk index is out of bounds"); + + await network.provider.request({ + method: "hardhat_stopImpersonatingAccount", + params: [BOOTLOADER_FORMAL_ADDRESS], + }); + }); + + it("chunk does not match the original bytecode", async () => { + await network.provider.request({ + method: "hardhat_impersonateAccount", + params: [BOOTLOADER_FORMAL_ADDRESS], + }); + + const bootloader = await ethers.getSigner(BOOTLOADER_FORMAL_ADDRESS); + + const BYTECODE = "0xdeadbeefdeadbeef1111111111111111"; + const COMPRESSED_BYTECODE = "0x0002deadbeefdeadbeef111111111111111100000000"; + await expect( + compressor.connect(bootloader).publishCompressedBytecode(BYTECODE, COMPRESSED_BYTECODE) + ).to.be.revertedWith("Encoded chunk does not match the original bytecode"); + + await network.provider.request({ + method: "hardhat_stopImpersonatingAccount", + params: [BOOTLOADER_FORMAL_ADDRESS], + }); + }); + + it("invalid bytecode length in bytes", async () => { + await network.provider.request({ + method: "hardhat_impersonateAccount", + params: [BOOTLOADER_FORMAL_ADDRESS], + }); + + const bootloader = await ethers.getSigner(BOOTLOADER_FORMAL_ADDRESS); + + const BYTECODE = "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"; + const COMPRESSED_BYTECODE = "0x0001deadbeefdeadbeef000000000000"; + await expect( + compressor.connect(bootloader).publishCompressedBytecode(BYTECODE, COMPRESSED_BYTECODE) + ).to.be.revertedWith("po"); + + await network.provider.request({ + method: "hardhat_stopImpersonatingAccount", + params: [BOOTLOADER_FORMAL_ADDRESS], + }); + }); + + // Test case with too big bytecode is unrealistic because API cannot accept so much data. + it("invalid bytecode length in words", async () => { + await network.provider.request({ + method: "hardhat_impersonateAccount", + params: [BOOTLOADER_FORMAL_ADDRESS], + }); + + const bootloader = await ethers.getSigner(BOOTLOADER_FORMAL_ADDRESS); + + const BYTECODE = "0x" + "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef".repeat(2); + const COMPRESSED_BYTECODE = "0x0001deadbeefdeadbeef" + "0000".repeat(4 * 2); + await expect( + compressor.connect(bootloader).publishCompressedBytecode(BYTECODE, COMPRESSED_BYTECODE) + ).to.be.revertedWith("pr"); + + await network.provider.request({ + method: "hardhat_stopImpersonatingAccount", + params: [BOOTLOADER_FORMAL_ADDRESS], + }); + }); + + it("successfully published", async () => { + await network.provider.request({ + method: "hardhat_impersonateAccount", + params: [BOOTLOADER_FORMAL_ADDRESS], + }); + + const bootloader = await ethers.getSigner(BOOTLOADER_FORMAL_ADDRESS); + + const BYTECODE = + "0x000200000000000200010000000103550000006001100270000000150010019d0000000101200190000000080000c13d0000000001000019004e00160000040f0000000101000039004e00160000040f0000001504000041000000150510009c000000000104801900000040011002100000000001310019000000150320009c0000000002048019000000600220021000000000012100190000004f0001042e000000000100001900000050000104300000008002000039000000400020043f0000000002000416000000000110004c000000240000613d000000000120004c0000004d0000c13d000000200100003900000100001004430000012000000443000001000100003900000040020000390000001d03000041004e000a0000040f000000000120004c0000004d0000c13d0000000001000031000000030110008c0000004d0000a13d0000000101000367000000000101043b0000001601100197000000170110009c0000004d0000c13d0000000101000039000000000101041a0000000202000039000000000202041a000000400300043d00000040043000390000001805200197000000000600041a0000000000540435000000180110019700000020043000390000000000140435000000a0012002700000001901100197000000600430003900000000001404350000001a012001980000001b010000410000000001006019000000b8022002700000001c02200197000000000121019f0000008002300039000000000012043500000018016001970000000000130435000000400100043d0000000002130049000000a0022000390000000003000019004e000a0000040f004e00140000040f0000004e000004320000004f0001042e000000500001043000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffff000000000000000000000000000000000000000000000000000000008903573000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000ffffff0000000000008000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80000000000000000000000000000000000000000000000000000000000000007fffff00000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; + const COMPRESSED_BYTECODE = + "0x00510000000000000000ffffffffffffffff0000004d0000c13d00000000ffffffff0000000000140435004e000a0000040f000000000120004c00000050000104300000004f0001042e0000000101000039004e00160000040f0000000001000019000000020000000000000000007fffffffffffffff80000000000000000080000000000000ffffff8903573000000000ffffffff000000000000004e00000432004e00140000040f0000000003000019000000a0022000390000000002130049000000400100043d0000000000130435000000180160019700000000001204350000008002300039000000000121019f0000001c02200197000000b80220027000000000010060190000001b010000410000001a0120019800000060043000390000001901100197000000a001200270000000200430003900000018011001970000000000540435000000000600041a00000018052001970000004004300039000000400300043d000000000202041a0000000202000039000000000101041a000000170110009c0000001601100197000000000101043b00000001010003670000004d0000a13d000000030110008c00000000010000310000001d0300004100000040020000390000010001000039000001200000044300000100001004430000002001000039000000240000613d000000000110004c0000000002000416000000400020043f0000008002000039000000000121001900000060022002100000000002048019000000150320009c000000000131001900000040011002100000000001048019000000150510009c0000001504000041000000080000c13d0000000101200190000000150010019d0000006001100270000100000001035500020000000000020050004f004e004d004c004b000b000a0009000a004a004900480047004600450044004300420008000b000700410040003f003e003d00060002003c003b003a003900380037000500060002003600350034003300320031003000020009002f002e002d002c002b002a002900280027002600040025002400230004002200210020001f001e001d001c001b001a001900180017001600150005001400130008000700000000000000000000000000030012000000000000001100000000000000000003000100010000000000000010000f000000000000000100010001000e000000000000000d000c0000000000000000000000000000"; + await expect(compressor.connect(bootloader).publishCompressedBytecode(BYTECODE, COMPRESSED_BYTECODE)) + .to.emit( + MockKnownCodesStorage__factory.connect(KNOWN_CODE_STORAGE_CONTRACT_ADDRESS, wallet), + "MockBytecodePublished" + ) + .withArgs(zksync.utils.hashBytecode(BYTECODE)); + + await network.provider.request({ + method: "hardhat_stopImpersonatingAccount", + params: [BOOTLOADER_FORMAL_ADDRESS], + }); + }); + }); + + describe("verifyCompressedStateDiffs", function () { + it("non l1 messenger failed to call", async () => { + await expect(compressor.verifyCompressedStateDiffs(0, 8, "0x", "0x0000")).to.be.revertedWith( + "Inappropriate caller" + ); + }); + + it("enumeration index size is too large", async () => { + const stateDiffs = [ + { + key: "0x1234567890123456789012345678901234567890123456789012345678901234", + index: 0, + initValue: BigNumber.from(0), + finalValue: BigNumber.from("0x1234567890123456789012345678901234567890123456789012345678901234"), + }, + ]; + const encodedStateDiffs = encodeStateDiffs(stateDiffs); + stateDiffs[0].key = "0x1234567890123456789012345678901234567890123456789012345678901233"; + const compressedStateDiffs = compressStateDiffs(9, stateDiffs); + await expect( + compressor.connect(l1Messenger).verifyCompressedStateDiffs(1, 9, encodedStateDiffs, compressedStateDiffs) + ).to.be.revertedWith("enumeration index size is too large"); + }); + + it("initial write key mismatch", async () => { + const stateDiffs = [ + { + key: "0x1234567890123456789012345678901234567890123456789012345678901234", + index: 0, + initValue: BigNumber.from(1), + finalValue: BigNumber.from(0), + }, + ]; + const encodedStateDiffs = encodeStateDiffs(stateDiffs); + stateDiffs[0].key = "0x1234567890123456789012345678901234567890123456789012345678901233"; + const compressedStateDiffs = compressStateDiffs(4, stateDiffs); + await expect( + compressor.connect(l1Messenger).verifyCompressedStateDiffs(1, 4, encodedStateDiffs, compressedStateDiffs) + ).to.be.revertedWith("iw: initial key mismatch"); + }); + + it("repeated write key mismatch", async () => { + const stateDiffs = [ + { + key: "0x1234567890123456789012345678901234567890123456789012345678901234", + index: 1, + initValue: BigNumber.from(1), + finalValue: BigNumber.from(0), + }, + ]; + const encodedStateDiffs = encodeStateDiffs(stateDiffs); + stateDiffs[0].index = 2; + const compressedStateDiffs = compressStateDiffs(8, stateDiffs); + await expect( + compressor.connect(l1Messenger).verifyCompressedStateDiffs(1, 8, encodedStateDiffs, compressedStateDiffs) + ).to.be.revertedWith("rw: enum key mismatch"); + }); + + it("no compression value mismatch", async () => { + const stateDiffs = [ + { + key: "0x1234567890123456789012345678901234567890123456789012345678901234", + index: 1, + initValue: BigNumber.from(1), + finalValue: BigNumber.from(0), + }, + { + key: "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef", + index: 0, + initValue: TWO_IN_256.div(2), + finalValue: TWO_IN_256.sub(2), + }, + ]; + const encodedStateDiffs = encodeStateDiffs(stateDiffs); + stateDiffs[1].finalValue = TWO_IN_256.sub(1); + const compressedStateDiffs = compressStateDiffs(3, stateDiffs); + await expect( + compressor.connect(l1Messenger).verifyCompressedStateDiffs(2, 3, encodedStateDiffs, compressedStateDiffs) + ).to.be.revertedWith("transform or no compression: compressed and final mismatch"); + }); + + it("transform value mismatch", async () => { + const stateDiffs = [ + { + key: "0x1234567890123456789012345678901234567890123456789012345678901234", + index: 255, + initValue: BigNumber.from(1), + finalValue: BigNumber.from(0), + }, + { + key: "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef", + index: 0, + initValue: TWO_IN_256.div(2), + finalValue: BigNumber.from(1), + }, + ]; + const encodedStateDiffs = encodeStateDiffs(stateDiffs); + stateDiffs[1].finalValue = BigNumber.from(0); + const compressedStateDiffs = compressStateDiffs(1, stateDiffs); + await expect( + compressor.connect(l1Messenger).verifyCompressedStateDiffs(2, 1, encodedStateDiffs, compressedStateDiffs) + ).to.be.revertedWith("transform or no compression: compressed and final mismatch"); + }); + + it("add value mismatch", async () => { + const stateDiffs = [ + { + key: "0x1234567890123456789012345678901234567890123456789012345678901235", + index: 255, + initValue: TWO_IN_256.div(2).sub(2), + finalValue: TWO_IN_256.div(2).sub(1), + }, + ]; + const encodedStateDiffs = encodeStateDiffs(stateDiffs); + stateDiffs[0].finalValue = TWO_IN_256.div(2); + const compressedStateDiffs = compressStateDiffs(1, stateDiffs); + await expect( + compressor.connect(l1Messenger).verifyCompressedStateDiffs(1, 1, encodedStateDiffs, compressedStateDiffs) + ).to.be.revertedWith("add: initial plus converted not equal to final"); + }); + + it("sub value mismatch", async () => { + const stateDiffs = [ + { + key: "0x1234567890123456789012345678901234567890123456789012345678901236", + index: 0, + initValue: TWO_IN_256.div(4), + finalValue: TWO_IN_256.div(4).sub(5), + }, + ]; + const encodedStateDiffs = encodeStateDiffs(stateDiffs); + stateDiffs[0].finalValue = TWO_IN_256.div(4).sub(1); + const compressedStateDiffs = compressStateDiffs(1, stateDiffs); + await expect( + compressor.connect(l1Messenger).verifyCompressedStateDiffs(1, 1, encodedStateDiffs, compressedStateDiffs) + ).to.be.revertedWith("sub: initial minus converted not equal to final"); + }); + + it("invalid operation", async () => { + const stateDiffs = [ + { + key: "0x1234567890123456789012345678901234567890123456789012345678901236", + index: 0, + initValue: TWO_IN_256.div(4), + finalValue: TWO_IN_256.div(4).sub(5), + }, + ]; + const encodedStateDiffs = encodeStateDiffs(stateDiffs); + let compressedStateDiffs = compressStateDiffs(1, stateDiffs); + const compressedStateDiffsCharArray = compressedStateDiffs.split(""); + compressedStateDiffsCharArray[2 + 4 + 64 + 1] = "f"; + compressedStateDiffs = compressedStateDiffsCharArray.join(""); + await expect( + compressor.connect(l1Messenger).verifyCompressedStateDiffs(1, 1, encodedStateDiffs, compressedStateDiffs) + ).to.be.revertedWith("unsupported operation"); + }); + + it("Incorrect number of initial storage diffs", async () => { + const stateDiffs = [ + { + key: "0x1234567890123456789012345678901234567890123456789012345678901236", + index: 0, + initValue: TWO_IN_256.div(4), + finalValue: TWO_IN_256.div(4).sub(5), + }, + { + key: "0x1234567890123456789012345678901234567890123456789012345678901239", + index: 121, + initValue: TWO_IN_256.sub(1), + finalValue: BigNumber.from(0), + }, + ]; + const encodedStateDiffs = encodeStateDiffs(stateDiffs); + stateDiffs.push({ + key: "0x0234567890123456789012345678901234567890123456789012345678901231", + index: 0, + initValue: BigNumber.from(0), + finalValue: BigNumber.from(1), + }); + const compressedStateDiffs = compressStateDiffs(1, stateDiffs); + await expect( + compressor.connect(l1Messenger).verifyCompressedStateDiffs(2, 1, encodedStateDiffs, compressedStateDiffs) + ).to.be.revertedWith("Incorrect number of initial storage diffs"); + }); + + it("Extra data in compressed state diffs", async () => { + const stateDiffs = [ + { + key: "0x1234567890123456789012345678901234567890123456789012345678901236", + index: 0, + initValue: TWO_IN_256.div(4), + finalValue: TWO_IN_256.div(4).sub(5), + }, + { + key: "0x1234567890123456789012345678901234567890123456789012345678901239", + index: 121, + initValue: TWO_IN_256.sub(1), + finalValue: BigNumber.from(0), + }, + ]; + const encodedStateDiffs = encodeStateDiffs(stateDiffs); + stateDiffs.push({ + key: "0x0234567890123456789012345678901234567890123456789012345678901231", + index: 1, + initValue: BigNumber.from(0), + finalValue: BigNumber.from(1), + }); + const compressedStateDiffs = compressStateDiffs(1, stateDiffs); + await expect( + compressor.connect(l1Messenger).verifyCompressedStateDiffs(2, 1, encodedStateDiffs, compressedStateDiffs) + ).to.be.revertedWith("Extra data in _compressedStateDiffs"); + }); + + it("successfully verified", async () => { + const stateDiffs = [ + { + key: "0x1234567890123456789012345678901234567890123456789012345678901230", + index: 0, + initValue: BigNumber.from("0x1234567890123456789012345678901234567890123456789012345678901231"), + finalValue: BigNumber.from("0x1234567890123456789012345678901234567890123456789012345678901230"), + }, + { + key: "0x1234567890123456789012345678901234567890123456789012345678901232", + index: 1, + initValue: TWO_IN_256.sub(1), + finalValue: BigNumber.from(1), + }, + { + key: "0x1234567890123456789012345678901234567890123456789012345678901234", + index: 0, + initValue: TWO_IN_256.div(2), + finalValue: BigNumber.from(1), + }, + { + key: "0x1234567890123456789012345678901234567890123456789012345678901236", + index: 2323, + initValue: BigNumber.from("0x1234567890123456789012345678901234567890123456789012345678901237"), + finalValue: BigNumber.from("0x0239329298382323782378478237842378478237847237237872373272373272"), + }, + { + key: "0x1234567890123456789012345678901234567890123456789012345678901238", + index: 2, + initValue: BigNumber.from(0), + finalValue: BigNumber.from(1), + }, + ]; + const encodedStateDiffs = encodeStateDiffs(stateDiffs); + const compressedStateDiffs = compressStateDiffs(4, stateDiffs); + const tx = { + from: L1_MESSENGER_SYSTEM_CONTRACT_ADDRESS, + to: compressor.address, + data: compressor.interface.encodeFunctionData("verifyCompressedStateDiffs", [ + 5, + 4, + encodedStateDiffs, + compressedStateDiffs, + ]), + }; + // eth_call to get return data + expect(await ethers.provider.call(tx)).to.be.eq(ethers.utils.keccak256(encodedStateDiffs)); + }); + }); +}); + +interface StateDiff { + key: BytesLike; + index: number; + initValue: BigNumber; + finalValue: BigNumber; +} + +function encodeStateDiffs(stateDiffs: StateDiff[]): string { + const rawStateDiffs = []; + for (const stateDiff of stateDiffs) { + rawStateDiffs.push( + ethers.utils.solidityPack( + ["address", "bytes32", "bytes32", "uint64", "uint256", "uint256", "bytes"], + [ + ethers.constants.AddressZero, + ethers.constants.HashZero, + stateDiff.key, + stateDiff.index, + stateDiff.initValue, + stateDiff.finalValue, + "0x" + "00".repeat(116), + ] + ) + ); + } + return ethers.utils.hexlify(ethers.utils.concat(rawStateDiffs)); +} + +function compressStateDiffs(enumerationIndexSize: number, stateDiffs: StateDiff[]): string { + let num_initial = 0; + const initial = []; + const repeated = []; + for (const stateDiff of stateDiffs) { + const addition = stateDiff.finalValue.sub(stateDiff.initValue).add(TWO_IN_256).mod(TWO_IN_256); + const subtraction = stateDiff.initValue.sub(stateDiff.finalValue).add(TWO_IN_256).mod(TWO_IN_256); + let op = 3; + let min = stateDiff.finalValue; + if (addition.lt(min)) { + min = addition; + op = 1; + } + if (subtraction.lt(min)) { + min = subtraction; + op = 2; + } + if (min.gte(BigNumber.from(2).pow(248))) { + min = stateDiff.finalValue; + op = 0; + } + let len = 0; + const minHex = min.eq(0) ? "0x" : min.toHexString(); + if (op > 0) { + len = (minHex.length - 2) / 2; + } + const metadata = (len << 3) + op; + const enumerationIndexType = "uint" + (enumerationIndexSize * 8).toString(); + if (stateDiff.index === 0) { + num_initial += 1; + initial.push(ethers.utils.solidityPack(["bytes32", "uint8", "bytes"], [stateDiff.key, metadata, minHex])); + } else { + repeated.push( + ethers.utils.solidityPack([enumerationIndexType, "uint8", "bytes"], [stateDiff.index, metadata, minHex]) + ); + } + } + return ethers.utils.hexlify( + ethers.utils.concat([ethers.utils.solidityPack(["uint16"], [num_initial]), ...initial, ...repeated]) + ); +} diff --git a/test/ContractDeployer.spec.ts b/test/ContractDeployer.spec.ts new file mode 100644 index 00000000..7f944e68 --- /dev/null +++ b/test/ContractDeployer.spec.ts @@ -0,0 +1,547 @@ +import type { ZkSyncArtifact } from "@matterlabs/hardhat-zksync-deploy/dist/types"; +import { expect } from "chai"; +import { ethers, network } from "hardhat"; +import type { Wallet } from "zksync-web3"; +import { Contract, utils } from "zksync-web3"; +import type { ContractDeployer, NonceHolder } from "../typechain-types"; +import { ContractDeployer__factory, Deployable__factory, NonceHolder__factory } from "../typechain-types"; +import { + DEPLOYER_SYSTEM_CONTRACT_ADDRESS, + FORCE_DEPLOYER_ADDRESS, + NONCE_HOLDER_SYSTEM_CONTRACT_ADDRESS, +} from "./shared/constants"; +import { deployContract, getCode, getWallets, loadArtifact, publishBytecode, setCode } from "./shared/utils"; + +describe("ContractDeployer tests", function () { + let wallet: Wallet; + let contractDeployer: ContractDeployer; + let contractDeployerSystemCall: ContractDeployer; + let contractDeployerNotSystemCall: ContractDeployer; + let nonceHolder: NonceHolder; + let deployableArtifact: ZkSyncArtifact; + let deployerAccount: ethers.Signer; + let forceDeployer: ethers.Signer; + + const EOA = ethers.utils.getAddress("0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"); + const RANDOM_ADDRESS = ethers.utils.getAddress("0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbee1"); + const RANDOM_ADDRESS_2 = ethers.utils.getAddress("0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbee2"); + const RANDOM_ADDRESS_3 = ethers.utils.getAddress("0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbee3"); + const EMPTY_KERNEL_ADDRESS = ethers.utils.getAddress("0x0000000000000000000000000000000000000101"); + const AA_VERSION_NONE = 0; + const AA_VERSION_1 = 1; + const NONCE_ORDERING_SEQUENTIAL = 0; + const NONCE_ORDERING_ARBITRARY = 1; + + let _contractDeployerCode: string; + + before(async () => { + wallet = getWallets()[0]; + + _contractDeployerCode = await getCode(DEPLOYER_SYSTEM_CONTRACT_ADDRESS); + const contractDeployerArtifact = await loadArtifact("ContractDeployer"); + await setCode(DEPLOYER_SYSTEM_CONTRACT_ADDRESS, contractDeployerArtifact.bytecode); + contractDeployer = ContractDeployer__factory.connect(DEPLOYER_SYSTEM_CONTRACT_ADDRESS, wallet); + + nonceHolder = NonceHolder__factory.connect(NONCE_HOLDER_SYSTEM_CONTRACT_ADDRESS, wallet); + + const contractDeployerSystemCallContract = await deployContract("SystemCaller", [contractDeployer.address]); + contractDeployerSystemCall = new Contract( + contractDeployerSystemCallContract.address, + contractDeployerArtifact.abi, + wallet + ) as ContractDeployer; + + const contractDeployerNotSystemCallContract = await deployContract("NotSystemCaller", [contractDeployer.address]); + contractDeployerNotSystemCall = new Contract( + contractDeployerNotSystemCallContract.address, + contractDeployerArtifact.abi, + wallet + ) as ContractDeployer; + + deployableArtifact = await loadArtifact("Deployable"); + await publishBytecode(deployableArtifact.bytecode); + + await network.provider.request({ + method: "hardhat_impersonateAccount", + params: [DEPLOYER_SYSTEM_CONTRACT_ADDRESS], + }); + await network.provider.request({ + method: "hardhat_impersonateAccount", + params: [FORCE_DEPLOYER_ADDRESS], + }); + deployerAccount = await ethers.getSigner(DEPLOYER_SYSTEM_CONTRACT_ADDRESS); + forceDeployer = await ethers.getSigner(FORCE_DEPLOYER_ADDRESS); + }); + + after(async () => { + await network.provider.request({ + method: "hardhat_stopImpersonatingAccount", + params: [DEPLOYER_SYSTEM_CONTRACT_ADDRESS], + }); + await network.provider.request({ + method: "hardhat_stopImpersonatingAccount", + params: [FORCE_DEPLOYER_ADDRESS], + }); + await setCode(DEPLOYER_SYSTEM_CONTRACT_ADDRESS, _contractDeployerCode); + }); + + describe("updateAccountVersion", function () { + it("non system call failed", async () => { + await expect(contractDeployer.updateAccountVersion(AA_VERSION_NONE)).to.be.revertedWith( + "This method require system call flag" + ); + }); + + it("from none to version1", async () => { + expect((await contractDeployer.getAccountInfo(contractDeployerSystemCall.address)).supportedAAVersion).to.be.eq( + AA_VERSION_NONE + ); + await contractDeployerSystemCall.updateAccountVersion(AA_VERSION_1); + expect((await contractDeployer.getAccountInfo(contractDeployerSystemCall.address)).supportedAAVersion).to.be.eq( + AA_VERSION_1 + ); + }); + + it("from version1 to none", async () => { + expect((await contractDeployer.getAccountInfo(contractDeployerSystemCall.address)).supportedAAVersion).to.be.eq( + AA_VERSION_1 + ); + await contractDeployerSystemCall.updateAccountVersion(AA_VERSION_NONE); + expect((await contractDeployer.getAccountInfo(contractDeployerSystemCall.address)).supportedAAVersion).to.be.eq( + AA_VERSION_NONE + ); + }); + }); + + describe("updateNonceOrdering", function () { + it("non system call failed", async () => { + await expect(contractDeployer.updateNonceOrdering(NONCE_ORDERING_SEQUENTIAL)).to.be.revertedWith( + "This method require system call flag" + ); + }); + + it("success from sequential to arbitrary", async () => { + expect((await contractDeployer.getAccountInfo(contractDeployerSystemCall.address)).nonceOrdering).to.be.eq( + NONCE_ORDERING_SEQUENTIAL + ); + await contractDeployerSystemCall.updateNonceOrdering(NONCE_ORDERING_ARBITRARY); + expect((await contractDeployer.getAccountInfo(contractDeployerSystemCall.address)).nonceOrdering).to.be.eq( + NONCE_ORDERING_ARBITRARY + ); + }); + + it("failed from arbitrary to sequential", async () => { + expect((await contractDeployer.getAccountInfo(contractDeployerSystemCall.address)).nonceOrdering).to.be.eq( + NONCE_ORDERING_ARBITRARY + ); + await expect(contractDeployerSystemCall.updateNonceOrdering(NONCE_ORDERING_SEQUENTIAL)).to.be.revertedWith( + "It is only possible to change from sequential to arbitrary ordering" + ); + }); + }); + + describe("getAccountInfo", function () { + it("success", async () => { + const accountInfo = await contractDeployer.getAccountInfo(RANDOM_ADDRESS); + expect(accountInfo.supportedAAVersion).to.be.eq(AA_VERSION_NONE); + expect(accountInfo.nonceOrdering).to.be.eq(NONCE_ORDERING_SEQUENTIAL); + }); + }); + + describe("extendedAccountVersion", function () { + it("account abstraction contract", async () => { + await contractDeployerSystemCall.updateAccountVersion(AA_VERSION_1); + expect(await contractDeployer.extendedAccountVersion(contractDeployerSystemCall.address)).to.be.eq(AA_VERSION_1); + await contractDeployerSystemCall.updateAccountVersion(AA_VERSION_NONE); + }); + + it("EOA", async () => { + expect(await contractDeployer.extendedAccountVersion(EOA)).to.be.eq(AA_VERSION_1); + }); + + it("Empty address", async () => { + // Double checking that the address is indeed empty + expect(await wallet.provider.getCode(EMPTY_KERNEL_ADDRESS)).to.be.eq("0x"); + + // Now testing that the system contracts with empty bytecode are still treated as AA_VERSION_NONE + expect(await contractDeployer.extendedAccountVersion(EMPTY_KERNEL_ADDRESS)).to.be.eq(AA_VERSION_NONE); + }); + + it("not AA", async () => { + expect(await contractDeployer.extendedAccountVersion(contractDeployerSystemCall.address)).to.be.eq( + AA_VERSION_NONE + ); + }); + }); + + describe("getNewAddressCreate2", function () { + it("success", async () => { + expect( + await contractDeployer.getNewAddressCreate2( + RANDOM_ADDRESS, + "0x0100FFFFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF", + "0x0000000022000000000123812381283812831823812838912389128938912893", + "0x" + ) + ).to.be.eq( + utils.create2Address( + RANDOM_ADDRESS, + "0x0100FFFFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF", + "0x0000000022000000000123812381283812831823812838912389128938912893", + "0x" + ) + ); + }); + }); + + describe("getNewAddressCreate", function () { + it("success", async () => { + expect(await contractDeployer.getNewAddressCreate(RANDOM_ADDRESS, 3223233)).to.be.eq( + utils.createAddress(RANDOM_ADDRESS, 3223233) + ); + }); + }); + + // TODO: some other things can be tested: + // - check other contracts (like known codes storage) + // - cases with the kernel space address (not possible in production) + // - twice on the same address for create (not possible in production) + // - constructor behavior (failed, invalid immutables array) + // - more cases for force deployments + describe("createAccount", function () { + it("non system call failed", async () => { + await expect( + contractDeployerNotSystemCall.createAccount( + ethers.constants.HashZero, + utils.hashBytecode(deployableArtifact.bytecode), + "0x", + AA_VERSION_NONE + ) + ).to.be.revertedWith("This method require system call flag"); + }); + + it("zero bytecode hash failed", async () => { + await expect( + contractDeployerSystemCall.createAccount( + ethers.constants.HashZero, + ethers.constants.HashZero, + "0x", + AA_VERSION_NONE + ) + ).to.be.revertedWith("BytecodeHash cannot be zero"); + }); + + it("not known bytecode hash failed", async () => { + await expect( + contractDeployerSystemCall.createAccount( + ethers.constants.HashZero, + "0x0100FFFFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF", + "0x", + AA_VERSION_NONE + ) + ).to.be.revertedWith("The code hash is not known"); + }); + + it("successfully deployed", async () => { + const nonce = await nonceHolder.getDeploymentNonce(wallet.address); + const expectedAddress = utils.createAddress(wallet.address, nonce); + await expect( + contractDeployer.createAccount( + ethers.constants.HashZero, + utils.hashBytecode(deployableArtifact.bytecode), + "0xdeadbeef", + AA_VERSION_NONE + ) + ) + .to.emit(contractDeployer, "ContractDeployed") + .withArgs(wallet.address, utils.hashBytecode(deployableArtifact.bytecode), expectedAddress) + .to.emit(Deployable__factory.connect(expectedAddress, wallet), "Deployed") + .withArgs(0, "0xdeadbeef"); + const accountInfo = await contractDeployer.getAccountInfo(expectedAddress); + expect(accountInfo.supportedAAVersion).to.be.eq(AA_VERSION_NONE); + expect(accountInfo.nonceOrdering).to.be.eq(NONCE_ORDERING_SEQUENTIAL); + }); + + it("non-zero value deployed", async () => { + const nonce = await nonceHolder.getDeploymentNonce(wallet.address); + const expectedAddress = utils.createAddress(wallet.address, nonce); + await expect( + contractDeployer.createAccount( + ethers.constants.HashZero, + utils.hashBytecode(deployableArtifact.bytecode), + "0x", + AA_VERSION_NONE, + { value: 11111111 } + ) + ) + .to.emit(contractDeployer, "ContractDeployed") + .withArgs(wallet.address, utils.hashBytecode(deployableArtifact.bytecode), expectedAddress) + .to.emit(Deployable__factory.connect(expectedAddress, wallet), "Deployed") + .withArgs(11111111, "0x"); + const accountInfo = await contractDeployer.getAccountInfo(expectedAddress); + expect(accountInfo.supportedAAVersion).to.be.eq(AA_VERSION_NONE); + expect(accountInfo.nonceOrdering).to.be.eq(NONCE_ORDERING_SEQUENTIAL); + }); + }); + + describe("create2Account", function () { + it("non system call failed", async () => { + await expect( + contractDeployerNotSystemCall.create2Account( + "0x1234567891234567891234512222122167891123456789123456787654323456", + utils.hashBytecode(deployableArtifact.bytecode), + "0x", + AA_VERSION_NONE + ) + ).to.be.revertedWith("This method require system call flag"); + }); + + it("zero bytecode hash failed", async () => { + await expect( + contractDeployerSystemCall.create2Account( + "0x1234567891234567891234512222122167891123456789123456787654323456", + ethers.constants.HashZero, + "0x", + AA_VERSION_NONE + ) + ).to.be.revertedWith("BytecodeHash cannot be zero"); + }); + + it("not known bytecode hash failed", async () => { + await expect( + contractDeployerSystemCall.create2Account( + "0x1234567891234567891234512222122167891123456789123456787654323456", + "0x0100FFFFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF", + "0x", + AA_VERSION_NONE + ) + ).to.be.revertedWith("The code hash is not known"); + }); + + it("successfully deployed", async () => { + const expectedAddress = utils.create2Address( + wallet.address, + utils.hashBytecode(deployableArtifact.bytecode), + "0x1234567891234567891234512222122167891123456789123456787654323456", + "0xdeadbeef" + ); + await expect( + contractDeployer.create2Account( + "0x1234567891234567891234512222122167891123456789123456787654323456", + utils.hashBytecode(deployableArtifact.bytecode), + "0xdeadbeef", + AA_VERSION_NONE + ) + ) + .to.emit(contractDeployer, "ContractDeployed") + .withArgs(wallet.address, utils.hashBytecode(deployableArtifact.bytecode), expectedAddress) + .to.emit(Deployable__factory.connect(expectedAddress, wallet), "Deployed") + .withArgs(0, "0xdeadbeef"); + const accountInfo = await contractDeployer.getAccountInfo(expectedAddress); + expect(accountInfo.supportedAAVersion).to.be.eq(AA_VERSION_NONE); + expect(accountInfo.nonceOrdering).to.be.eq(NONCE_ORDERING_SEQUENTIAL); + }); + + it("already deployed failed", async () => { + await expect( + contractDeployer.create2Account( + "0x1234567891234567891234512222122167891123456789123456787654323456", + utils.hashBytecode(deployableArtifact.bytecode), + "0xdeadbeef", + AA_VERSION_NONE + ) + ).to.be.revertedWith("Code hash is non-zero"); + }); + + it("non-zero value deployed", async () => { + const expectedAddress = utils.create2Address( + wallet.address, + utils.hashBytecode(deployableArtifact.bytecode), + ethers.constants.HashZero, + "0x" + ); + await expect( + contractDeployer.create2Account( + ethers.constants.HashZero, + utils.hashBytecode(deployableArtifact.bytecode), + "0x", + AA_VERSION_NONE, + { value: 5555 } + ) + ) + .to.emit(contractDeployer, "ContractDeployed") + .withArgs(wallet.address, utils.hashBytecode(deployableArtifact.bytecode), expectedAddress) + .to.emit(Deployable__factory.connect(expectedAddress, wallet), "Deployed") + .withArgs(5555, "0x"); + const accountInfo = await contractDeployer.getAccountInfo(expectedAddress); + expect(accountInfo.supportedAAVersion).to.be.eq(AA_VERSION_NONE); + expect(accountInfo.nonceOrdering).to.be.eq(NONCE_ORDERING_SEQUENTIAL); + }); + }); + + describe("create", function () { + it("non system call failed", async () => { + await expect( + contractDeployerNotSystemCall.create( + ethers.constants.HashZero, + utils.hashBytecode(deployableArtifact.bytecode), + "0x" + ) + ).to.be.revertedWith("This method require system call flag"); + }); + + it("successfully deployed", async () => { + const nonce = await nonceHolder.getDeploymentNonce(wallet.address); + const expectedAddress = utils.createAddress(wallet.address, nonce); + await expect( + contractDeployer.create(ethers.constants.HashZero, utils.hashBytecode(deployableArtifact.bytecode), "0x12") + ) + .to.emit(contractDeployer, "ContractDeployed") + .withArgs(wallet.address, utils.hashBytecode(deployableArtifact.bytecode), expectedAddress) + .to.emit(Deployable__factory.connect(expectedAddress, wallet), "Deployed") + .withArgs(0, "0x12"); + const accountInfo = await contractDeployer.getAccountInfo(expectedAddress); + expect(accountInfo.supportedAAVersion).to.be.eq(AA_VERSION_NONE); + expect(accountInfo.nonceOrdering).to.be.eq(NONCE_ORDERING_SEQUENTIAL); + }); + }); + + describe("create2", function () { + it("non system call failed", async () => { + await expect( + contractDeployerNotSystemCall.create2( + ethers.constants.HashZero, + utils.hashBytecode(deployableArtifact.bytecode), + "0x" + ) + ).to.be.revertedWith("This method require system call flag"); + }); + + it("successfully deployed", async () => { + const expectedAddress = utils.create2Address( + wallet.address, + utils.hashBytecode(deployableArtifact.bytecode), + "0x1234567891234567891234512222122167891123456789123456787654323456", + "0xab" + ); + await expect( + contractDeployer.create2( + "0x1234567891234567891234512222122167891123456789123456787654323456", + utils.hashBytecode(deployableArtifact.bytecode), + "0xab" + ) + ) + .to.emit(contractDeployer, "ContractDeployed") + .withArgs(wallet.address, utils.hashBytecode(deployableArtifact.bytecode), expectedAddress) + .to.emit(Deployable__factory.connect(expectedAddress, wallet), "Deployed") + .withArgs(0, "0xab"); + const accountInfo = await contractDeployer.getAccountInfo(expectedAddress); + expect(accountInfo.supportedAAVersion).to.be.eq(AA_VERSION_NONE); + expect(accountInfo.nonceOrdering).to.be.eq(NONCE_ORDERING_SEQUENTIAL); + }); + }); + + describe("forceDeployOnAddress", function () { + it("not from self call failed", async () => { + const deploymentData = { + bytecodeHash: utils.hashBytecode(deployableArtifact.bytecode), + newAddress: RANDOM_ADDRESS, + callConstructor: false, + value: 0, + input: "0x", + }; + await expect(contractDeployer.forceDeployOnAddress(deploymentData, wallet.address)).to.be.revertedWith( + "Callable only by self" + ); + }); + + it("not known bytecode hash failed", async () => { + const deploymentData = { + bytecodeHash: "0x0100FFFFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF", + newAddress: RANDOM_ADDRESS, + callConstructor: false, + value: 0, + input: "0x", + }; + await expect( + contractDeployer.connect(deployerAccount).forceDeployOnAddress(deploymentData, wallet.address) + ).to.be.revertedWith("The code hash is not known"); + }); + + it("successfully deployed", async () => { + const deploymentData = { + bytecodeHash: utils.hashBytecode(deployableArtifact.bytecode), + newAddress: RANDOM_ADDRESS, + callConstructor: false, + value: 0, + input: "0x", + }; + await expect(contractDeployer.connect(deployerAccount).forceDeployOnAddress(deploymentData, wallet.address)) + .to.emit(contractDeployer, "ContractDeployed") + .withArgs(wallet.address, utils.hashBytecode(deployableArtifact.bytecode), RANDOM_ADDRESS) + .to.not.emit(Deployable__factory.connect(RANDOM_ADDRESS, wallet), "Deployed"); + const accountInfo = await contractDeployer.getAccountInfo(RANDOM_ADDRESS); + expect(accountInfo.supportedAAVersion).to.be.eq(AA_VERSION_NONE); + expect(accountInfo.nonceOrdering).to.be.eq(NONCE_ORDERING_SEQUENTIAL); + }); + }); + + describe("forceDeployOnAddresses", function () { + it("not allowed to call", async () => { + const deploymentData = [ + { + bytecodeHash: utils.hashBytecode(deployableArtifact.bytecode), + newAddress: RANDOM_ADDRESS_2, + callConstructor: true, + value: 0, + input: "0x", + }, + { + bytecodeHash: utils.hashBytecode(deployableArtifact.bytecode), + newAddress: RANDOM_ADDRESS_3, + callConstructor: false, + value: 0, + input: "0xab", + }, + ]; + await expect(contractDeployer.forceDeployOnAddresses(deploymentData)).to.be.revertedWith( + "Can only be called by FORCE_DEPLOYER or COMPLEX_UPGRADER_CONTRACT" + ); + }); + + it("successfully deployed", async () => { + const deploymentData = [ + { + bytecodeHash: utils.hashBytecode(deployableArtifact.bytecode), + newAddress: RANDOM_ADDRESS_2, + callConstructor: true, + value: 0, + input: "0x", + }, + { + bytecodeHash: utils.hashBytecode(deployableArtifact.bytecode), + newAddress: RANDOM_ADDRESS_3, + callConstructor: false, + value: 0, + input: "0xab", + }, + ]; + await expect(contractDeployer.connect(forceDeployer).forceDeployOnAddresses(deploymentData)) + .to.emit(contractDeployer, "ContractDeployed") + .withArgs(forceDeployer.address, utils.hashBytecode(deployableArtifact.bytecode), RANDOM_ADDRESS_2) + .to.emit(contractDeployer, "ContractDeployed") + .withArgs(forceDeployer.address, utils.hashBytecode(deployableArtifact.bytecode), RANDOM_ADDRESS_3) + .to.emit(Deployable__factory.connect(RANDOM_ADDRESS_2, wallet), "Deployed") + .withArgs(0, "0x") + .to.not.emit(Deployable__factory.connect(RANDOM_ADDRESS_3, wallet), "Deployed"); + + const accountInfo1 = await contractDeployer.getAccountInfo(RANDOM_ADDRESS_2); + expect(accountInfo1.supportedAAVersion).to.be.eq(AA_VERSION_NONE); + expect(accountInfo1.nonceOrdering).to.be.eq(NONCE_ORDERING_SEQUENTIAL); + + const accountInfo2 = await contractDeployer.getAccountInfo(RANDOM_ADDRESS_3); + expect(accountInfo2.supportedAAVersion).to.be.eq(AA_VERSION_NONE); + expect(accountInfo2.nonceOrdering).to.be.eq(NONCE_ORDERING_SEQUENTIAL); + }); + }); +}); diff --git a/test/DefaultAccount.spec.ts b/test/DefaultAccount.spec.ts new file mode 100644 index 00000000..7cba80ca --- /dev/null +++ b/test/DefaultAccount.spec.ts @@ -0,0 +1,487 @@ +import { expect } from "chai"; +import { ethers, network } from "hardhat"; +import * as zksync from "zksync-web3"; +import type { Wallet } from "zksync-web3"; +import { serialize } from "zksync-web3/build/src/utils"; +import type { + Callable, + DefaultAccount, + L2EthToken, + MockERC20Approve, + NonceHolder, + Callable, + DefaultAccount, + DelegateCaller, + L2EthToken, + MockERC20Approve, + NonceHolder, +} from "../typechain-types"; +import { DefaultAccount__factory, L2EthToken__factory, NonceHolder__factory } from "../typechain-types"; +import { + BOOTLOADER_FORMAL_ADDRESS, + ETH_TOKEN_SYSTEM_CONTRACT_ADDRESS, + NONCE_HOLDER_SYSTEM_CONTRACT_ADDRESS, +} from "./shared/constants"; +import { signedTxToTransactionData } from "./shared/transactions"; +import { deployContract, getWallets, loadArtifact, setCode } from "./shared/utils"; + +describe("DefaultAccount tests", function () { + let wallet: Wallet; + let account: Wallet; + let defaultAccount: DefaultAccount; + let bootloader: ethers.Signer; + let nonceHolder: NonceHolder; + let l2EthToken: L2EthToken; + let callable: Callable; + let mockERC20Approve: MockERC20Approve; + let paymasterFlowInterface: ethers.utils.Interface; + let delegateCaller: DelegateCaller; + + const RANDOM_ADDRESS = ethers.utils.getAddress("0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"); + + before(async () => { + wallet = getWallets()[0]; + account = getWallets()[2]; + const defaultAccountArtifact = await loadArtifact("DefaultAccount"); + await setCode(account.address, defaultAccountArtifact.bytecode); + defaultAccount = DefaultAccount__factory.connect(account.address, wallet); + nonceHolder = NonceHolder__factory.connect(NONCE_HOLDER_SYSTEM_CONTRACT_ADDRESS, wallet); + l2EthToken = L2EthToken__factory.connect(ETH_TOKEN_SYSTEM_CONTRACT_ADDRESS, wallet); + callable = (await deployContract("Callable")) as Callable; + delegateCaller = (await deployContract("DelegateCaller")) as DelegateCaller; + mockERC20Approve = (await deployContract("MockERC20Approve")) as MockERC20Approve; + + const paymasterFlowInterfaceArtifact = await loadArtifact("IPaymasterFlow"); + paymasterFlowInterface = new ethers.utils.Interface(paymasterFlowInterfaceArtifact.abi); + + await network.provider.request({ + method: "hardhat_impersonateAccount", + params: [BOOTLOADER_FORMAL_ADDRESS], + }); + bootloader = await ethers.getSigner(BOOTLOADER_FORMAL_ADDRESS); + }); + + after(async function () { + await network.provider.request({ + method: "hardhat_stopImpersonatingAccount", + params: [BOOTLOADER_FORMAL_ADDRESS], + }); + }); + + describe("validateTransaction", function () { + it("non-deployer ignored", async () => { + const nonce = await nonceHolder.getMinNonce(account.address); + const legacyTx = await account.populateTransaction({ + type: 0, + to: RANDOM_ADDRESS, + from: account.address, + nonce: nonce, + data: "0x", + value: 0, + gasLimit: 50000, + }); + const txBytes = await account.signTransaction(legacyTx); + const parsedTx = zksync.utils.parseTransaction(txBytes); + const txData = signedTxToTransactionData(parsedTx)!; + + const txHash = parsedTx.hash; + delete legacyTx.from; + const signedHash = ethers.utils.keccak256(serialize(legacyTx)); + + const call = { + from: wallet.address, + to: defaultAccount.address, + value: 0, + data: defaultAccount.interface.encodeFunctionData("validateTransaction", [txHash, signedHash, txData]), + }; + expect(await wallet.provider.call(call)).to.be.eq("0x"); + }); + + it("invalid ignature", async () => { + const nonce = await nonceHolder.getMinNonce(account.address); + const legacyTx = await account.populateTransaction({ + type: 0, + to: RANDOM_ADDRESS, + from: account.address, + nonce: nonce, + data: "0x", + value: 0, + gasLimit: 50000, + }); + const txBytes = await account.signTransaction(legacyTx); + const parsedTx = zksync.utils.parseTransaction(txBytes); + parsedTx.s = "0x0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0"; + const txData = signedTxToTransactionData(parsedTx)!; + + const txHash = parsedTx.hash; + delete legacyTx.from; + const signedHash = ethers.utils.keccak256(serialize(legacyTx)); + + const call = { + from: BOOTLOADER_FORMAL_ADDRESS, + to: defaultAccount.address, + value: 0, + data: defaultAccount.interface.encodeFunctionData("validateTransaction", [txHash, signedHash, txData]), + }; + expect(await bootloader.provider.call(call)).to.be.eq(ethers.constants.HashZero); + }); + + it("valid tx", async () => { + const nonce = await nonceHolder.getMinNonce(account.address); + const legacyTx = await account.populateTransaction({ + type: 0, + to: RANDOM_ADDRESS, + from: account.address, + nonce: nonce, + data: "0x", + value: 0, + gasLimit: 50000, + }); + const txBytes = await account.signTransaction(legacyTx); + const parsedTx = zksync.utils.parseTransaction(txBytes); + const txData = signedTxToTransactionData(parsedTx)!; + + const txHash = parsedTx.hash; + delete legacyTx.from; + const signedHash = ethers.utils.keccak256(serialize(legacyTx)); + + const call = { + from: BOOTLOADER_FORMAL_ADDRESS, + to: defaultAccount.address, + value: 0, + data: defaultAccount.interface.encodeFunctionData("validateTransaction", [txHash, signedHash, txData]), + }; + expect(await bootloader.provider.call(call)).to.be.eq( + defaultAccount.interface.getSighash("validateTransaction") + "0".repeat(56) + ); + }); + }); + + describe("executeTransaction", function () { + it("non-deployer ignored", async () => { + const nonce = await nonceHolder.getMinNonce(account.address); + const legacyTx = await account.populateTransaction({ + type: 0, + to: callable.address, + from: account.address, + nonce: nonce, + data: "0xdeadbeef", + value: 5, + gasLimit: 50000, + }); + const txBytes = await account.signTransaction(legacyTx); + const parsedTx = zksync.utils.parseTransaction(txBytes); + const txData = signedTxToTransactionData(parsedTx)!; + + const txHash = parsedTx.hash; + delete legacyTx.from; + const signedHash = ethers.utils.keccak256(serialize(legacyTx)); + + await expect(await defaultAccount.executeTransaction(txHash, signedHash, txData)).to.not.emit(callable, "Called"); + }); + + it("successfully executed", async () => { + const nonce = await nonceHolder.getMinNonce(account.address); + const legacyTx = await account.populateTransaction({ + type: 0, + to: callable.address, + from: account.address, + nonce: nonce, + data: "0xdeadbeef", + value: 5, + gasLimit: 50000, + }); + const txBytes = await account.signTransaction(legacyTx); + const parsedTx = zksync.utils.parseTransaction(txBytes); + const txData = signedTxToTransactionData(parsedTx)!; + + const txHash = parsedTx.hash; + delete legacyTx.from; + const signedHash = ethers.utils.keccak256(serialize(legacyTx)); + + await expect(await defaultAccount.connect(bootloader).executeTransaction(txHash, signedHash, txData)) + .to.emit(callable, "Called") + .withArgs(5, "0xdeadbeef"); + }); + }); + + describe("executeTransactionFromOutside", function () { + it("nothing", async () => { + const nonce = await nonceHolder.getMinNonce(account.address); + const legacyTx = await account.populateTransaction({ + type: 0, + to: callable.address, + from: account.address, + nonce: nonce, + data: "0xdeadbeef", + value: 5, + gasLimit: 50000, + }); + const txBytes = await account.signTransaction(legacyTx); + const parsedTx = zksync.utils.parseTransaction(txBytes); + const txData = signedTxToTransactionData(parsedTx)!; + + delete legacyTx.from; + + await expect(await defaultAccount.executeTransactionFromOutside(txData)).to.not.emit(callable, "Called"); + }); + }); + + describe("payForTransaction", function () { + it("non-deployer ignored", async () => { + const nonce = await nonceHolder.getMinNonce(account.address); + const legacyTx = await account.populateTransaction({ + type: 0, + to: callable.address, + from: account.address, + nonce: nonce, + data: "0xdeadbeef", + value: 5, + gasLimit: 50000, + gasPrice: 200, + }); + const txBytes = await account.signTransaction(legacyTx); + const parsedTx = zksync.utils.parseTransaction(txBytes); + const txData = signedTxToTransactionData(parsedTx)!; + + const txHash = parsedTx.hash; + delete legacyTx.from; + const signedHash = ethers.utils.keccak256(serialize(legacyTx)); + + const balanceBefore = await l2EthToken.balanceOf(defaultAccount.address); + await defaultAccount.payForTransaction(txHash, signedHash, txData); + const balanceAfter = await l2EthToken.balanceOf(defaultAccount.address); + expect(balanceAfter).to.be.eq(balanceBefore); + }); + + it("successfully payed", async () => { + const nonce = await nonceHolder.getMinNonce(account.address); + const legacyTx = await account.populateTransaction({ + type: 0, + to: callable.address, + from: account.address, + nonce: nonce, + data: "0xdeadbeef", + value: 5, + gasLimit: 50000, + gasPrice: 200, + }); + const txBytes = await account.signTransaction(legacyTx); + const parsedTx = zksync.utils.parseTransaction(txBytes); + const txData = signedTxToTransactionData(parsedTx)!; + + const txHash = parsedTx.hash; + delete legacyTx.from; + const signedHash = ethers.utils.keccak256(serialize(legacyTx)); + + await expect(await defaultAccount.connect(bootloader).payForTransaction(txHash, signedHash, txData)) + .to.emit(l2EthToken, "Transfer") + .withArgs(account.address, BOOTLOADER_FORMAL_ADDRESS, 50000 * 200); + }); + }); + + describe("prepareForPaymaster", function () { + it("non-deployer ignored", async () => { + const eip712Tx = await account.populateTransaction({ + type: 113, + to: callable.address, + from: account.address, + data: "0x", + value: 0, + maxFeePerGas: 12000, + maxPriorityFeePerGas: 100, + gasLimit: 50000, + customData: { + gasPerPubdata: zksync.utils.DEFAULT_GAS_PER_PUBDATA_LIMIT, + paymasterParams: { + paymaster: RANDOM_ADDRESS, + paymasterInput: paymasterFlowInterface.encodeFunctionData("approvalBased", [ + mockERC20Approve.address, + 2023, + "0x", + ]), + }, + }, + }); + const signedEip712Tx = await account.signTransaction(eip712Tx); + const parsedEIP712tx = zksync.utils.parseTransaction(signedEip712Tx); + + const eip712TxData = signedTxToTransactionData(parsedEIP712tx)!; + const eip712TxHash = parsedEIP712tx.hash; + const eip712SignedHash = zksync.EIP712Signer.getSignedDigest(eip712Tx); + + await expect(await defaultAccount.prepareForPaymaster(eip712TxHash, eip712SignedHash, eip712TxData)).to.not.emit( + mockERC20Approve, + "Approved" + ); + }); + + it("successfully prepared", async () => { + const eip712Tx = await account.populateTransaction({ + type: 113, + to: callable.address, + from: account.address, + data: "0x", + value: 0, + maxFeePerGas: 12000, + maxPriorityFeePerGas: 100, + gasLimit: 50000, + customData: { + gasPerPubdata: zksync.utils.DEFAULT_GAS_PER_PUBDATA_LIMIT, + paymasterParams: { + paymaster: RANDOM_ADDRESS, + paymasterInput: paymasterFlowInterface.encodeFunctionData("approvalBased", [ + mockERC20Approve.address, + 2023, + "0x", + ]), + }, + }, + }); + const signedEip712Tx = await account.signTransaction(eip712Tx); + const parsedEIP712tx = zksync.utils.parseTransaction(signedEip712Tx); + + const eip712TxData = signedTxToTransactionData(parsedEIP712tx)!; + const eip712TxHash = parsedEIP712tx.hash; + const eip712SignedHash = zksync.EIP712Signer.getSignedDigest(eip712Tx); + + await expect( + await defaultAccount.connect(bootloader).prepareForPaymaster(eip712TxHash, eip712SignedHash, eip712TxData) + ) + .to.emit(mockERC20Approve, "Approved") + .withArgs(RANDOM_ADDRESS, 2023); + }); + }); + + describe("fallback/receive", function () { + it("zero value", async () => { + const call = { + from: wallet.address, + to: defaultAccount.address, + value: 0, + data: "0x872384894899834939049043904390390493434343434344433443433434344234234234", + }; + expect(await wallet.provider.call(call)).to.be.eq("0x"); + }); + + describe("prepareForPaymaster", function () { + it("non-deployer ignored", async () => { + const eip712Tx = await account.populateTransaction({ + type: 113, + to: callable.address, + from: account.address, + data: "0x", + value: 0, + maxFeePerGas: 12000, + maxPriorityFeePerGas: 100, + gasLimit: 50000, + customData: { + gasPerPubdata: zksync.utils.DEFAULT_GAS_PER_PUBDATA_LIMIT, + paymasterParams: { + paymaster: RANDOM_ADDRESS, + paymasterInput: paymasterFlowInterface.encodeFunctionData("approvalBased", [ + mockERC20Approve.address, + 2023, + "0x", + ]), + }, + }, + }); + const signedEip712Tx = await account.signTransaction(eip712Tx); + const parsedEIP712tx = zksync.utils.parseTransaction(signedEip712Tx); + + const eip712TxData = signedTxToTransactionData(parsedEIP712tx)!; + const eip712TxHash = parsedEIP712tx.hash; + const eip712SignedHash = zksync.EIP712Signer.getSignedDigest(eip712Tx); + + await expect( + await defaultAccount.prepareForPaymaster(eip712TxHash, eip712SignedHash, eip712TxData) + ).to.not.emit(mockERC20Approve, "Approved"); + }); + + it("successfully prepared", async () => { + const eip712Tx = await account.populateTransaction({ + type: 113, + to: callable.address, + from: account.address, + data: "0x", + value: 0, + maxFeePerGas: 12000, + maxPriorityFeePerGas: 100, + gasLimit: 50000, + customData: { + gasPerPubdata: zksync.utils.DEFAULT_GAS_PER_PUBDATA_LIMIT, + paymasterParams: { + paymaster: RANDOM_ADDRESS, + paymasterInput: paymasterFlowInterface.encodeFunctionData("approvalBased", [ + mockERC20Approve.address, + 2023, + "0x", + ]), + }, + }, + }); + const signedEip712Tx = await account.signTransaction(eip712Tx); + const parsedEIP712tx = zksync.utils.parseTransaction(signedEip712Tx); + + const eip712TxData = signedTxToTransactionData(parsedEIP712tx)!; + const eip712TxHash = parsedEIP712tx.hash; + const eip712SignedHash = zksync.EIP712Signer.getSignedDigest(eip712Tx); + + await expect( + await defaultAccount.connect(bootloader).prepareForPaymaster(eip712TxHash, eip712SignedHash, eip712TxData) + ) + .to.emit(mockERC20Approve, "Approved") + .withArgs(RANDOM_ADDRESS, 2023); + }); + }); + + describe("fallback/receive", function () { + it("zero value by EOA wallet", async () => { + const call = { + from: wallet.address, + to: defaultAccount.address, + value: 0, + data: "0x872384894899834939049043904390390493434343434344433443433434344234234234", + }; + expect(await wallet.provider.call(call)).to.be.eq("0x"); + }); + + it("non-zero value by EOA wallet", async () => { + const call = { + from: wallet.address, + to: defaultAccount.address, + value: 3223, + data: "0x87238489489983493904904390431212224343434344433443433434344234234234", + }; + expect(await wallet.provider.call(call)).to.be.eq("0x"); + }); + + it("zero value by bootloader", async () => { + // Here we need to ensure that during delegatecalls even if `msg.sender` is the bootloader, + // the fallback is behaving correctly + const calldata = delegateCaller.interface.encodeFunctionData("delegateCall", [defaultAccount.address]); + const call = { + from: BOOTLOADER_FORMAL_ADDRESS, + to: delegateCaller.address, + value: 0, + data: calldata, + }; + expect(await bootloader.call(call)).to.be.eq("0x"); + }); + + it("non-zero value by bootloader", async () => { + // Here we need to ensure that during delegatecalls even if `msg.sender` is the bootloader, + // the fallback is behaving correctly + const calldata = delegateCaller.interface.encodeFunctionData("delegateCall", [defaultAccount.address]); + const call = { + from: BOOTLOADER_FORMAL_ADDRESS, + to: delegateCaller.address, + value: 3223, + data: calldata, + }; + expect(await bootloader.call(call)).to.be.eq("0x"); + }); + }); + }); +}); diff --git a/test/EcAdd.spec.ts b/test/EcAdd.spec.ts new file mode 100644 index 00000000..a17a9f0b --- /dev/null +++ b/test/EcAdd.spec.ts @@ -0,0 +1,188 @@ +import { expect } from "chai"; +import type { Contract } from "zksync-web3"; +import { callFallback, deployContractYul } from "./shared/utils"; + +describe("EcAdd tests", function () { + let ecAdd: Contract; + + before(async () => { + ecAdd = await deployContractYul("EcAdd", "precompiles"); + }); + + describe("Ethereum tests", function () { + it("0 bytes: (0, 0) + (0, 0)", async () => { + const returnData = await callFallback(ecAdd, ""); + await expect(returnData).to.be.equal( + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + }); + + it("128 bytes: (6, 9) + (19274124, 124124)", async () => { + const call = callFallback( + ecAdd, + "0x00000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000126198c000000000000000000000000000000000000000000000000000000000001e4dc" + ); + await expect(call).to.be.reverted; + }); + + it("128 bytes: (1, 2) + (0, 0)", async () => { + const returnData = await callFallback( + ecAdd, + "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002" + ); + }); + + it("128 bytes: (0, 0) + (0, 0)", async () => { + const returnData = await callFallback( + ecAdd, + "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + }); + + it("128 bytes: (0, 3) + (1, 2)", async () => { + const call = callFallback( + ecAdd, + "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002" + ); + await expect(call).to.be.reverted; + }); + + it("128 bytes: (0, 0) + (1, 3)", async () => { + const call = callFallback( + ecAdd, + "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003" + ); + await expect(call).to.be.reverted; + }); + + it("128 bytes: (0, 0) + (1, 2)", async () => { + const returnData = await callFallback( + ecAdd, + "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002" + ); + await expect(returnData).to.be.equal( + "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002" + ); + }); + + it("64 bytes: (0, 0) + (0, 0)", async () => { + const returnData = await callFallback( + ecAdd, + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + }); + + it("128 bytes: (1, 2) + (1, 2)", async () => { + const returnData = await callFallback( + ecAdd, + "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002" + ); + await expect(returnData).to.be.equal( + "0x030644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd315ed738c0e0a7c92e7845f96b2ae9c0a68a6a449e3538fc7ff3ebf7a5a18a2c4" + ); + }); + + it("80 bytes: (1, 3) + (0, 0)", async () => { + const call = callFallback( + ecAdd, + "0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(call).to.be.reverted; + }); + + it("192 bytes: (1, 2) + (0, 0)", async () => { + const returnData = await callFallback( + ecAdd, + "0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002" + ); + }); + + it("192 bytes: (0, 0) + (0, 0)", async () => { + const returnData = await callFallback( + ecAdd, + "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + }); + + it("80 bytes: (0, 0) + (0, 0)", async () => { + const returnData = await callFallback( + ecAdd, + "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + }); + + // (10744596414106452074759370245733544594153395043370666422502510773307029471145, 848677436511517736191562425154572367705380862894644942948681172815252343932) + // + + // (10744596414106452074759370245733544594153395043370666422502510773307029471145, 21039565435327757486054843320102702720990930294403178719740356721829973864651) + it("192 bytes: (1074..1145, 8486..3932) + (1074..1145, 2103..4651)", async () => { + const returnData = await callFallback( + ecAdd, + "0x17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa901e0559bacb160664764a357af8a9fe70baa9258e0b959273ffc5718c6d4cc7c17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa92e83f8d734803fc370eba25ed1f6b8768bd6d83887b87165fc2434fe11a830cb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + }); + + it("192 bytes: (0, 0) + (1, 2)", async () => { + const returnData = await callFallback( + ecAdd, + "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002" + ); + }); + + it("192 bytes: (1, 2) + (1, 2)", async () => { + const returnData = await callFallback( + ecAdd, + "0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x030644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd315ed738c0e0a7c92e7845f96b2ae9c0a68a6a449e3538fc7ff3ebf7a5a18a2c4" + ); + }); + + it("64 bytes: (1, 2) + (0, 0)", async () => { + const returnData = await callFallback( + ecAdd, + "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002" + ); + await expect(returnData).to.be.equal( + "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002" + ); + }); + + // (10744596414106452074759370245733544594153395043370666422502510773307029471145, 848677436511517736191562425154572367705380862894644942948681172815252343932) + // + + // (1624070059937464756887933993293429854168590106605707304006200119738501412969, 3269329550605213075043232856820720631601935657990457502777101397807070461336) + it("128 bytes: (1074..1145, 8486..3932) + (1624..2969, 3269..1336)", async () => { + const returnData = await callFallback( + ecAdd, + "0x17c139df0efee0f766bc0204762b774362e4ded88953a39ce849a8a7fa163fa901e0559bacb160664764a357af8a9fe70baa9258e0b959273ffc5718c6d4cc7c039730ea8dff1254c0fee9c0ea777d29a9c710b7e616683f194f18c43b43b869073a5ffcc6fc7a28c30723d6e58ce577356982d65b833a5a5c15bf9024b43d98" + ); + await expect(returnData).to.be.equal( + "0x15bf2bb17880144b5d1cd2b1f46eff9d617bffd1ca57c37fb5a49bd84e53cf66049c797f9ce0d17083deb32b5e36f2ea2a212ee036598dd7624c168993d1355f" + ); + }); + }); +}); diff --git a/test/EcMul.spec.ts b/test/EcMul.spec.ts new file mode 100644 index 00000000..8a29c29b --- /dev/null +++ b/test/EcMul.spec.ts @@ -0,0 +1,399 @@ +import { expect } from "chai"; +import type { Contract } from "zksync-web3"; +import { callFallback, deployContractYul } from "./shared/utils"; + +describe("EcMul tests", function () { + let ecMul: Contract; + + before(async () => { + ecMul = await deployContractYul("EcMul", "precompiles"); + }); + + describe("Ethereum tests", function () { + it("128 bytes: (1, 3) * 0", async () => { + const call = callFallback( + ecMul, + "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(call).to.be.reverted; + }); + + it("128 bytes: (1, 2) * 21888242871839275222246405745257275088548364400416034343698204186575808495616", async () => { + const returnData = await callFallback( + ecMul, + "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x000000000000000000000000000000000000000000000000000000000000000130644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd45" + ); + }); + + it("64 bytes: (1, 3) * 0", async () => { + const call = callFallback( + ecMul, + "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003" + ); + await expect(call).to.be.reverted; + }); + + it("128 bytes: (1, 3) * 21888242871839275222246405745257275088548364400416034343698204186575808495616", async () => { + const call = callFallback( + ecMul, + "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000000000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(call).to.be.reverted; + }); + + it("96 bytes: (1, 3) * 21888242871839275222246405745257275088548364400416034343698204186575808495617", async () => { + const call = callFallback( + ecMul, + "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001" + ); + await expect(call).to.be.reverted; + }); + + it("96 bytes: (1, 3) * 1", async () => { + const call = callFallback( + ecMul, + "0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001" + ); + await expect(call).to.be.reverted; + }); + + // (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) + // * + // 21888242871839275222246405745257275088548364400416034343698204186575808495616 + it("96 bytes: (1199..7827, 1184..6598) * 2188..5616", async () => { + const returnData = await callFallback( + ecMul, + "0x1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000" + ); + await expect(returnData).to.be.equal( + "0x1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe3163511ddc1c3f25d396745388200081287b3fd1472d8339d5fecb2eae0830451" + ); + }); + + it("128 bytes: (1, 3) * 9", async () => { + const call = callFallback( + ecMul, + "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(call).to.be.reverted; + }); + + it("128 bytes: (1, 3) * 21888242871839275222246405745257275088548364400416034343698204186575808495617", async () => { + const call = callFallback( + ecMul, + "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(call).to.be.reverted; + }); + + it("128 bytes: (1, 2) * 340282366920938463463374607431768211456", async () => { + const returnData = await callFallback( + ecMul, + "0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000100000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x13b8fec4a1eb2c7e3ccc07061ad516277c3bbe57bd4a302012b58a517f6437a4224d978b5763831dff16ce9b2c42222684835fedfc70ffec005789bb0c10de36" + ); + }); + + it("96 bytes: (1, 3) * 2", async () => { + const call = callFallback( + ecMul, + "0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000002" + ); + await expect(call).to.be.reverted; + }); + + it("128 bytes: (1, 3) * 1", async () => { + const call = callFallback( + ecMul, + "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(call).to.be.reverted; + }); + + it("96 bytes: (1, 2) * 115792089237316195423570985008687907853269984665640564039457584007913129639935", async () => { + const returnData = await callFallback( + ecMul, + "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + ); + await expect(returnData).to.be.equal( + "0x2f588cffe99db877a4434b598ab28f81e0522910ea52b45f0adaa772b2d5d35212f42fa8fd34fb1b33d8c6a718b6590198389b26fc9d8808d971f8b009777a97" + ); + }); + + it("128 bytes: (1, 2) * 21888242871839275222246405745257275088548364400416034343698204186575808495617", async () => { + const returnData = await callFallback( + ecMul, + "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + }); + + it("128 bytes: (1, 2) * 2", async () => { + const returnData = await callFallback( + ecMul, + "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x030644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd315ed738c0e0a7c92e7845f96b2ae9c0a68a6a449e3538fc7ff3ebf7a5a18a2c4" + ); + }); + + // (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) + // * + // 340282366920938463463374607431768211456 + it("80 bytes: (1199..7827, 1184..6598) * 340282366920938463463374607431768211456", async () => { + const returnData = await callFallback( + ecMul, + "0x1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000100000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x1051acb0700ec6d42a88215852d582efbaef31529b6fcbc3277b5c1b300f5cf0135b2394bb45ab04b8bd7611bd2dfe1de6a4e6e2ccea1ea1955f577cd66af85b" + ); + }); + + // (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) + // * + // 0 + it("96 bytes: (1199..7827, 1184..6598) * 0", async () => { + const returnData = await callFallback( + ecMul, + "0x1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + }); + + it("96 bytes: (1, 3) * 9", async () => { + const call = callFallback( + ecMul, + "0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000009" + ); + await expect(call).to.be.reverted; + }); + + // (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) + // * + // 115792089237316195423570985008687907853269984665640564039457584007913129639935 + it("96 bytes: (1, 3) * 9", async () => { + const returnData = await callFallback( + ecMul, + "0x1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f6ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + ); + await expect(returnData).to.be.equal( + "0x2cde5879ba6f13c0b5aa4ef627f159a3347df9722efce88a9afbb20b763b4c411aa7e43076f6aee272755a7f9b84832e71559ba0d2e0b17d5f9f01755e5b0d11" + ); + }); + + it("96 bytes: (1, 3) * 115792089237316195423570985008687907853269984665640564039457584007913129639935", async () => { + const call = callFallback( + ecMul, + "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(call).to.be.reverted; + }); + + // (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) + // * + // 0 + it("64 bytes: (1199..7827, 1184..6598) * 0", async () => { + const returnData = await callFallback( + ecMul, + "0x1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f6" + ); + await expect(returnData).to.be.equal( + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + }); + + it("128 bytes: (1, 2) * 115792089237316195423570985008687907853269984665640564039457584007913129639935", async () => { + const returnData = await callFallback( + ecMul, + "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x2f588cffe99db877a4434b598ab28f81e0522910ea52b45f0adaa772b2d5d35212f42fa8fd34fb1b33d8c6a718b6590198389b26fc9d8808d971f8b009777a97" + ); + }); + + // (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) + // * + // 1 + it("96 bytes: (1199..7827, 1184..6598) * 1", async () => { + const returnData = await callFallback( + ecMul, + "0x1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000001" + ); + await expect(returnData).to.be.equal( + "0x1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f6" + ); + }); + + it("96 bytes: (1, 2) * 9", async () => { + const returnData = await callFallback( + ecMul, + "0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000009" + ); + await expect(returnData).to.be.equal( + "0x039730ea8dff1254c0fee9c0ea777d29a9c710b7e616683f194f18c43b43b869073a5ffcc6fc7a28c30723d6e58ce577356982d65b833a5a5c15bf9024b43d98" + ); + }); + + it("96 bytes: (1, 2) * 21888242871839275222246405745257275088548364400416034343698204186575808495617", async () => { + const returnData = await callFallback( + ecMul, + "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001" + ); + await expect(returnData).to.be.equal( + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + }); + + it("80 bytes: (1, 3) * 340282366920938463463374607431768211456", async () => { + const call = callFallback( + ecMul, + "0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000100000000000000000000000000000000" + ); + await expect(call).to.be.reverted; + }); + + it("80 bytes: (1, 3) * 2", async () => { + const call = callFallback( + ecMul, + "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(call).to.be.reverted; + }); + + it("96 bytes: (1, 3) * 21888242871839275222246405745257275088548364400416034343698204186575808495616", async () => { + const call = callFallback( + ecMul, + "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000330644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000" + ); + await expect(call).to.be.reverted; + }); + + // (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) + // * + // 2 + it("96 bytes: (1199..7827, 1184..6598) * 2", async () => { + const returnData = await callFallback( + ecMul, + "0x1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000002" + ); + await expect(returnData).to.be.equal( + "0x03d64e49ebb3c56c99e0769c1833879c9b86ead23945e1e7477cbd057e961c500d6840b39f8c2fefe0eced3e7d210b830f50831e756f1cc9039af65dc292e6d0" + ); + }); + + it("128 bytes: (1, 2) * 9", async () => { + const returnData = await callFallback( + ecMul, + "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x039730ea8dff1254c0fee9c0ea777d29a9c710b7e616683f194f18c43b43b869073a5ffcc6fc7a28c30723d6e58ce577356982d65b833a5a5c15bf9024b43d98" + ); + }); + + it("96 bytes: (1, 3) * 0", async () => { + const call = callFallback( + ecMul, + "0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(call).to.be.reverted; + }); + + // (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) + // * + // 21888242871839275222246405745257275088548364400416034343698204186575808495617 + it("96 bytes: (1199..7827, 1184..6598) * 2188..5617", async () => { + const returnData = await callFallback( + ecMul, + "0x1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001" + ); + await expect(returnData).to.be.equal( + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + }); + + // (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) + // * + // 9 + it("96 bytes: (1199..7827, 1184..6598) * 9", async () => { + const returnData = await callFallback( + ecMul, + "0x1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f60000000000000000000000000000000000000000000000000000000000000009" + ); + await expect(returnData).to.be.equal( + "0x1dbad7d39dbc56379f78fac1bca147dc8e66de1b9d183c7b167351bfe0aeab742cd757d51289cd8dbd0acf9e673ad67d0f0a89f912af47ed1be53664f5692575" + ); + }); + + it("96 bytes: (1, 2) * 21888242871839275222246405745257275088548364400416034343698204186575808495616", async () => { + const returnData = await callFallback( + ecMul, + "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000230644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000000" + ); + await expect(returnData).to.be.equal( + "0x000000000000000000000000000000000000000000000000000000000000000130644e72e131a029b85045b68181585d97816a916871ca8d3c208c16d87cfd45" + ); + }); + + // (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) + // * + // 2 + it("128 bytes: (1199..7827, 1184..6598) * 2", async () => { + const returnData = await callFallback( + ecMul, + "0x1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f600000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x03d64e49ebb3c56c99e0769c1833879c9b86ead23945e1e7477cbd057e961c500d6840b39f8c2fefe0eced3e7d210b830f50831e756f1cc9039af65dc292e6d0" + ); + }); + + it("128 bytes: (1, 2) * 340282366920938463463374607431768211456", async () => { + const returnData = await callFallback( + ecMul, + "0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x13b8fec4a1eb2c7e3ccc07061ad516277c3bbe57bd4a302012b58a517f6437a4224d978b5763831dff16ce9b2c42222684835fedfc70ffec005789bb0c10de36" + ); + }); + + // (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) + // * + // 115792089237316195423570985008687907853269984665640564039457584007913129639935 + it("128 bytes: (1199..7827, 1184..6598) * 1157..9935", async () => { + const returnData = await callFallback( + ecMul, + "0x1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f6ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x2cde5879ba6f13c0b5aa4ef627f159a3347df9722efce88a9afbb20b763b4c411aa7e43076f6aee272755a7f9b84832e71559ba0d2e0b17d5f9f01755e5b0d11" + ); + }); + + // (11999875504842010600789954262886096740416429265635183817701593963271973497827, 11843594000332171325303933275547366297934113019079887694534126289021216356598) + // * + // 21888242871839275222246405745257275088548364400416034343698204186575808495617 + it("128 bytes: (1199..7827, 1184..6598) * 2188..5617", async () => { + const returnData = await callFallback( + ecMul, + "0x1a87b0584ce92f4593d161480614f2989035225609f08058ccfa3d0f940febe31a2f3c951f6dadcc7ee9007dff81504b0fcd6d7cf59996efdc33d92bf7f9f8f630644e72e131a029b85045b68181585d2833e84879b9709143e1f593f00000010000000000000000000000000000000000000000000000000000000000000000" + ); + await expect(returnData).to.be.equal( + "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ); + }); + }); +}); diff --git a/test/EmptyContract.spec.ts b/test/EmptyContract.spec.ts new file mode 100644 index 00000000..a56a454f --- /dev/null +++ b/test/EmptyContract.spec.ts @@ -0,0 +1,44 @@ +import { expect } from "chai"; +import { ethers } from "hardhat"; +import type { Wallet } from "zksync-web3"; +import type { EmptyContract } from "../typechain-types"; +import { deployContract, getWallets, provider } from "./shared/utils"; + +describe("EmptyContract tests", function () { + let wallet: Wallet; + let emptyContract: EmptyContract; + + before(async () => { + wallet = getWallets()[0]; + emptyContract = (await deployContract("EmptyContract")) as EmptyContract; + }); + + it("zero value", async () => { + const tx = { + from: wallet.address, + to: emptyContract.address, + value: 0, + data: "0x1234567890deadbeef1234567890", + }; + expect(await provider.call(tx)).to.be.eq("0x"); + }); + + it("non-zero value", async () => { + const tx = { + from: wallet.address, + to: emptyContract.address, + value: ethers.utils.parseEther("1.0"), + data: "0x1234567890deadbeef1234567890", + }; + expect(await provider.call(tx)).to.be.eq("0x"); + }); + + it("empty calldata", async () => { + const tx = { + from: wallet.address, + to: emptyContract.address, + data: "", + }; + expect(await provider.call(tx)).to.be.eq("0x"); + }); +}); diff --git a/test/EventWriter.spec.ts b/test/EventWriter.spec.ts new file mode 100644 index 00000000..ab3e3942 --- /dev/null +++ b/test/EventWriter.spec.ts @@ -0,0 +1,81 @@ +import { expect } from "chai"; +import type { Wallet } from "zksync-web3"; +import { Contract } from "zksync-web3"; +import { Language } from "../scripts/constants"; +import { readYulBytecode } from "../scripts/utils"; +import type { EventWriterTest } from "../typechain-types"; +import { EVENT_WRITER_CONTRACT_ADDRESS } from "./shared/constants"; +import { deployContract, getCode, getWallets, setCode } from "./shared/utils"; + +describe("EventWriter tests", function () { + let wallet: Wallet; + let eventWriter: Contract; + let eventWriterTest: EventWriterTest; + + let _eventWriterCode: string; + + before(async () => { + _eventWriterCode = await getCode(EVENT_WRITER_CONTRACT_ADDRESS); + const eventWriterTestCode = readYulBytecode({ + codeName: "EventWriter", + path: "", + lang: Language.Yul, + address: ethers.constants.AddressZero, + }); + await setCode(EVENT_WRITER_CONTRACT_ADDRESS, eventWriterTestCode); + + wallet = (await getWallets())[0]; + eventWriter = new Contract(EVENT_WRITER_CONTRACT_ADDRESS, [], wallet); + eventWriterTest = (await deployContract("EventWriterTest")) as EventWriterTest; + }); + + after(async () => { + await setCode(EVENT_WRITER_CONTRACT_ADDRESS, _eventWriterCode); + }); + + it("non system call failed", async () => { + await expect(eventWriter.fallback({ data: "0x" })).to.be.reverted; + }); + + // TODO: anonymous events doesn't work + it.skip("zero topics", async () => { + console.log((await (await eventWriterTest.zeroTopics("0x")).wait()).events); + await expect(eventWriterTest.zeroTopics("0x")).to.emit(eventWriterTest, "ZeroTopics").withArgs("0x"); + }); + + it("one topic", async () => { + await expect(eventWriterTest.oneTopic("0xdeadbeef")).to.emit(eventWriterTest, "OneTopic").withArgs("0xdeadbeef"); + }); + + it("two topics", async () => { + await expect( + eventWriterTest.twoTopics("0x1278378123784223232874782378478237848723784782378423747237848723", "0xabcd") + ) + .to.emit(eventWriterTest, "TwoTopics") + .withArgs("0x1278378123784223232874782378478237848723784782378423747237848723", "0xabcd"); + }); + + it("three topics", async () => { + await expect(eventWriterTest.threeTopics(0, 1133, "0x")) + .to.emit(eventWriterTest, "ThreeTopics") + .withArgs(0, 1133, "0x"); + }); + + it("four topics", async () => { + await expect( + eventWriterTest.fourTopics( + "0x1234567890", + 0, + 22, + "0x2828383489438934898934893894893895348915893489589348958349589348958934859348958934858394589348958934854385838954893489" + ) + ) + .to.emit(eventWriterTest, "FourTopics") + .withArgs( + "0x1234567890", + 0, + 22, + "0x2828383489438934898934893894893895348915893489589348958349589348958934859348958934858394589348958934854385838954893489" + ); + }); +}); diff --git a/test/ImmutableSimulator.spec.ts b/test/ImmutableSimulator.spec.ts new file mode 100644 index 00000000..022e529a --- /dev/null +++ b/test/ImmutableSimulator.spec.ts @@ -0,0 +1,59 @@ +import { expect } from "chai"; +import { ethers, network } from "hardhat"; +import type { ImmutableSimulator } from "../typechain-types"; +import { DEPLOYER_SYSTEM_CONTRACT_ADDRESS } from "./shared/constants"; +import { deployContract } from "./shared/utils"; + +describe("ImmutableSimulator tests", function () { + let immutableSimulator: ImmutableSimulator; + + const RANDOM_ADDRESS = "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"; + const IMMUTABLES_DATA = [ + { + index: 0, + value: "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef", + }, + { + index: 23, + value: "0x0000000000000000000000000000000000000000000000000000000000000111", + }, + ]; + + before(async () => { + immutableSimulator = (await deployContract("ImmutableSimulator")) as ImmutableSimulator; + }); + + describe("setImmutables", function () { + it("non-deployer failed to call", async () => { + await expect(immutableSimulator.setImmutables(RANDOM_ADDRESS, IMMUTABLES_DATA)).to.be.revertedWith( + "Callable only by the deployer system contract" + ); + }); + + it("successfully set", async () => { + await network.provider.request({ + method: "hardhat_impersonateAccount", + params: [DEPLOYER_SYSTEM_CONTRACT_ADDRESS], + }); + + const deployer_account = await ethers.getSigner(DEPLOYER_SYSTEM_CONTRACT_ADDRESS); + + await immutableSimulator.connect(deployer_account).setImmutables(RANDOM_ADDRESS, IMMUTABLES_DATA); + + await network.provider.request({ + method: "hardhat_stopImpersonatingAccount", + params: [DEPLOYER_SYSTEM_CONTRACT_ADDRESS], + }); + + for (const immutable of IMMUTABLES_DATA) { + expect(await immutableSimulator.getImmutable(RANDOM_ADDRESS, immutable.index)).to.be.eq(immutable.value); + } + }); + }); + + describe("getImmutable", function () { + it("zero", async () => { + expect(await immutableSimulator.getImmutable(RANDOM_ADDRESS, 333)).to.be.eq(ethers.constants.HashZero); + }); + }); +}); diff --git a/test/KnownCodesStorage.spec.ts b/test/KnownCodesStorage.spec.ts new file mode 100644 index 00000000..a9769463 --- /dev/null +++ b/test/KnownCodesStorage.spec.ts @@ -0,0 +1,156 @@ +import { expect } from "chai"; +import { ethers, network } from "hardhat"; +import type { Wallet } from "zksync-web3"; +import type { KnownCodesStorage, MockL1Messenger } from "../typechain-types"; +import { MockL1Messenger__factory } from "../typechain-types"; +import { + BOOTLOADER_FORMAL_ADDRESS, + COMPRESSOR_CONTRACT_ADDRESS, + L1_MESSENGER_SYSTEM_CONTRACT_ADDRESS, +} from "./shared/constants"; +import { deployContract, getCode, getWallets, loadArtifact, setCode } from "./shared/utils"; + +describe("KnownCodesStorage tests", function () { + let wallet: Wallet; + let knownCodesStorage: KnownCodesStorage; + let mockL1Messenger: MockL1Messenger; + let bootloaderAccount: ethers.Signer; + let compressorAccount: ethers.Signer; + + let _l1MessengerCode: string; + + const BYTECODE_HASH_1 = "0x0100FFFFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF"; + const BYTECODE_HASH_2 = "0x0100FFFFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEE1"; + const BYTECODE_HASH_3 = "0x0100FFFFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEE2"; + const BYTECODE_HASH_4 = "0x0100FFFFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEE3"; + const INCORRECTLY_FORMATTED_HASH = "0x0120FFFFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF"; + const INVALID_LENGTH_HASH = "0x0100FFFEDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF"; + + before(async () => { + wallet = (await getWallets())[0]; + knownCodesStorage = (await deployContract("KnownCodesStorage")) as KnownCodesStorage; + + _l1MessengerCode = await getCode(L1_MESSENGER_SYSTEM_CONTRACT_ADDRESS); + const l1MessengerArtifact = await loadArtifact("MockL1Messenger"); + await setCode(L1_MESSENGER_SYSTEM_CONTRACT_ADDRESS, l1MessengerArtifact.bytecode); + mockL1Messenger = MockL1Messenger__factory.connect(L1_MESSENGER_SYSTEM_CONTRACT_ADDRESS, wallet); + + await network.provider.request({ + method: "hardhat_impersonateAccount", + params: [BOOTLOADER_FORMAL_ADDRESS], + }); + await network.provider.request({ + method: "hardhat_impersonateAccount", + params: [COMPRESSOR_CONTRACT_ADDRESS], + }); + bootloaderAccount = await ethers.getSigner(BOOTLOADER_FORMAL_ADDRESS); + compressorAccount = await ethers.getSigner(COMPRESSOR_CONTRACT_ADDRESS); + }); + + after(async () => { + await setCode(L1_MESSENGER_SYSTEM_CONTRACT_ADDRESS, _l1MessengerCode); + await network.provider.request({ + method: "hardhat_stopImpersonatingAccount", + params: [BOOTLOADER_FORMAL_ADDRESS], + }); + await network.provider.request({ + method: "hardhat_stopImpersonatingAccount", + params: [COMPRESSOR_CONTRACT_ADDRESS], + }); + }); + + describe("markBytecodeAsPublished", function () { + it("non-compressor failed to call", async () => { + await expect(knownCodesStorage.markBytecodeAsPublished(BYTECODE_HASH_1)).to.be.revertedWith( + "Callable only by the compressor" + ); + }); + + it("incorrectly fomatted bytecode hash failed to call", async () => { + await expect( + knownCodesStorage.connect(compressorAccount).markBytecodeAsPublished(INCORRECTLY_FORMATTED_HASH) + ).to.be.revertedWith("Incorrectly formatted bytecodeHash"); + }); + + it("invalid length bytecode hash failed to call", async () => { + await expect( + knownCodesStorage.connect(compressorAccount).markBytecodeAsPublished(INVALID_LENGTH_HASH) + ).to.be.revertedWith("Code length in words must be odd"); + }); + + it("successfuly marked", async () => { + await expect(knownCodesStorage.connect(compressorAccount).markBytecodeAsPublished(BYTECODE_HASH_1)) + .to.emit(knownCodesStorage, "MarkedAsKnown") + .withArgs(BYTECODE_HASH_1.toLowerCase(), false) + .not.emit(mockL1Messenger, "MockBytecodeL1Published"); + expect(await knownCodesStorage.getMarker(BYTECODE_HASH_1)).to.be.eq(1); + }); + + it("not marked second time", async () => { + await expect(knownCodesStorage.connect(compressorAccount).markBytecodeAsPublished(BYTECODE_HASH_1)).to.not.emit( + knownCodesStorage, + "MarkedAsKnown" + ); + }); + }); + + describe("markFactoryDeps", function () { + it("non-bootloader failed to call", async () => { + await expect(knownCodesStorage.markFactoryDeps(false, [BYTECODE_HASH_2, BYTECODE_HASH_3])).to.be.revertedWith( + "Callable only by the bootloader" + ); + }); + + it("incorrectly fomatted bytecode hash failed to call", async () => { + await expect( + knownCodesStorage + .connect(bootloaderAccount) + .markFactoryDeps(true, [BYTECODE_HASH_2, INCORRECTLY_FORMATTED_HASH]) + ).to.be.revertedWith("Incorrectly formatted bytecodeHash"); + }); + + it("invalid length bytecode hash failed to call", async () => { + await expect( + knownCodesStorage.connect(bootloaderAccount).markFactoryDeps(false, [INVALID_LENGTH_HASH, BYTECODE_HASH_3]) + ).to.be.revertedWith("Code length in words must be odd"); + }); + + it("successfuly marked", async () => { + await expect( + knownCodesStorage.connect(bootloaderAccount).markFactoryDeps(false, [BYTECODE_HASH_2, BYTECODE_HASH_3]) + ) + .to.emit(knownCodesStorage, "MarkedAsKnown") + .withArgs(BYTECODE_HASH_2.toLowerCase(), false) + .emit(knownCodesStorage, "MarkedAsKnown") + .withArgs(BYTECODE_HASH_3.toLowerCase(), false) + .not.emit(mockL1Messenger, "MockBytecodeL1Published"); + expect(await knownCodesStorage.getMarker(BYTECODE_HASH_2)).to.be.eq(1); + expect(await knownCodesStorage.getMarker(BYTECODE_HASH_3)).to.be.eq(1); + }); + + it("not marked second time", async () => { + await expect( + knownCodesStorage.connect(bootloaderAccount).markFactoryDeps(false, [BYTECODE_HASH_2, BYTECODE_HASH_3]) + ).to.not.emit(knownCodesStorage, "MarkedAsKnown"); + }); + + it("sent to l1", async () => { + await expect(knownCodesStorage.connect(bootloaderAccount).markFactoryDeps(true, [BYTECODE_HASH_4])) + .to.emit(knownCodesStorage, "MarkedAsKnown") + .withArgs(BYTECODE_HASH_4.toLowerCase(), true) + .emit(mockL1Messenger, "MockBytecodeL1Published") + .withArgs(BYTECODE_HASH_4.toLowerCase()); + expect(await knownCodesStorage.getMarker(BYTECODE_HASH_4)).to.be.eq(1); + }); + }); + + describe("getMarker", function () { + it("not known", async () => { + expect(await knownCodesStorage.getMarker(INCORRECTLY_FORMATTED_HASH)).to.be.eq(0); + }); + + it("known", async () => { + expect(await knownCodesStorage.getMarker(BYTECODE_HASH_1)).to.be.eq(1); + }); + }); +}); diff --git a/test/shared/constants.ts b/test/shared/constants.ts new file mode 100644 index 00000000..d46d5e4a --- /dev/null +++ b/test/shared/constants.ts @@ -0,0 +1,14 @@ +import { BigNumber } from "ethers"; + +export const BOOTLOADER_FORMAL_ADDRESS = "0x0000000000000000000000000000000000008001"; +export const NONCE_HOLDER_SYSTEM_CONTRACT_ADDRESS = "0x0000000000000000000000000000000000008003"; +export const KNOWN_CODE_STORAGE_CONTRACT_ADDRESS = "0x0000000000000000000000000000000000008004"; +export const DEPLOYER_SYSTEM_CONTRACT_ADDRESS = "0x0000000000000000000000000000000000008006"; +export const FORCE_DEPLOYER_ADDRESS = "0x0000000000000000000000000000000000008007"; +export const L1_MESSENGER_SYSTEM_CONTRACT_ADDRESS = "0x0000000000000000000000000000000000008008"; +export const ETH_TOKEN_SYSTEM_CONTRACT_ADDRESS = "0x000000000000000000000000000000000000800a"; +export const EVENT_WRITER_CONTRACT_ADDRESS = "0x000000000000000000000000000000000000800d"; +export const COMPRESSOR_CONTRACT_ADDRESS = "0x000000000000000000000000000000000000800e"; +export const EMPTY_STRING_KECCAK = "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"; + +export const TWO_IN_256 = BigNumber.from(2).pow(256); diff --git a/test/shared/transactions.ts b/test/shared/transactions.ts new file mode 100644 index 00000000..73c4fcc2 --- /dev/null +++ b/test/shared/transactions.ts @@ -0,0 +1,150 @@ +import type { BigNumberish, BytesLike, Transaction } from "ethers"; +import * as zksync from "zksync-web3"; + +// Interface encoding the transaction struct used for AA protocol +export interface TransactionData { + txType: BigNumberish; + from: BigNumberish; + to: BigNumberish; + gasLimit: BigNumberish; + gasPerPubdataByteLimit: BigNumberish; + maxFeePerGas: BigNumberish; + maxPriorityFeePerGas: BigNumberish; + paymaster: BigNumberish; + nonce: BigNumberish; + value: BigNumberish; + // In the future, we might want to add some + // new fields to the struct. The `txData` struct + // is to be passed to account and any changes to its structure + // would mean a breaking change to these accounts. In order to prevent this, + // we should keep some fields as "reserved". + // It is also recommneded that their length is fixed, since + // it would allow easier proof integration (in case we will need + // some special circuit for preprocessing transactions). + reserved: [BigNumberish, BigNumberish, BigNumberish, BigNumberish]; + data: BytesLike; + signature: BytesLike; + factoryDeps: BytesLike[]; + paymasterInput: BytesLike; + // Reserved dynamic type for the future use-case. Using it should be avoided, + // But it is still here, just in case we want to enable some additional functionality. + reservedDynamic: BytesLike; +} + +export function signedTxToTransactionData(tx: Transaction) { + // Transform legacy transaction's `v` part of the signature + // to a single byte used in the packed eth signature + function unpackV(v: number) { + if (v >= 35) { + const chainId = Math.floor((v - 35) / 2); + return v - chainId * 2 - 8; + } else if (v <= 1) { + return 27 + v; + } + + throw new Error("Invalid `v`"); + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + function legacyTxToTransactionData(tx: any): TransactionData { + return { + txType: 0, + from: tx.from!, + to: tx.to!, + gasLimit: tx.gasLimit!, + gasPerPubdataByteLimit: zksync.utils.DEFAULT_GAS_PER_PUBDATA_LIMIT, + maxFeePerGas: tx.gasPrice!, + maxPriorityFeePerGas: tx.gasPrice!, + paymaster: 0, + nonce: tx.nonce, + value: tx.value || 0, + reserved: [tx.chainId || 0, 0, 0, 0], + data: tx.data!, + signature: ethers.utils.hexConcat([tx.r, tx.s, new Uint8Array([unpackV(tx.v)])]), + factoryDeps: [], + paymasterInput: "0x", + reservedDynamic: "0x", + }; + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + function eip2930TxToTransactionData(tx: any): TransactionData { + return { + txType: 1, + from: tx.from!, + to: tx.to!, + gasLimit: tx.gasLimit!, + gasPerPubdataByteLimit: zksync.utils.DEFAULT_GAS_PER_PUBDATA_LIMIT, + maxFeePerGas: tx.gasPrice!, + maxPriorityFeePerGas: tx.gasPrice!, + paymaster: 0, + nonce: tx.nonce, + value: tx.value || 0, + reserved: [0, 0, 0, 0], + data: tx.data!, + signature: ethers.utils.hexConcat([tx.r, tx.s, unpackV(tx.v)]), + factoryDeps: [], + paymasterInput: "0x", + reservedDynamic: "0x", + }; + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + function eip1559TxToTransactionData(tx: any): TransactionData { + return { + txType: 2, + from: tx.from!, + to: tx.to!, + gasLimit: tx.gasLimit!, + gasPerPubdataByteLimit: zksync.utils.DEFAULT_GAS_PER_PUBDATA_LIMIT, + maxFeePerGas: tx.maxFeePerGas, + maxPriorityFeePerGas: tx.maxPriorityFeePerGas, + paymaster: 0, + nonce: tx.nonce, + value: tx.value || 0, + reserved: [0, 0, 0, 0], + data: tx.data!, + signature: ethers.utils.hexConcat([tx.r, tx.s, unpackV(tx.v)]), + factoryDeps: [], + paymasterInput: "0x", + reservedDynamic: "0x", + }; + } + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + function eip712TxToTransactionData(tx: any): TransactionData { + return { + txType: 113, + from: tx.from!, + to: tx.to!, + gasLimit: tx.gasLimit!, + gasPerPubdataByteLimit: tx.customData.gasPerPubdata || zksync.utils.DEFAULT_GAS_PER_PUBDATA_LIMIT, + maxFeePerGas: tx.maxFeePerGas, + maxPriorityFeePerGas: tx.maxPriorityFeePerGas, + paymaster: tx.customData.paymasterParams?.paymaster || 0, + nonce: tx.nonce, + value: tx.value || 0, + reserved: [0, 0, 0, 0], + data: tx.data!, + signature: tx.customData.customSignature, + factoryDeps: tx.customData.factoryDeps.map(zksync.utils.hashBytecode), + paymasterInput: tx.customData.paymasterParams?.paymasterInput || "0x", + reservedDynamic: "0x", + }; + } + + const txType = tx.type ?? 0; + + switch (txType) { + case 0: + return legacyTxToTransactionData(tx); + case 1: + return eip2930TxToTransactionData(tx); + case 2: + return eip1559TxToTransactionData(tx); + case 113: + return eip712TxToTransactionData(tx); + default: + throw new Error("Unsupported tx type"); + } +} diff --git a/test/shared/utils.ts b/test/shared/utils.ts new file mode 100644 index 00000000..448f505e --- /dev/null +++ b/test/shared/utils.ts @@ -0,0 +1,138 @@ +import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; +import type { ZkSyncArtifact } from "@matterlabs/hardhat-zksync-deploy/dist/types"; +import type { BytesLike } from "ethers"; +import * as hre from "hardhat"; +import { ethers, network } from "hardhat"; +import * as zksync from "zksync-web3"; +import type { Contract } from "zksync-web3"; +import { Provider, Wallet } from "zksync-web3"; +import { Language } from "../../scripts/constants"; +import { readYulBytecode } from "../../scripts/utils"; +import { ContractDeployer__factory } from "../../typechain-types"; +import { DEPLOYER_SYSTEM_CONTRACT_ADDRESS } from "./constants"; + +const RICH_WALLETS = [ + { + address: "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", + privateKey: "0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110", + }, + { + address: "0xa61464658AfeAf65CccaaFD3a512b69A83B77618", + privateKey: "0xac1e735be8536c6534bb4f17f06f6afc73b2b5ba84ac2cfb12f7461b20c0bbe3", + }, + { + address: "0x0D43eB5B8a47bA8900d84AA36656c92024e9772e", + privateKey: "0xd293c684d884d56f8d6abd64fc76757d3664904e309a0645baf8522ab6366d9e", + }, + { + address: "0xA13c10C0D5bd6f79041B9835c63f91de35A15883", + privateKey: "0x850683b40d4a740aa6e745f889a6fdc8327be76e122f5aba645a5b02d0248db8", + }, +]; + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export const provider = new Provider((hre.network.config as any).url); + +const wallet = new Wallet(RICH_WALLETS[0].privateKey, provider); +const deployer = new Deployer(hre, wallet); + +export async function callFallback(contract: Contract, data: string) { + // `eth_Call` revert is not parsed by ethers, so we send + // transaction to catch the error and use `eth_Call` to the return data. + await contract.fallback({ data }); + return contract.provider.call({ + to: contract.address, + data, + }); +} + +export function getWallets(): Wallet[] { + const wallets = []; + for (let i = 0; i < RICH_WALLETS.length; i++) { + wallets[i] = new Wallet(RICH_WALLETS[i].privateKey, provider); + } + return wallets; +} + +export async function loadArtifact(name: string): Promise { + return await deployer.loadArtifact(name); +} + +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export async function deployContract(name: string, constructorArguments?: any[] | undefined): Promise { + const artifact = await loadArtifact(name); + return await deployer.deploy(artifact, constructorArguments); +} + +export async function deployContractYul(codeName: string, path: string): Promise { + const bytecode = readYulBytecode({ + codeName, + path, + lang: Language.Yul, + address: "0x0000000000000000000000000000000000000000", + }); + return await deployer.deploy( + { + bytecode, + factoryDeps: {}, + sourceMapping: "", + _format: "", + contractName: "", + sourceName: "", + abi: [], + deployedBytecode: bytecode, + linkReferences: {}, + deployedLinkReferences: {}, + }, + [] + ); +} + +export async function publishBytecode(bytecode: BytesLike) { + await wallet.sendTransaction({ + type: 113, + to: ethers.constants.AddressZero, + data: "0x", + customData: { + factoryDeps: [bytecode], + gasPerPubdata: 50000, + }, + }); +} + +export async function getCode(address: string): Promise { + return await provider.getCode(address); +} + +// Force deploy bytecode on the address +export async function setCode(address: string, bytecode: BytesLike) { + // TODO: think about factoryDeps with eth_sendTransaction + try { + // publish bytecode in a separate tx + await publishBytecode(bytecode); + } catch { + // ignore error + } + + await network.provider.request({ + method: "hardhat_impersonateAccount", + params: [DEPLOYER_SYSTEM_CONTRACT_ADDRESS], + }); + + const deployerAccount = await ethers.getSigner(DEPLOYER_SYSTEM_CONTRACT_ADDRESS); + const deployerContract = ContractDeployer__factory.connect(DEPLOYER_SYSTEM_CONTRACT_ADDRESS, deployerAccount); + + const deployment = { + bytecodeHash: zksync.utils.hashBytecode(bytecode), + newAddress: address, + callConstructor: false, + value: 0, + input: "0x", + }; + await deployerContract.forceDeployOnAddress(deployment, ethers.constants.AddressZero); + + await network.provider.request({ + method: "hardhat_stopImpersonatingAccount", + params: [DEPLOYER_SYSTEM_CONTRACT_ADDRESS], + }); +} diff --git a/test/system-contract-test.test.ts b/test/system-contract-test.test.ts deleted file mode 100644 index 55eabef1..00000000 --- a/test/system-contract-test.test.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Wallet, utils } from "zksync-web3"; -import * as hre from "hardhat"; -import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; - -import { TestSystemContract } from "../typechain-types/cache-zk/solpp-generated-contracts/test-contracts"; -import { deployContractOnAddress } from "./utils/deployOnAnyAddress"; -import { BigNumber, ethers } from "ethers"; - -const RICH_WALLET_PK = '0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110'; - -describe('System contracts tests', function () { - // An example address where our system contracts will be put - const TEST_SYSTEM_CONTRACT_ADDRESS = '0x0000000000000000000000000000000000000101'; - let testContract: TestSystemContract; - let deployer = new Deployer(hre, new Wallet(RICH_WALLET_PK)); - - before('Prepare bootloader and system contracts', async function () { - testContract = (await deployContractOnAddress( - 'TestSystemContract', - TEST_SYSTEM_CONTRACT_ADDRESS, - "0x", - deployer - )).connect(deployer.zkWallet) as TestSystemContract; - - await (await deployer.zkWallet.deposit({ - token: utils.ETH_ADDRESS, - amount: ethers.utils.parseEther('10.0') - })).wait(); - }); - - it('Test precompile call', async function () { - await testContract.testPrecompileCall(); - }) - - it('Test mimicCall and setValueForNextCall', async function () { - const whoToMimic = Wallet.createRandom().address; - const value = BigNumber.from(2).pow(128).sub(1); - await (await testContract.testMimicCallAndValue( - whoToMimic, - value - )); - }); - - it('Test onlySystemCall modifier', async function () { - await testContract.testOnlySystemModifier(); - }); - - it('Test system mimicCall', async function () { - await testContract.testSystemMimicCall(); - }); -}); diff --git a/test/utils/DiamonCutFacet.json b/test/utils/DiamonCutFacet.json deleted file mode 100644 index c973d8ec..00000000 --- a/test/utils/DiamonCutFacet.json +++ /dev/null @@ -1,295 +0,0 @@ -[ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facet", - "type": "address" - }, - { - "internalType": "enum Diamond.Action", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isFreezable", - "type": "bool" - }, - { - "internalType": "bytes4[]", - "name": "selectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct Diamond.FacetCut[]", - "name": "_facetCuts", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_initAddress", - "type": "address" - } - ], - "name": "DiamondCutProposal", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "currentProposalId", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "proposedDiamondCutHash", - "type": "bytes32" - } - ], - "name": "DiamondCutProposalCancelation", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "facet", - "type": "address" - }, - { - "internalType": "enum Diamond.Action", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isFreezable", - "type": "bool" - }, - { - "internalType": "bytes4[]", - "name": "selectors", - "type": "bytes4[]" - } - ], - "internalType": "struct Diamond.FacetCut[]", - "name": "facetCuts", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "initAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "initCalldata", - "type": "bytes" - } - ], - "indexed": false, - "internalType": "struct Diamond.DiamondCutData", - "name": "_diamondCut", - "type": "tuple" - } - ], - "name": "DiamondCutProposalExecution", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_address", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "currentProposalId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "securityCouncilEmergencyApprovals", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "proposedDiamondCutHash", - "type": "bytes32" - } - ], - "name": "EmergencyDiamondCutApproved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "EmergencyFreeze", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "lastDiamondFreezeTimestamp", - "type": "uint256" - } - ], - "name": "Unfreeze", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_diamondCutHash", - "type": "bytes32" - } - ], - "name": "approveEmergencyDiamondCutAsSecurityCouncilMember", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "cancelDiamondCutProposal", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "emergencyFreezeDiamond", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "facet", - "type": "address" - }, - { - "internalType": "enum Diamond.Action", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isFreezable", - "type": "bool" - }, - { - "internalType": "bytes4[]", - "name": "selectors", - "type": "bytes4[]" - } - ], - "internalType": "struct Diamond.FacetCut[]", - "name": "facetCuts", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "initAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "initCalldata", - "type": "bytes" - } - ], - "internalType": "struct Diamond.DiamondCutData", - "name": "_diamondCut", - "type": "tuple" - } - ], - "name": "executeDiamondCutProposal", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facet", - "type": "address" - }, - { - "internalType": "enum Diamond.Action", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isFreezable", - "type": "bool" - }, - { - "internalType": "bytes4[]", - "name": "selectors", - "type": "bytes4[]" - } - ], - "internalType": "struct Diamond.FacetCut[]", - "name": "_facetCuts", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_initAddress", - "type": "address" - } - ], - "name": "proposeDiamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unfreezeDiamond", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file diff --git a/test/utils/DiamondUpgradeInit.json b/test/utils/DiamondUpgradeInit.json deleted file mode 100644 index acc106bc..00000000 --- a/test/utils/DiamondUpgradeInit.json +++ /dev/null @@ -1,446 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "txId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "txHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "expirationBlock", - "type": "uint64" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "txType", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "from", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "to", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "gasPerPubdataByteLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeePerGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxPriorityFeePerGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "paymaster", - "type": "uint256" - }, - { - "internalType": "uint256[6]", - "name": "reserved", - "type": "uint256[6]" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256[]", - "name": "factoryDeps", - "type": "uint256[]" - }, - { - "internalType": "bytes", - "name": "paymasterInput", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "reservedDynamic", - "type": "bytes" - } - ], - "indexed": false, - "internalType": "struct IMailbox.L2CanonicalTransaction", - "name": "transaction", - "type": "tuple" - }, - { - "indexed": false, - "internalType": "bytes[]", - "name": "factoryDeps", - "type": "bytes[]" - } - ], - "name": "NewPriorityRequest", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "_forceDeployCalldata", - "type": "bytes" - }, - { - "internalType": "bytes[]", - "name": "_factoryDeps", - "type": "bytes[]" - }, - { - "internalType": "uint256", - "name": "_gasLimit", - "type": "uint256" - } - ], - "name": "forceDeployL2Contract", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "name": "l2TransactionBaseCost", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_blockNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint8", - "name": "l2ShardId", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isService", - "type": "bool" - }, - { - "internalType": "uint16", - "name": "txNumberInBlock", - "type": "uint16" - }, - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "value", - "type": "bytes32" - } - ], - "internalType": "struct L2Log", - "name": "_log", - "type": "tuple" - }, - { - "internalType": "bytes32[]", - "name": "_proof", - "type": "bytes32[]" - } - ], - "name": "proveL2LogInclusion", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_blockNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint16", - "name": "txNumberInBlock", - "type": "uint16" - }, - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "internalType": "struct L2Message", - "name": "_message", - "type": "tuple" - }, - { - "internalType": "bytes32[]", - "name": "_proof", - "type": "bytes32[]" - } - ], - "name": "proveL2MessageInclusion", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractL2", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_l2Value", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "_gasLimit", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "_factoryDeps", - "type": "bytes[]" - } - ], - "name": "requestL2Transaction", - "outputs": [ - { - "internalType": "bytes32", - "name": "canonicalTxHash", - "type": "bytes32" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_txId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_l2Value", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_sender", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractAddressL2", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "_gasLimit", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "_factoryDeps", - "type": "bytes[]" - } - ], - "name": "serializeL2Transaction", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "txType", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "from", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "to", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "gasPerPubdataByteLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeePerGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxPriorityFeePerGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "paymaster", - "type": "uint256" - }, - { - "internalType": "uint256[6]", - "name": "reserved", - "type": "uint256[6]" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256[]", - "name": "factoryDeps", - "type": "uint256[]" - }, - { - "internalType": "bytes", - "name": "paymasterInput", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "reservedDynamic", - "type": "bytes" - } - ], - "internalType": "struct IMailbox.L2CanonicalTransaction", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "pure", - "type": "function" - } -] diff --git a/test/utils/IZkSync.json b/test/utils/IZkSync.json deleted file mode 100644 index 92be1231..00000000 --- a/test/utils/IZkSync.json +++ /dev/null @@ -1,1841 +0,0 @@ -{ - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "blockHash", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "commitment", - "type": "bytes32" - } - ], - "name": "BlockCommit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "blockNumber", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "blockHash", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "commitment", - "type": "bytes32" - } - ], - "name": "BlockExecution", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "totalBlocksCommitted", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalBlocksVerified", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalBlocksExecuted", - "type": "uint256" - } - ], - "name": "BlocksRevert", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "previousLastVerifiedBlock", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "currentLastVerifiedBlock", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "enum IExecutor.BlockVerificationMode", - "name": "verificationMode", - "type": "uint8" - } - ], - "name": "BlocksVerification", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facet", - "type": "address" - }, - { - "internalType": "enum Diamond.Action", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isFreezable", - "type": "bool" - }, - { - "internalType": "bytes4[]", - "name": "selectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct Diamond.FacetCut[]", - "name": "_facetCuts", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_initAddress", - "type": "address" - } - ], - "name": "DiamondCutProposal", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "currentProposalId", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "proposedDiamondCutHash", - "type": "bytes32" - } - ], - "name": "DiamondCutProposalCancelation", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "facet", - "type": "address" - }, - { - "internalType": "enum Diamond.Action", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isFreezable", - "type": "bool" - }, - { - "internalType": "bytes4[]", - "name": "selectors", - "type": "bytes4[]" - } - ], - "internalType": "struct Diamond.FacetCut[]", - "name": "facetCuts", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "initAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "initCalldata", - "type": "bytes" - } - ], - "indexed": false, - "internalType": "struct Diamond.DiamondCutData", - "name": "_diamondCut", - "type": "tuple" - } - ], - "name": "DiamondCutProposalExecution", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_address", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "currentProposalId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "securityCouncilEmergencyApprovals", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "proposedDiamondCutHash", - "type": "bytes32" - } - ], - "name": "EmergencyDiamondCutApproved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "EmergencyFreeze", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bool", - "name": "isPorterAvailable", - "type": "bool" - } - ], - "name": "IsPorterAvailableStatusUpdate", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldGovernor", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newGovernor", - "type": "address" - } - ], - "name": "NewGovernor", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "previousBytecodeHash", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newBytecodeHash", - "type": "bytes32" - } - ], - "name": "NewL2BootloaderBytecodeHash", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "previousBytecodeHash", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newBytecodeHash", - "type": "bytes32" - } - ], - "name": "NewL2DefaultAccountBytecodeHash", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldPendingGovernor", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newPendingGovernor", - "type": "address" - } - ], - "name": "NewPendingGovernor", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "txId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "txHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint64", - "name": "expirationBlock", - "type": "uint64" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "txType", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "from", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "to", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "gasPerPubdataByteLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeePerGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxPriorityFeePerGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "paymaster", - "type": "uint256" - }, - { - "internalType": "uint256[6]", - "name": "reserved", - "type": "uint256[6]" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256[]", - "name": "factoryDeps", - "type": "uint256[]" - }, - { - "internalType": "bytes", - "name": "paymasterInput", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "reservedDynamic", - "type": "bytes" - } - ], - "indexed": false, - "internalType": "struct IMailbox.L2CanonicalTransaction", - "name": "transaction", - "type": "tuple" - }, - { - "indexed": false, - "internalType": "bytes[]", - "name": "factoryDeps", - "type": "bytes[]" - } - ], - "name": "NewPriorityRequest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "oldVerifier", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newVerifier", - "type": "address" - } - ], - "name": "NewVerifier", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "recursionNodeLevelVkHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "recursionLeafLevelVkHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "recursionCircuitsSetVksHash", - "type": "bytes32" - } - ], - "indexed": false, - "internalType": "struct VerifierParams", - "name": "oldVerifierParams", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "recursionNodeLevelVkHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "recursionLeafLevelVkHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "recursionCircuitsSetVksHash", - "type": "bytes32" - } - ], - "indexed": false, - "internalType": "struct VerifierParams", - "name": "newVerifierParams", - "type": "tuple" - } - ], - "name": "NewVerifierParams", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "lastDiamondFreezeTimestamp", - "type": "uint256" - } - ], - "name": "Unfreeze", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "validatorAddress", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "isActive", - "type": "bool" - } - ], - "name": "ValidatorStatusUpdate", - "type": "event" - }, - { - "inputs": [], - "name": "acceptGovernor", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_diamondCutHash", - "type": "bytes32" - } - ], - "name": "approveEmergencyDiamondCutAsSecurityCouncilMember", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "cancelDiamondCutProposal", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint64", - "name": "blockNumber", - "type": "uint64" - }, - { - "internalType": "bytes32", - "name": "blockHash", - "type": "bytes32" - }, - { - "internalType": "uint64", - "name": "indexRepeatedStorageChanges", - "type": "uint64" - }, - { - "internalType": "uint256", - "name": "numberOfLayer1Txs", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "priorityOperationsHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "l2LogsTreeRoot", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "commitment", - "type": "bytes32" - } - ], - "internalType": "struct IExecutor.StoredBlockInfo", - "name": "_lastCommittedBlockData", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint64", - "name": "blockNumber", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "timestamp", - "type": "uint64" - }, - { - "internalType": "uint64", - "name": "indexRepeatedStorageChanges", - "type": "uint64" - }, - { - "internalType": "bytes32", - "name": "newStateRoot", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "numberOfLayer1Txs", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "l2LogsTreeRoot", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "priorityOperationsHash", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "initialStorageChanges", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "repeatedStorageChanges", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "l2Logs", - "type": "bytes" - }, - { - "internalType": "bytes[]", - "name": "l2ArbitraryLengthMessages", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "factoryDeps", - "type": "bytes[]" - } - ], - "internalType": "struct IExecutor.CommitBlockInfo[]", - "name": "_newBlocksData", - "type": "tuple[]" - } - ], - "name": "commitBlocks", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "emergencyFreezeDiamond", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint64", - "name": "blockNumber", - "type": "uint64" - }, - { - "internalType": "bytes32", - "name": "blockHash", - "type": "bytes32" - }, - { - "internalType": "uint64", - "name": "indexRepeatedStorageChanges", - "type": "uint64" - }, - { - "internalType": "uint256", - "name": "numberOfLayer1Txs", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "priorityOperationsHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "l2LogsTreeRoot", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "commitment", - "type": "bytes32" - } - ], - "internalType": "struct IExecutor.StoredBlockInfo[]", - "name": "_blocksData", - "type": "tuple[]" - } - ], - "name": "executeBlocks", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "address", - "name": "facet", - "type": "address" - }, - { - "internalType": "enum Diamond.Action", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isFreezable", - "type": "bool" - }, - { - "internalType": "bytes4[]", - "name": "selectors", - "type": "bytes4[]" - } - ], - "internalType": "struct Diamond.FacetCut[]", - "name": "facetCuts", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "initAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "initCalldata", - "type": "bytes" - } - ], - "internalType": "struct Diamond.DiamondCutData", - "name": "_diamondCut", - "type": "tuple" - } - ], - "name": "executeDiamondCutProposal", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facet", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facets", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "addr", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "selectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IGetters.Facet[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getCurrentProposalId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getFirstUnprocessedPriorityTx", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getGovernor", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getLastDiamondFreezeTimestamp", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPendingGovernor", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPriorityQueueSize", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getProposedDiamondCutHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getProposedDiamondCutTimestamp", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getSecurityCouncilEmergencyApprovals", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_address", - "type": "address" - } - ], - "name": "getSecurityCouncilMemberLastApprovedProposalId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTotalBlocksCommitted", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTotalBlocksExecuted", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTotalBlocksVerified", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTotalPriorityTxs", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getVerifier", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isDiamondStorageFrozen", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "isFunctionFreezable", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_address", - "type": "address" - } - ], - "name": "isSecurityCouncilMember", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_address", - "type": "address" - } - ], - "name": "isValidator", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_blockNumber", - "type": "uint256" - } - ], - "name": "l2LogsRootHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "hash", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_gasPrice", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_gasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_gasPricePerPubdata", - "type": "uint256" - } - ], - "name": "l2TransactionBaseCost", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "priorityQueueFrontOperation", - "outputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "canonicalTxHash", - "type": "bytes32" - }, - { - "internalType": "uint64", - "name": "expirationBlock", - "type": "uint64" - }, - { - "internalType": "uint192", - "name": "layer2Tip", - "type": "uint192" - } - ], - "internalType": "struct PriorityOperation", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facet", - "type": "address" - }, - { - "internalType": "enum Diamond.Action", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isFreezable", - "type": "bool" - }, - { - "internalType": "bytes4[]", - "name": "selectors", - "type": "bytes4[]" - } - ], - "internalType": "struct Diamond.FacetCut[]", - "name": "_facetCuts", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_initAddress", - "type": "address" - } - ], - "name": "proposeDiamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint64", - "name": "blockNumber", - "type": "uint64" - }, - { - "internalType": "bytes32", - "name": "blockHash", - "type": "bytes32" - }, - { - "internalType": "uint64", - "name": "indexRepeatedStorageChanges", - "type": "uint64" - }, - { - "internalType": "uint256", - "name": "numberOfLayer1Txs", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "priorityOperationsHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "l2LogsTreeRoot", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "commitment", - "type": "bytes32" - } - ], - "internalType": "struct IExecutor.StoredBlockInfo", - "name": "_prevBlock", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint64", - "name": "blockNumber", - "type": "uint64" - }, - { - "internalType": "bytes32", - "name": "blockHash", - "type": "bytes32" - }, - { - "internalType": "uint64", - "name": "indexRepeatedStorageChanges", - "type": "uint64" - }, - { - "internalType": "uint256", - "name": "numberOfLayer1Txs", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "priorityOperationsHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "l2LogsTreeRoot", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "commitment", - "type": "bytes32" - } - ], - "internalType": "struct IExecutor.StoredBlockInfo[]", - "name": "_committedBlocks", - "type": "tuple[]" - }, - { - "components": [ - { - "internalType": "uint256[]", - "name": "recurisiveAggregationInput", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "serializedProof", - "type": "uint256[]" - } - ], - "internalType": "struct IExecutor.ProofInput", - "name": "_proof", - "type": "tuple" - }, - { - "internalType": "enum IExecutor.BlockVerificationMode", - "name": "_verificationMode", - "type": "uint8" - } - ], - "name": "proveBlocks", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_blockNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint8", - "name": "l2ShardId", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "isService", - "type": "bool" - }, - { - "internalType": "uint16", - "name": "txNumberInBlock", - "type": "uint16" - }, - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "value", - "type": "bytes32" - } - ], - "internalType": "struct L2Log", - "name": "_log", - "type": "tuple" - }, - { - "internalType": "bytes32[]", - "name": "_proof", - "type": "bytes32[]" - } - ], - "name": "proveL2LogInclusion", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_blockNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_index", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint16", - "name": "txNumberInBlock", - "type": "uint16" - }, - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "internalType": "struct L2Message", - "name": "_message", - "type": "tuple" - }, - { - "internalType": "bytes32[]", - "name": "_proof", - "type": "bytes32[]" - } - ], - "name": "proveL2MessageInclusion", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractL2", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_l2Value", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "_gasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_gasPricePerPubdata", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "_factoryDeps", - "type": "bytes[]" - } - ], - "name": "requestL2Transaction", - "outputs": [ - { - "internalType": "bytes32", - "name": "canonicalTxHash", - "type": "bytes32" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_newLastBlock", - "type": "uint256" - } - ], - "name": "revertBlocks", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_txId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_l2Value", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_sender", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractAddressL2", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "_gasLimit", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "_factoryDeps", - "type": "bytes[]" - } - ], - "name": "serializeL2Transaction", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "txType", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "from", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "to", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "gasLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "gasPerPubdataByteLimit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxFeePerGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxPriorityFeePerGas", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "paymaster", - "type": "uint256" - }, - { - "internalType": "uint256[6]", - "name": "reserved", - "type": "uint256[6]" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - }, - { - "internalType": "uint256[]", - "name": "factoryDeps", - "type": "uint256[]" - }, - { - "internalType": "bytes", - "name": "paymasterInput", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "reservedDynamic", - "type": "bytes" - } - ], - "internalType": "struct IMailbox.L2CanonicalTransaction", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_l2BootloaderBytecodeHash", - "type": "bytes32" - } - ], - "name": "setL2BootloaderBytecodeHash", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_l2DefaultAccountBytecodeHash", - "type": "bytes32" - } - ], - "name": "setL2DefaultAccountBytecodeHash", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newPendingGovernor", - "type": "address" - } - ], - "name": "setPendingGovernor", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_isPorterAvailable", - "type": "bool" - } - ], - "name": "setPorterAvailability", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_validator", - "type": "address" - }, - { - "internalType": "bool", - "name": "_active", - "type": "bool" - } - ], - "name": "setValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract Verifier", - "name": "_newVerifier", - "type": "address" - } - ], - "name": "setVerifier", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "recursionNodeLevelVkHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "recursionLeafLevelVkHash", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "recursionCircuitsSetVksHash", - "type": "bytes32" - } - ], - "internalType": "struct VerifierParams", - "name": "_newVerifierParams", - "type": "tuple" - } - ], - "name": "setVerifierParams", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_blockNumber", - "type": "uint256" - } - ], - "name": "storedBlockHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "unfreezeDiamond", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] -} diff --git a/test/utils/deployOnAnyAddress.ts b/test/utils/deployOnAnyAddress.ts deleted file mode 100644 index b155e301..00000000 --- a/test/utils/deployOnAnyAddress.ts +++ /dev/null @@ -1,141 +0,0 @@ -import { BigNumber, BytesLike, Contract } from 'ethers'; -import { ethers } from 'ethers'; -import { Provider, types, utils } from 'zksync-web3'; -import { Deployer } from '@matterlabs/hardhat-zksync-deploy'; -import { hashBytecode } from 'zksync-web3/build/src/utils'; -import { expect } from 'chai'; -import * as hre from 'hardhat'; - -const DIAMOND_UPGRADE_INIT_ABI = new ethers.utils.Interface(require('./DiamondUpgradeInit.json')); -const DIAMOND_CUT_FACET_ABI = new ethers.utils.Interface(require('./DiamonCutFacet.json')); -const CONTRACT_DEPLOYER_INTERFACE = new ethers.utils.Interface(hre.artifacts.readArtifactSync('ContractDeployer').abi); -const ZKSYNC_INTERFACE = new ethers.utils.Interface(require('./IZkSync.json')); - -const DEFAULT_GAS_LIMIT = 60000000; -const DIAMOND_UPGRADE_INIT_ADDRESS = '0x2CaF2C21Fa1f6d3180Eb23A0D821c0d9B4cf0553'; - -export interface ForceDeployment { - // The bytecode hash to put on an address - bytecodeHash: BytesLike; - // The address on which to deploy the bytecodehash to - newAddress: string; - // The value with which to initialize a contract - value: BigNumber; - // The constructor calldata - input: BytesLike; -} - -export function diamondCut(facetCuts: any[], initAddress: string, initCalldata: string): any { - return { - facetCuts, - initAddress, - initCalldata - }; -} - -// The same mnemonic as in the etc/test_config/eth.json -const LOCAL_GOV_MNEMONIC = 'fine music test violin matrix prize squirrel panther purchase material script deal'; - -export async function deployOnAnyLocalAddress( - ethProvider: ethers.providers.Provider, - l2Provider: Provider, - deployments: ForceDeployment[], - factoryDeps: BytesLike[] -): Promise { - const govWallet = ethers.Wallet.fromMnemonic( - LOCAL_GOV_MNEMONIC, - "m/44'/60'/0'/0/1" - ).connect(ethProvider); - - const zkSyncContract = await l2Provider.getMainContractAddress(); - - const zkSync = new ethers.Contract( - zkSyncContract, - ZKSYNC_INTERFACE, - govWallet - ); - if(!(await zkSync.getProposedDiamondCutTimestamp()).eq(0)) { - await zkSync.cancelDiamondCutProposal(); - } - - // Encode data for the upgrade call - const encodedParams = CONTRACT_DEPLOYER_INTERFACE.encodeFunctionData('forceDeployOnAddresses', [ - deployments - ]); - - // Prepare the diamond cut data - const upgradeInitData = DIAMOND_UPGRADE_INIT_ABI.encodeFunctionData('forceDeployL2Contract', [ - encodedParams, - factoryDeps, - DEFAULT_GAS_LIMIT - ]); - - const upgradeParam = diamondCut([], DIAMOND_UPGRADE_INIT_ADDRESS, upgradeInitData); - - // Get transaction data of the `proposeDiamondCut` - const proposeDiamondCut = DIAMOND_CUT_FACET_ABI.encodeFunctionData('proposeDiamondCut', [ - upgradeParam.facetCuts, - upgradeParam.initAddress - ]); - - // Get transaction data of the `executeDiamondCutProposal` - const executeDiamondCutProposal = DIAMOND_CUT_FACET_ABI.encodeFunctionData( - 'executeDiamondCutProposal', - [upgradeParam] - ); - - // Proposing the upgrade - await (await govWallet.sendTransaction({ - to: zkSyncContract, - data: proposeDiamondCut, - gasLimit: BigNumber.from(10000000) - })).wait(); - - const receipt = await (await govWallet.sendTransaction({ - to: zkSyncContract, - data: executeDiamondCutProposal, - gasLimit: BigNumber.from(10000000) - })).wait(); - - return utils.getL2HashFromPriorityOp(receipt, zkSyncContract); -} - -export async function deployContractOnAddress( - name: string, - address: string, - input: BytesLike, - deployer: Deployer, -): Promise { - const artifact = await deployer.loadArtifact(name); - const bytecodeHash = hashBytecode(artifact.bytecode); - - const factoryDeps = [ - artifact.bytecode, - ...await deployer.extractFactoryDeps(artifact) - ]; - - const deployment: ForceDeployment = { - bytecodeHash, - newAddress: address, - value: BigNumber.from(0), - input - }; - - const txHash = await deployOnAnyLocalAddress( - deployer.ethWallet.provider, - deployer.zkWallet.provider, - [deployment], - factoryDeps - ) - - const receipt = await deployer.zkWallet.provider.waitForTransaction(txHash); - - expect(receipt.status, 'Contract deployment failed').to.eq(1); - - return new ethers.Contract( - address, - artifact.abi, - deployer.zkWallet.provider - ); -} - diff --git a/yarn.lock b/yarn.lock index bb0bda9e..166747de 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,33 @@ # yarn lockfile v1 +"@aashutoshrathi/word-wrap@^1.2.3": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" + integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== + +"@babel/code-frame@^7.0.0": + version "7.22.13" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.13.tgz#e3c1c099402598483b7a8c46a721d1038803755e" + integrity sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w== + dependencies: + "@babel/highlight" "^7.22.13" + chalk "^2.4.2" + +"@babel/helper-validator-identifier@^7.22.20": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz#c4ae002c61d2879e724581d96665583dbc1dc0e0" + integrity sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A== + +"@babel/highlight@^7.22.13": + version "7.22.20" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.22.20.tgz#4ca92b71d80554b01427815e06f2df965b9c1f54" + integrity sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg== + dependencies: + "@babel/helper-validator-identifier" "^7.22.20" + chalk "^2.4.2" + js-tokens "^4.0.0" + "@balena/dockerignore@^1.0.2": version "1.0.2" resolved "https://registry.yarnpkg.com/@balena/dockerignore/-/dockerignore-1.0.2.tgz#9ffe4726915251e8eb69f44ef3547e0da2c03e0d" @@ -20,6 +47,42 @@ "@blakek/curry" "^2.0.2" pathington "^1.1.7" +"@chainsafe/as-sha256@^0.3.1": + version "0.3.1" + resolved "https://registry.yarnpkg.com/@chainsafe/as-sha256/-/as-sha256-0.3.1.tgz#3639df0e1435cab03f4d9870cc3ac079e57a6fc9" + integrity sha512-hldFFYuf49ed7DAakWVXSJODuq3pzJEguD8tQ7h+sGkM18vja+OFoJI9krnGmgzyuZC2ETX0NOIcCTy31v2Mtg== + +"@chainsafe/persistent-merkle-tree@^0.4.2": + version "0.4.2" + resolved "https://registry.yarnpkg.com/@chainsafe/persistent-merkle-tree/-/persistent-merkle-tree-0.4.2.tgz#4c9ee80cc57cd3be7208d98c40014ad38f36f7ff" + integrity sha512-lLO3ihKPngXLTus/L7WHKaw9PnNJWizlOF1H9NNzHP6Xvh82vzg9F2bzkXhYIFshMZ2gTCEz8tq6STe7r5NDfQ== + dependencies: + "@chainsafe/as-sha256" "^0.3.1" + +"@chainsafe/persistent-merkle-tree@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@chainsafe/persistent-merkle-tree/-/persistent-merkle-tree-0.5.0.tgz#2b4a62c9489a5739dedd197250d8d2f5427e9f63" + integrity sha512-l0V1b5clxA3iwQLXP40zYjyZYospQLZXzBVIhhr9kDg/1qHZfzzHw0jj4VPBijfYCArZDlPkRi1wZaV2POKeuw== + dependencies: + "@chainsafe/as-sha256" "^0.3.1" + +"@chainsafe/ssz@^0.10.0": + version "0.10.2" + resolved "https://registry.yarnpkg.com/@chainsafe/ssz/-/ssz-0.10.2.tgz#c782929e1bb25fec66ba72e75934b31fd087579e" + integrity sha512-/NL3Lh8K+0q7A3LsiFq09YXS9fPE+ead2rr7vM2QK8PLzrNsw3uqrif9bpRX5UxgeRjM+vYi+boCM3+GM4ovXg== + dependencies: + "@chainsafe/as-sha256" "^0.3.1" + "@chainsafe/persistent-merkle-tree" "^0.5.0" + +"@chainsafe/ssz@^0.9.2": + version "0.9.4" + resolved "https://registry.yarnpkg.com/@chainsafe/ssz/-/ssz-0.9.4.tgz#696a8db46d6975b600f8309ad3a12f7c0e310497" + integrity sha512-77Qtg2N1ayqs4Bg/wvnWfg5Bta7iy7IRh8XqXh7oNMeP2HBbBwx8m6yTpA8p0EHItWPEBkgZd5S5/LSlp3GXuQ== + dependencies: + "@chainsafe/as-sha256" "^0.3.1" + "@chainsafe/persistent-merkle-tree" "^0.4.2" + case "^1.6.3" + "@cspotcode/source-map-support@^0.8.0": version "0.8.1" resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" @@ -27,6 +90,38 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" +"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== + dependencies: + eslint-visitor-keys "^3.3.0" + +"@eslint-community/regexpp@^4.5.1", "@eslint-community/regexpp@^4.6.1": + version "4.10.0" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63" + integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA== + +"@eslint/eslintrc@^2.1.2": + version "2.1.2" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.2.tgz#c6936b4b328c64496692f76944e755738be62396" + integrity sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g== + dependencies: + ajv "^6.12.4" + debug "^4.3.2" + espree "^9.6.0" + globals "^13.19.0" + ignore "^5.2.0" + import-fresh "^3.2.1" + js-yaml "^4.1.0" + minimatch "^3.1.2" + strip-json-comments "^3.1.1" + +"@eslint/js@8.52.0": + version "8.52.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.52.0.tgz#78fe5f117840f69dc4a353adf9b9cd926353378c" + integrity sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA== + "@ethersproject/abi@5.7.0", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.7.0.tgz#b3f3e045bbbeed1af3947335c247ad625a44e449" @@ -218,10 +313,10 @@ dependencies: "@ethersproject/logger" "^5.7.0" -"@ethersproject/providers@5.7.1": - version "5.7.1" - resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.1.tgz#b0799b616d5579cd1067a8ebf1fc1ec74c1e122c" - integrity sha512-vZveG/DLyo+wk4Ga1yx6jSEHrLPgmTt+dFv0dv8URpVCRf0jVhalps1jq/emN/oXnMRsC7cQgAF32DcXLL7BPQ== +"@ethersproject/providers@5.7.2", "@ethersproject/providers@^5.7.1", "@ethersproject/providers@^5.7.2": + version "5.7.2" + resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" + integrity sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg== dependencies: "@ethersproject/abstract-provider" "^5.7.0" "@ethersproject/abstract-signer" "^5.7.0" @@ -369,15 +464,39 @@ "@ethersproject/properties" "^5.7.0" "@ethersproject/strings" "^5.7.0" +"@fastify/busboy@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@fastify/busboy/-/busboy-2.0.0.tgz#f22824caff3ae506b18207bad4126dbc6ccdb6b8" + integrity sha512-JUFJad5lv7jxj926GPgymrWQxxjPYuJNiNjNMzqT+HiuP6Vl3dk5xzG+8sTX96np0ZAluvaMzPsjhHZ5rNuNQQ== + +"@humanwhocodes/config-array@^0.11.13": + version "0.11.13" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.13.tgz#075dc9684f40a531d9b26b0822153c1e832ee297" + integrity sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ== + dependencies: + "@humanwhocodes/object-schema" "^2.0.1" + debug "^4.1.1" + minimatch "^3.0.5" + +"@humanwhocodes/module-importer@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== + +"@humanwhocodes/object-schema@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz#e5211452df060fa8522b55c7b3c0c4d1981cb044" + integrity sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw== + "@jridgewell/resolve-uri@^3.0.3": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" - integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== + version "3.1.1" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz#c08679063f279615a3326583ba3a90d1d82cc721" + integrity sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA== "@jridgewell/sourcemap-codec@^1.4.10": - version "1.4.14" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" - integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== + version "1.4.15" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" + integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== "@jridgewell/trace-mapping@0.3.9": version "0.3.9" @@ -387,21 +506,41 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" -"@matterlabs/hardhat-zksync-deploy@^0.6.3": - version "0.6.3" - resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-deploy/-/hardhat-zksync-deploy-0.6.3.tgz#833b208373e7037bf43671054328d82511444e2a" - integrity sha512-FB+2xFL/80JJwlGna+aHA6dk4ONrMFqThTZATYVJUAKooA0Aw5qmpmM8B3qsNB4LLzHSO/EmVrHIcLaPv8hYwQ== +"@matterlabs/eslint-config-typescript@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@matterlabs/eslint-config-typescript/-/eslint-config-typescript-1.1.2.tgz#a9be4e56aedf298800f247c5049fc412f8b301a7" + integrity sha512-AhiWJQr+MSE3RVfgp5XwGoMK7kNSKh6a18+T7hkNJtyycP0306I6IGmuFA5ZVbcakGb+K32fQWzepSkrNCTAGg== + +"@matterlabs/hardhat-zksync-chai-matchers@^0.1.4": + version "0.1.4" + resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-chai-matchers/-/hardhat-zksync-chai-matchers-0.1.4.tgz#105cb0ec1367c8fcd3ce7e3773f747c71fff675b" + integrity sha512-eGQWiImg51fmayoQ7smIK/T6QZkSu38PK7xjp1RIrewGzw2ZgqFWGp40jb5oomkf8yOQPk52Hu4TwE3Ntp8CtA== + +"@matterlabs/hardhat-zksync-deploy@^0.6.5": + version "0.6.5" + resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-deploy/-/hardhat-zksync-deploy-0.6.5.tgz#fe56bf30850e71c8d328ac1a06a100c1a0af6e3e" + integrity sha512-EZpvn8pDslfO3UA2obT8FOi5jsHhxYS5ndIR7tjL2zXKbvkbpoJR5rgKoGTJJm0riaCud674sQcxMOybVQ+2gg== dependencies: + "@matterlabs/hardhat-zksync-solc" "0.4.2" chalk "4.1.2" + ts-morph "^19.0.0" -"@matterlabs/hardhat-zksync-solc@^0.3.15": - version "0.3.16" - resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-solc/-/hardhat-zksync-solc-0.3.16.tgz#dd8ed44f1a580f282794a15fee995f418b040158" - integrity sha512-gw46yyiCfj49I/nbUcOlnF5xE80WyeW/i8i9ouHom4KWJNt1kioQIwOPkN7aJURhXpJJxKSdeWBrQHLWTZDnTA== +"@matterlabs/hardhat-zksync-solc@0.4.2", "@matterlabs/hardhat-zksync-solc@^0.4.2": + version "0.4.2" + resolved "https://registry.yarnpkg.com/@matterlabs/hardhat-zksync-solc/-/hardhat-zksync-solc-0.4.2.tgz#64121082e88c5ab22eb4e9594d120e504f6af499" + integrity sha512-6NFWPSZiOAoo7wNuhMg4ztj7mMEH+tLrx09WuCbcURrHPijj/KxYNsJD6Uw5lapKr7G8H7SQISGid1/MTXVmXQ== dependencies: "@nomiclabs/hardhat-docker" "^2.0.0" chalk "4.1.2" dockerode "^3.3.4" + fs-extra "^11.1.1" + proper-lockfile "^4.1.2" + semver "^7.5.1" + +"@matterlabs/prettier-config@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@matterlabs/prettier-config/-/prettier-config-1.0.3.tgz#3e2eb559c0112bbe9671895f935700dad2a15d38" + integrity sha512-JW7nHREPqEtjBWz3EfxLarkmJBD8vi7Kx/1AQ6eBZnz12eHc1VkOyrc6mpR5ogTf0dOUNXFAfZut+cDe2dn4kQ== "@metamask/eth-sig-util@^4.0.0": version "4.0.1" @@ -414,44 +553,62 @@ tweetnacl "^1.0.3" tweetnacl-util "^0.15.1" -"@noble/hashes@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.2.tgz#e9e035b9b166ca0af657a7848eb2718f0f22f183" - integrity sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA== +"@noble/hashes@1.2.0", "@noble/hashes@~1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.2.0.tgz#a3150eeb09cc7ab207ebf6d7b9ad311a9bdbed12" + integrity sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ== -"@noble/hashes@~1.1.1": - version "1.1.3" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.3.tgz#360afc77610e0a61f3417e497dcf36862e4f8111" - integrity sha512-CE0FCR57H2acVI5UOzIGSSIYxZ6v/HOhDR0Ro9VLyhnzLwx0o8W1mmgaqlEUx4049qJDlIBRztv5k+MM8vbO3A== +"@noble/secp256k1@1.7.1", "@noble/secp256k1@~1.7.0": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.7.1.tgz#b251c70f824ce3ca7f8dc3df08d58f005cc0507c" + integrity sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw== -"@noble/secp256k1@1.6.3", "@noble/secp256k1@~1.6.0": - version "1.6.3" - resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.6.3.tgz#7eed12d9f4404b416999d0c87686836c4c5c9b94" - integrity sha512-T04e4iTurVy7I8Sw4+c5OSN9/RkPlo1uKxAomtxQNLq8j1uPAqnsqG1bqvY3Jv7c13gyr6dui0zmh/I3+f/JaQ== +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== + dependencies: + "@nodelib/fs.stat" "2.0.5" + run-parallel "^1.1.9" -"@nomicfoundation/ethereumjs-block@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-block/-/ethereumjs-block-4.0.0.tgz#fdd5c045e7baa5169abeed0e1202bf94e4481c49" - integrity sha512-bk8uP8VuexLgyIZAHExH1QEovqx0Lzhc9Ntm63nCRKLHXIZkobaFaeCVwTESV7YkPKUk7NiK11s8ryed4CS9yA== - dependencies: - "@nomicfoundation/ethereumjs-common" "^3.0.0" - "@nomicfoundation/ethereumjs-rlp" "^4.0.0" - "@nomicfoundation/ethereumjs-trie" "^5.0.0" - "@nomicfoundation/ethereumjs-tx" "^4.0.0" - "@nomicfoundation/ethereumjs-util" "^8.0.0" +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== + +"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": + version "1.2.8" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== + dependencies: + "@nodelib/fs.scandir" "2.1.5" + fastq "^1.6.0" + +"@nomicfoundation/ethereumjs-block@5.0.1": + version "5.0.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-block/-/ethereumjs-block-5.0.1.tgz#6f89664f55febbd723195b6d0974773d29ee133d" + integrity sha512-u1Yioemi6Ckj3xspygu/SfFvm8vZEO8/Yx5a1QLzi6nVU0jz3Pg2OmHKJ5w+D9Ogk1vhwRiqEBAqcb0GVhCyHw== + dependencies: + "@nomicfoundation/ethereumjs-common" "4.0.1" + "@nomicfoundation/ethereumjs-rlp" "5.0.1" + "@nomicfoundation/ethereumjs-trie" "6.0.1" + "@nomicfoundation/ethereumjs-tx" "5.0.1" + "@nomicfoundation/ethereumjs-util" "9.0.1" ethereum-cryptography "0.1.3" + ethers "^5.7.1" -"@nomicfoundation/ethereumjs-blockchain@^6.0.0": - version "6.0.0" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-blockchain/-/ethereumjs-blockchain-6.0.0.tgz#1a8c243a46d4d3691631f139bfb3a4a157187b0c" - integrity sha512-pLFEoea6MWd81QQYSReLlLfH7N9v7lH66JC/NMPN848ySPPQA5renWnE7wPByfQFzNrPBuDDRFFULMDmj1C0xw== - dependencies: - "@nomicfoundation/ethereumjs-block" "^4.0.0" - "@nomicfoundation/ethereumjs-common" "^3.0.0" - "@nomicfoundation/ethereumjs-ethash" "^2.0.0" - "@nomicfoundation/ethereumjs-rlp" "^4.0.0" - "@nomicfoundation/ethereumjs-trie" "^5.0.0" - "@nomicfoundation/ethereumjs-util" "^8.0.0" +"@nomicfoundation/ethereumjs-blockchain@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-blockchain/-/ethereumjs-blockchain-7.0.1.tgz#80e0bd3535bfeb9baa29836b6f25123dab06a726" + integrity sha512-NhzndlGg829XXbqJEYrF1VeZhAwSPgsK/OB7TVrdzft3y918hW5KNd7gIZ85sn6peDZOdjBsAXIpXZ38oBYE5A== + dependencies: + "@nomicfoundation/ethereumjs-block" "5.0.1" + "@nomicfoundation/ethereumjs-common" "4.0.1" + "@nomicfoundation/ethereumjs-ethash" "3.0.1" + "@nomicfoundation/ethereumjs-rlp" "5.0.1" + "@nomicfoundation/ethereumjs-trie" "6.0.1" + "@nomicfoundation/ethereumjs-tx" "5.0.1" + "@nomicfoundation/ethereumjs-util" "9.0.1" abstract-level "^1.0.3" debug "^4.3.3" ethereum-cryptography "0.1.3" @@ -459,173 +616,184 @@ lru-cache "^5.1.1" memory-level "^1.0.0" -"@nomicfoundation/ethereumjs-common@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-common/-/ethereumjs-common-3.0.0.tgz#f6bcc7753994555e49ab3aa517fc8bcf89c280b9" - integrity sha512-WS7qSshQfxoZOpHG/XqlHEGRG1zmyjYrvmATvc4c62+gZXgre1ymYP8ZNgx/3FyZY0TWe9OjFlKOfLqmgOeYwA== +"@nomicfoundation/ethereumjs-common@4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-common/-/ethereumjs-common-4.0.1.tgz#4702d82df35b07b5407583b54a45bf728e46a2f0" + integrity sha512-OBErlkfp54GpeiE06brBW/TTbtbuBJV5YI5Nz/aB2evTDo+KawyEzPjBlSr84z/8MFfj8wS2wxzQX1o32cev5g== dependencies: - "@nomicfoundation/ethereumjs-util" "^8.0.0" + "@nomicfoundation/ethereumjs-util" "9.0.1" crc-32 "^1.2.0" -"@nomicfoundation/ethereumjs-ethash@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-ethash/-/ethereumjs-ethash-2.0.0.tgz#11539c32fe0990e1122ff987d1b84cfa34774e81" - integrity sha512-WpDvnRncfDUuXdsAXlI4lXbqUDOA+adYRQaEezIkxqDkc+LDyYDbd/xairmY98GnQzo1zIqsIL6GB5MoMSJDew== +"@nomicfoundation/ethereumjs-ethash@3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-ethash/-/ethereumjs-ethash-3.0.1.tgz#65ca494d53e71e8415c9a49ef48bc921c538fc41" + integrity sha512-KDjGIB5igzWOp8Ik5I6QiRH5DH+XgILlplsHR7TEuWANZA759G6krQ6o8bvj+tRUz08YygMQu/sGd9mJ1DYT8w== dependencies: - "@nomicfoundation/ethereumjs-block" "^4.0.0" - "@nomicfoundation/ethereumjs-rlp" "^4.0.0" - "@nomicfoundation/ethereumjs-util" "^8.0.0" + "@nomicfoundation/ethereumjs-block" "5.0.1" + "@nomicfoundation/ethereumjs-rlp" "5.0.1" + "@nomicfoundation/ethereumjs-util" "9.0.1" abstract-level "^1.0.3" bigint-crypto-utils "^3.0.23" ethereum-cryptography "0.1.3" -"@nomicfoundation/ethereumjs-evm@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-evm/-/ethereumjs-evm-1.0.0.tgz#99cd173c03b59107c156a69c5e215409098a370b" - integrity sha512-hVS6qRo3V1PLKCO210UfcEQHvlG7GqR8iFzp0yyjTg2TmJQizcChKgWo8KFsdMw6AyoLgLhHGHw4HdlP8a4i+Q== +"@nomicfoundation/ethereumjs-evm@2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-evm/-/ethereumjs-evm-2.0.1.tgz#f35681e203363f69ce2b3d3bf9f44d4e883ca1f1" + integrity sha512-oL8vJcnk0Bx/onl+TgQOQ1t/534GKFaEG17fZmwtPFeH8S5soiBYPCLUrvANOl4sCp9elYxIMzIiTtMtNNN8EQ== dependencies: - "@nomicfoundation/ethereumjs-common" "^3.0.0" - "@nomicfoundation/ethereumjs-util" "^8.0.0" - "@types/async-eventemitter" "^0.2.1" - async-eventemitter "^0.2.4" + "@ethersproject/providers" "^5.7.1" + "@nomicfoundation/ethereumjs-common" "4.0.1" + "@nomicfoundation/ethereumjs-tx" "5.0.1" + "@nomicfoundation/ethereumjs-util" "9.0.1" debug "^4.3.3" ethereum-cryptography "0.1.3" mcl-wasm "^0.7.1" rustbn.js "~0.2.0" -"@nomicfoundation/ethereumjs-rlp@^4.0.0", "@nomicfoundation/ethereumjs-rlp@^4.0.0-beta.2": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-rlp/-/ethereumjs-rlp-4.0.0.tgz#d9a9c5f0f10310c8849b6525101de455a53e771d" - integrity sha512-GaSOGk5QbUk4eBP5qFbpXoZoZUj/NrW7MRa0tKY4Ew4c2HAS0GXArEMAamtFrkazp0BO4K5p2ZCG3b2FmbShmw== +"@nomicfoundation/ethereumjs-rlp@5.0.1": + version "5.0.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-rlp/-/ethereumjs-rlp-5.0.1.tgz#0b30c1cf77d125d390408e391c4bb5291ef43c28" + integrity sha512-xtxrMGa8kP4zF5ApBQBtjlSbN5E2HI8m8FYgVSYAnO6ssUoY5pVPGy2H8+xdf/bmMa22Ce8nWMH3aEW8CcqMeQ== -"@nomicfoundation/ethereumjs-statemanager@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-statemanager/-/ethereumjs-statemanager-1.0.0.tgz#14a9d4e1c828230368f7ab520c144c34d8721e4b" - integrity sha512-jCtqFjcd2QejtuAMjQzbil/4NHf5aAWxUc+CvS0JclQpl+7M0bxMofR2AJdtz+P3u0ke2euhYREDiE7iSO31vQ== +"@nomicfoundation/ethereumjs-statemanager@2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-statemanager/-/ethereumjs-statemanager-2.0.1.tgz#8824a97938db4471911e2d2f140f79195def5935" + integrity sha512-B5ApMOnlruVOR7gisBaYwFX+L/AP7i/2oAahatssjPIBVDF6wTX1K7Qpa39E/nzsH8iYuL3krkYeUFIdO3EMUQ== dependencies: - "@nomicfoundation/ethereumjs-common" "^3.0.0" - "@nomicfoundation/ethereumjs-rlp" "^4.0.0" - "@nomicfoundation/ethereumjs-trie" "^5.0.0" - "@nomicfoundation/ethereumjs-util" "^8.0.0" + "@nomicfoundation/ethereumjs-common" "4.0.1" + "@nomicfoundation/ethereumjs-rlp" "5.0.1" debug "^4.3.3" ethereum-cryptography "0.1.3" - functional-red-black-tree "^1.0.1" + ethers "^5.7.1" + js-sdsl "^4.1.4" -"@nomicfoundation/ethereumjs-trie@^5.0.0": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-trie/-/ethereumjs-trie-5.0.0.tgz#dcfbe3be53a94bc061c9767a396c16702bc2f5b7" - integrity sha512-LIj5XdE+s+t6WSuq/ttegJzZ1vliwg6wlb+Y9f4RlBpuK35B9K02bO7xU+E6Rgg9RGptkWd6TVLdedTI4eNc2A== +"@nomicfoundation/ethereumjs-trie@6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-trie/-/ethereumjs-trie-6.0.1.tgz#662c55f6b50659fd4b22ea9f806a7401cafb7717" + integrity sha512-A64It/IMpDVODzCgxDgAAla8jNjNtsoQZIzZUfIV5AY6Coi4nvn7+VReBn5itlxMiL2yaTlQr9TRWp3CSI6VoA== dependencies: - "@nomicfoundation/ethereumjs-rlp" "^4.0.0" - "@nomicfoundation/ethereumjs-util" "^8.0.0" + "@nomicfoundation/ethereumjs-rlp" "5.0.1" + "@nomicfoundation/ethereumjs-util" "9.0.1" + "@types/readable-stream" "^2.3.13" ethereum-cryptography "0.1.3" readable-stream "^3.6.0" -"@nomicfoundation/ethereumjs-tx@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-tx/-/ethereumjs-tx-4.0.0.tgz#59dc7452b0862b30342966f7052ab9a1f7802f52" - integrity sha512-Gg3Lir2lNUck43Kp/3x6TfBNwcWC9Z1wYue9Nz3v4xjdcv6oDW9QSMJxqsKw9QEGoBBZ+gqwpW7+F05/rs/g1w== - dependencies: - "@nomicfoundation/ethereumjs-common" "^3.0.0" - "@nomicfoundation/ethereumjs-rlp" "^4.0.0" - "@nomicfoundation/ethereumjs-util" "^8.0.0" +"@nomicfoundation/ethereumjs-tx@5.0.1": + version "5.0.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-tx/-/ethereumjs-tx-5.0.1.tgz#7629dc2036b4a33c34e9f0a592b43227ef4f0c7d" + integrity sha512-0HwxUF2u2hrsIM1fsasjXvlbDOq1ZHFV2dd1yGq8CA+MEYhaxZr8OTScpVkkxqMwBcc5y83FyPl0J9MZn3kY0w== + dependencies: + "@chainsafe/ssz" "^0.9.2" + "@ethersproject/providers" "^5.7.2" + "@nomicfoundation/ethereumjs-common" "4.0.1" + "@nomicfoundation/ethereumjs-rlp" "5.0.1" + "@nomicfoundation/ethereumjs-util" "9.0.1" ethereum-cryptography "0.1.3" -"@nomicfoundation/ethereumjs-util@^8.0.0": - version "8.0.0" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-util/-/ethereumjs-util-8.0.0.tgz#deb2b15d2c308a731e82977aefc4e61ca0ece6c5" - integrity sha512-2emi0NJ/HmTG+CGY58fa+DQuAoroFeSH9gKu9O6JnwTtlzJtgfTixuoOqLEgyyzZVvwfIpRueuePb8TonL1y+A== +"@nomicfoundation/ethereumjs-util@9.0.1": + version "9.0.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-util/-/ethereumjs-util-9.0.1.tgz#530cda8bae33f8b5020a8f199ed1d0a2ce48ec89" + integrity sha512-TwbhOWQ8QoSCFhV/DDfSmyfFIHjPjFBj957219+V3jTZYZ2rf9PmDtNOeZWAE3p3vlp8xb02XGpd0v6nTUPbsA== dependencies: - "@nomicfoundation/ethereumjs-rlp" "^4.0.0-beta.2" + "@chainsafe/ssz" "^0.10.0" + "@nomicfoundation/ethereumjs-rlp" "5.0.1" ethereum-cryptography "0.1.3" -"@nomicfoundation/ethereumjs-vm@^6.0.0": - version "6.0.0" - resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-vm/-/ethereumjs-vm-6.0.0.tgz#2bb50d332bf41790b01a3767ffec3987585d1de6" - integrity sha512-JMPxvPQ3fzD063Sg3Tp+UdwUkVxMoo1uML6KSzFhMH3hoQi/LMuXBoEHAoW83/vyNS9BxEe6jm6LmT5xdeEJ6w== - dependencies: - "@nomicfoundation/ethereumjs-block" "^4.0.0" - "@nomicfoundation/ethereumjs-blockchain" "^6.0.0" - "@nomicfoundation/ethereumjs-common" "^3.0.0" - "@nomicfoundation/ethereumjs-evm" "^1.0.0" - "@nomicfoundation/ethereumjs-rlp" "^4.0.0" - "@nomicfoundation/ethereumjs-statemanager" "^1.0.0" - "@nomicfoundation/ethereumjs-trie" "^5.0.0" - "@nomicfoundation/ethereumjs-tx" "^4.0.0" - "@nomicfoundation/ethereumjs-util" "^8.0.0" - "@types/async-eventemitter" "^0.2.1" - async-eventemitter "^0.2.4" +"@nomicfoundation/ethereumjs-vm@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-vm/-/ethereumjs-vm-7.0.1.tgz#7d035e0993bcad10716c8b36e61dfb87fa3ca05f" + integrity sha512-rArhyn0jPsS/D+ApFsz3yVJMQ29+pVzNZ0VJgkzAZ+7FqXSRtThl1C1prhmlVr3YNUlfpZ69Ak+RUT4g7VoOuQ== + dependencies: + "@nomicfoundation/ethereumjs-block" "5.0.1" + "@nomicfoundation/ethereumjs-blockchain" "7.0.1" + "@nomicfoundation/ethereumjs-common" "4.0.1" + "@nomicfoundation/ethereumjs-evm" "2.0.1" + "@nomicfoundation/ethereumjs-rlp" "5.0.1" + "@nomicfoundation/ethereumjs-statemanager" "2.0.1" + "@nomicfoundation/ethereumjs-trie" "6.0.1" + "@nomicfoundation/ethereumjs-tx" "5.0.1" + "@nomicfoundation/ethereumjs-util" "9.0.1" debug "^4.3.3" ethereum-cryptography "0.1.3" - functional-red-black-tree "^1.0.1" mcl-wasm "^0.7.1" rustbn.js "~0.2.0" -"@nomicfoundation/solidity-analyzer-darwin-arm64@0.0.3": - version "0.0.3" - resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-darwin-arm64/-/solidity-analyzer-darwin-arm64-0.0.3.tgz#1d49e4ac028831a3011a9f3dca60bd1963185342" - integrity sha512-W+bIiNiZmiy+MTYFZn3nwjyPUO6wfWJ0lnXx2zZrM8xExKObMrhCh50yy8pQING24mHfpPFCn89wEB/iG7vZDw== +"@nomicfoundation/hardhat-chai-matchers@^1.0.3": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-chai-matchers/-/hardhat-chai-matchers-1.0.6.tgz#72a2e312e1504ee5dd73fe302932736432ba96bc" + integrity sha512-f5ZMNmabZeZegEfuxn/0kW+mm7+yV7VNDxLpMOMGXWFJ2l/Ct3QShujzDRF9cOkK9Ui/hbDeOWGZqyQALDXVCQ== + dependencies: + "@ethersproject/abi" "^5.1.2" + "@types/chai-as-promised" "^7.1.3" + chai-as-promised "^7.1.1" + deep-eql "^4.0.1" + ordinal "^1.0.3" -"@nomicfoundation/solidity-analyzer-darwin-x64@0.0.3": - version "0.0.3" - resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-darwin-x64/-/solidity-analyzer-darwin-x64-0.0.3.tgz#c0fccecc5506ff5466225e41e65691abafef3dbe" - integrity sha512-HuJd1K+2MgmFIYEpx46uzwEFjvzKAI765mmoMxy4K+Aqq1p+q7hHRlsFU2kx3NB8InwotkkIq3A5FLU1sI1WDw== +"@nomicfoundation/solidity-analyzer-darwin-arm64@0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-darwin-arm64/-/solidity-analyzer-darwin-arm64-0.1.1.tgz#4c858096b1c17fe58a474fe81b46815f93645c15" + integrity sha512-KcTodaQw8ivDZyF+D76FokN/HdpgGpfjc/gFCImdLUyqB6eSWVaZPazMbeAjmfhx3R0zm/NYVzxwAokFKgrc0w== -"@nomicfoundation/solidity-analyzer-freebsd-x64@0.0.3": - version "0.0.3" - resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-freebsd-x64/-/solidity-analyzer-freebsd-x64-0.0.3.tgz#8261d033f7172b347490cd005931ef8168ab4d73" - integrity sha512-2cR8JNy23jZaO/vZrsAnWCsO73asU7ylrHIe0fEsXbZYqBP9sMr+/+xP3CELDHJxUbzBY8zqGvQt1ULpyrG+Kw== +"@nomicfoundation/solidity-analyzer-darwin-x64@0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-darwin-x64/-/solidity-analyzer-darwin-x64-0.1.1.tgz#6e25ccdf6e2d22389c35553b64fe6f3fdaec432c" + integrity sha512-XhQG4BaJE6cIbjAVtzGOGbK3sn1BO9W29uhk9J8y8fZF1DYz0Doj8QDMfpMu+A6TjPDs61lbsmeYodIDnfveSA== -"@nomicfoundation/solidity-analyzer-linux-arm64-gnu@0.0.3": - version "0.0.3" - resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-linux-arm64-gnu/-/solidity-analyzer-linux-arm64-gnu-0.0.3.tgz#1ba64b1d76425f8953dedc6367bd7dd46f31dfc5" - integrity sha512-Eyv50EfYbFthoOb0I1568p+eqHGLwEUhYGOxcRNywtlTE9nj+c+MT1LA53HnxD9GsboH4YtOOmJOulrjG7KtbA== +"@nomicfoundation/solidity-analyzer-freebsd-x64@0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-freebsd-x64/-/solidity-analyzer-freebsd-x64-0.1.1.tgz#0a224ea50317139caeebcdedd435c28a039d169c" + integrity sha512-GHF1VKRdHW3G8CndkwdaeLkVBi5A9u2jwtlS7SLhBc8b5U/GcoL39Q+1CSO3hYqePNP+eV5YI7Zgm0ea6kMHoA== -"@nomicfoundation/solidity-analyzer-linux-arm64-musl@0.0.3": - version "0.0.3" - resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-linux-arm64-musl/-/solidity-analyzer-linux-arm64-musl-0.0.3.tgz#8d864c49b55e683f7e3b5cce9d10b628797280ac" - integrity sha512-V8grDqI+ivNrgwEt2HFdlwqV2/EQbYAdj3hbOvjrA8Qv+nq4h9jhQUxFpegYMDtpU8URJmNNlXgtfucSrAQwtQ== +"@nomicfoundation/solidity-analyzer-linux-arm64-gnu@0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-linux-arm64-gnu/-/solidity-analyzer-linux-arm64-gnu-0.1.1.tgz#dfa085d9ffab9efb2e7b383aed3f557f7687ac2b" + integrity sha512-g4Cv2fO37ZsUENQ2vwPnZc2zRenHyAxHcyBjKcjaSmmkKrFr64yvzeNO8S3GBFCo90rfochLs99wFVGT/0owpg== -"@nomicfoundation/solidity-analyzer-linux-x64-gnu@0.0.3": - version "0.0.3" - resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-linux-x64-gnu/-/solidity-analyzer-linux-x64-gnu-0.0.3.tgz#16e769500cf1a8bb42ab9498cee3b93c30f78295" - integrity sha512-uRfVDlxtwT1vIy7MAExWAkRD4r9M79zMG7S09mCrWUn58DbLs7UFl+dZXBX0/8FTGYWHhOT/1Etw1ZpAf5DTrg== +"@nomicfoundation/solidity-analyzer-linux-arm64-musl@0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-linux-arm64-musl/-/solidity-analyzer-linux-arm64-musl-0.1.1.tgz#c9e06b5d513dd3ab02a7ac069c160051675889a4" + integrity sha512-WJ3CE5Oek25OGE3WwzK7oaopY8xMw9Lhb0mlYuJl/maZVo+WtP36XoQTb7bW/i8aAdHW5Z+BqrHMux23pvxG3w== -"@nomicfoundation/solidity-analyzer-linux-x64-musl@0.0.3": - version "0.0.3" - resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-linux-x64-musl/-/solidity-analyzer-linux-x64-musl-0.0.3.tgz#75f4e1a25526d54c506e4eba63b3d698b6255b8f" - integrity sha512-8HPwYdLbhcPpSwsE0yiU/aZkXV43vlXT2ycH+XlOjWOnLfH8C41z0njK8DHRtEFnp4OVN6E7E5lHBBKDZXCliA== +"@nomicfoundation/solidity-analyzer-linux-x64-gnu@0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-linux-x64-gnu/-/solidity-analyzer-linux-x64-gnu-0.1.1.tgz#8d328d16839e52571f72f2998c81e46bf320f893" + integrity sha512-5WN7leSr5fkUBBjE4f3wKENUy9HQStu7HmWqbtknfXkkil+eNWiBV275IOlpXku7v3uLsXTOKpnnGHJYI2qsdA== -"@nomicfoundation/solidity-analyzer-win32-arm64-msvc@0.0.3": - version "0.0.3" - resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-win32-arm64-msvc/-/solidity-analyzer-win32-arm64-msvc-0.0.3.tgz#ef6e20cfad5eedfdb145cc34a44501644cd7d015" - integrity sha512-5WWcT6ZNvfCuxjlpZOY7tdvOqT1kIQYlDF9Q42wMpZ5aTm4PvjdCmFDDmmTvyXEBJ4WTVmY5dWNWaxy8h/E28g== +"@nomicfoundation/solidity-analyzer-linux-x64-musl@0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-linux-x64-musl/-/solidity-analyzer-linux-x64-musl-0.1.1.tgz#9b49d0634b5976bb5ed1604a1e1b736f390959bb" + integrity sha512-KdYMkJOq0SYPQMmErv/63CwGwMm5XHenEna9X9aB8mQmhDBrYrlAOSsIPgFCUSL0hjxE3xHP65/EPXR/InD2+w== -"@nomicfoundation/solidity-analyzer-win32-ia32-msvc@0.0.3": - version "0.0.3" - resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-win32-ia32-msvc/-/solidity-analyzer-win32-ia32-msvc-0.0.3.tgz#98c4e3af9cee68896220fa7e270aefdf7fc89c7b" - integrity sha512-P/LWGZwWkyjSwkzq6skvS2wRc3gabzAbk6Akqs1/Iiuggql2CqdLBkcYWL5Xfv3haynhL+2jlNkak+v2BTZI4A== +"@nomicfoundation/solidity-analyzer-win32-arm64-msvc@0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-win32-arm64-msvc/-/solidity-analyzer-win32-arm64-msvc-0.1.1.tgz#e2867af7264ebbcc3131ef837878955dd6a3676f" + integrity sha512-VFZASBfl4qiBYwW5xeY20exWhmv6ww9sWu/krWSesv3q5hA0o1JuzmPHR4LPN6SUZj5vcqci0O6JOL8BPw+APg== -"@nomicfoundation/solidity-analyzer-win32-x64-msvc@0.0.3": - version "0.0.3" - resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-win32-x64-msvc/-/solidity-analyzer-win32-x64-msvc-0.0.3.tgz#12da288e7ef17ec14848f19c1e8561fed20d231d" - integrity sha512-4AcTtLZG1s/S5mYAIr/sdzywdNwJpOcdStGF3QMBzEt+cGn3MchMaS9b1gyhb2KKM2c39SmPF5fUuWq1oBSQZQ== +"@nomicfoundation/solidity-analyzer-win32-ia32-msvc@0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-win32-ia32-msvc/-/solidity-analyzer-win32-ia32-msvc-0.1.1.tgz#0685f78608dd516c8cdfb4896ed451317e559585" + integrity sha512-JnFkYuyCSA70j6Si6cS1A9Gh1aHTEb8kOTBApp/c7NRTFGNMH8eaInKlyuuiIbvYFhlXW4LicqyYuWNNq9hkpQ== -"@nomicfoundation/solidity-analyzer@^0.0.3": - version "0.0.3" - resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer/-/solidity-analyzer-0.0.3.tgz#d1029f872e66cb1082503b02cc8b0be12f8dd95e" - integrity sha512-VFMiOQvsw7nx5bFmrmVp2Q9rhIjw2AFST4DYvWVVO9PMHPE23BY2+kyfrQ4J3xCMFC8fcBbGLt7l4q7m1SlTqg== +"@nomicfoundation/solidity-analyzer-win32-x64-msvc@0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-win32-x64-msvc/-/solidity-analyzer-win32-x64-msvc-0.1.1.tgz#c9a44f7108646f083b82e851486e0f6aeb785836" + integrity sha512-HrVJr6+WjIXGnw3Q9u6KQcbZCtk0caVWhCdFADySvRyUxJ8PnzlaP+MhwNE8oyT8OZ6ejHBRrrgjSqDCFXGirw== + +"@nomicfoundation/solidity-analyzer@^0.1.0": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer/-/solidity-analyzer-0.1.1.tgz#f5f4d36d3f66752f59a57e7208cd856f3ddf6f2d" + integrity sha512-1LMtXj1puAxyFusBgUIy5pZk3073cNXYnXUpuNKFghHbIit/xZgbk0AokpUADbNm3gyD6bFWl3LRFh3dhVdREg== optionalDependencies: - "@nomicfoundation/solidity-analyzer-darwin-arm64" "0.0.3" - "@nomicfoundation/solidity-analyzer-darwin-x64" "0.0.3" - "@nomicfoundation/solidity-analyzer-freebsd-x64" "0.0.3" - "@nomicfoundation/solidity-analyzer-linux-arm64-gnu" "0.0.3" - "@nomicfoundation/solidity-analyzer-linux-arm64-musl" "0.0.3" - "@nomicfoundation/solidity-analyzer-linux-x64-gnu" "0.0.3" - "@nomicfoundation/solidity-analyzer-linux-x64-musl" "0.0.3" - "@nomicfoundation/solidity-analyzer-win32-arm64-msvc" "0.0.3" - "@nomicfoundation/solidity-analyzer-win32-ia32-msvc" "0.0.3" - "@nomicfoundation/solidity-analyzer-win32-x64-msvc" "0.0.3" + "@nomicfoundation/solidity-analyzer-darwin-arm64" "0.1.1" + "@nomicfoundation/solidity-analyzer-darwin-x64" "0.1.1" + "@nomicfoundation/solidity-analyzer-freebsd-x64" "0.1.1" + "@nomicfoundation/solidity-analyzer-linux-arm64-gnu" "0.1.1" + "@nomicfoundation/solidity-analyzer-linux-arm64-musl" "0.1.1" + "@nomicfoundation/solidity-analyzer-linux-x64-gnu" "0.1.1" + "@nomicfoundation/solidity-analyzer-linux-x64-musl" "0.1.1" + "@nomicfoundation/solidity-analyzer-win32-arm64-msvc" "0.1.1" + "@nomicfoundation/solidity-analyzer-win32-ia32-msvc" "0.1.1" + "@nomicfoundation/solidity-analyzer-win32-x64-msvc" "0.1.1" "@nomiclabs/hardhat-docker@^2.0.0": version "2.0.2" @@ -637,9 +805,9 @@ node-fetch "^2.6.0" "@nomiclabs/hardhat-ethers@^2.0.6": - version "2.1.1" - resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.1.1.tgz#3f1d1ab49813d1bae4c035cc1adec224711e528b" - integrity sha512-Gg0IFkT/DW3vOpih4/kMjeZCLYqtfgECLeLXTs7ZDPzcK0cfoc5wKk4nq5n/izCUzdhidO/Utd6ptF9JrWwWVA== + version "2.2.3" + resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.2.3.tgz#b41053e360c31a32c2640c9a45ee981a7e603fe0" + integrity sha512-YhzPdzb612X591FOe68q+qXVXGG2ANZRvDo0RRUtimev85rCrAlv/TLMEZw5c+kq9AbzocLTVX/h2jVIFPL9Xg== "@nomiclabs/hardhat-solpp@^2.0.1": version "2.0.1" @@ -649,26 +817,38 @@ fs-extra "^7.0.1" solpp "^0.11.5" +"@pkgr/utils@^2.3.1": + version "2.4.2" + resolved "https://registry.yarnpkg.com/@pkgr/utils/-/utils-2.4.2.tgz#9e638bbe9a6a6f165580dc943f138fd3309a2cbc" + integrity sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw== + dependencies: + cross-spawn "^7.0.3" + fast-glob "^3.3.0" + is-glob "^4.0.3" + open "^9.1.0" + picocolors "^1.0.0" + tslib "^2.6.0" + "@scure/base@~1.1.0": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.1.tgz#ebb651ee52ff84f420097055f4bf46cfba403938" - integrity sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA== + version "1.1.3" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.3.tgz#8584115565228290a6c6c4961973e0903bb3df2f" + integrity sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q== -"@scure/bip32@1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.1.0.tgz#dea45875e7fbc720c2b4560325f1cf5d2246d95b" - integrity sha512-ftTW3kKX54YXLCxH6BB7oEEoJfoE2pIgw7MINKAs5PsS6nqKPuKk1haTF/EuHmYqG330t5GSrdmtRuHaY1a62Q== +"@scure/bip32@1.1.5": + version "1.1.5" + resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.1.5.tgz#d2ccae16dcc2e75bc1d75f5ef3c66a338d1ba300" + integrity sha512-XyNh1rB0SkEqd3tXcXMi+Xe1fvg+kUIcoRIEujP1Jgv7DqW2r9lg3Ah0NkFaCs9sTkQAQA8kw7xiRXzENi9Rtw== dependencies: - "@noble/hashes" "~1.1.1" - "@noble/secp256k1" "~1.6.0" + "@noble/hashes" "~1.2.0" + "@noble/secp256k1" "~1.7.0" "@scure/base" "~1.1.0" -"@scure/bip39@1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.1.0.tgz#92f11d095bae025f166bef3defcc5bf4945d419a" - integrity sha512-pwrPOS16VeTKg98dYXQyIjJEcWfz7/1YJIwxUEPFfQPtc86Ym/1sVgQ2RLoD43AazMk2l/unK4ITySSpW2+82w== +"@scure/bip39@1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.1.1.tgz#b54557b2e86214319405db819c4b6a370cf340c5" + integrity sha512-t+wDck2rVkh65Hmv280fYdVdY25J9YeEUIgn2LG1WM6gxFkGzcksoDiUkWVpVp3Oex9xGC68JU2dSbUfwZ2jPg== dependencies: - "@noble/hashes" "~1.1.1" + "@noble/hashes" "~1.2.0" "@scure/base" "~1.1.0" "@sentry/core@5.30.0": @@ -739,13 +919,23 @@ "@sentry/types" "5.30.0" tslib "^1.9.3" -"@solidity-parser/parser@^0.14.5": - version "0.14.5" - resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.14.5.tgz#87bc3cc7b068e08195c219c91cd8ddff5ef1a804" - integrity sha512-6dKnHZn7fg/iQATVEzqyUOyEidbn05q7YA2mQ9hC0MMXhhV3/JrsxmFSYZAcr7j1yUP700LLhTruvJ3MiQmjJg== +"@solidity-parser/parser@^0.16.0": + version "0.16.1" + resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.16.1.tgz#f7c8a686974e1536da0105466c4db6727311253c" + integrity sha512-PdhRFNhbTtu3x8Axm0uYpqOy/lODYQK+MlYSgqIsq2L8SFYEHJPHNUiOTAJbDGzNjjr1/n9AcIayxafR/fWmYw== dependencies: antlr4ts "^0.5.0-alpha.4" +"@ts-morph/common@~0.20.0": + version "0.20.0" + resolved "https://registry.yarnpkg.com/@ts-morph/common/-/common-0.20.0.tgz#3f161996b085ba4519731e4d24c35f6cba5b80af" + integrity sha512-7uKjByfbPpwuzkstL3L5MQyuXPSKdoNG93Fmi2JoDcTf3pEP731JdRFAduRVkOs8oqxPsXKA+ScrWkdQ8t/I+Q== + dependencies: + fast-glob "^3.2.12" + minimatch "^7.4.3" + mkdirp "^2.1.6" + path-browserify "^1.0.1" + "@tsconfig/node10@^1.0.7": version "1.0.9" resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" @@ -762,22 +952,24 @@ integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== "@tsconfig/node16@^1.0.2": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e" - integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ== + version "1.0.4" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9" + integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA== "@typechain/ethers-v5@^10.0.0": - version "10.1.0" - resolved "https://registry.yarnpkg.com/@typechain/ethers-v5/-/ethers-v5-10.1.0.tgz#068d7dc7014502354696dab59590a7841091e951" - integrity sha512-3LIb+eUpV3mNCrjUKT5oqp8PBsZYSnVrkfk6pY/ZM0boRs2mKxjFZ7bktx42vfDye8PPz3NxtW4DL5NsNsFqlg== + version "10.2.1" + resolved "https://registry.yarnpkg.com/@typechain/ethers-v5/-/ethers-v5-10.2.1.tgz#50241e6957683281ecfa03fb5a6724d8a3ce2391" + integrity sha512-n3tQmCZjRE6IU4h6lqUGiQ1j866n5MTCBJreNEHHVWXa2u9GJTaeYyU1/k+1qLutkyw+sS6VAN+AbeiTqsxd/A== dependencies: lodash "^4.17.15" ts-essentials "^7.0.1" -"@types/async-eventemitter@^0.2.1": - version "0.2.1" - resolved "https://registry.yarnpkg.com/@types/async-eventemitter/-/async-eventemitter-0.2.1.tgz#f8e6280e87e8c60b2b938624b0a3530fb3e24712" - integrity sha512-M2P4Ng26QbAeITiH7w1d7OxtldgfAe0wobpyJzVK/XOb0cUGKU2R4pfAhqcJBXAe2ife5ZOhSv4wk7p+ffURtg== +"@typechain/hardhat@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@typechain/hardhat/-/hardhat-7.0.0.tgz#ffa7465328150e793007fee616ae7b76ed20784d" + integrity sha512-XB79i5ewg9Met7gMVGfgVkmypicbnI25T5clJBEooMoW2161p4zvKFpoS2O+lBppQyMrPIZkdvl2M3LMDayVcA== + dependencies: + fs-extra "^9.1.0" "@types/bn.js@^4.11.3": version "4.11.6" @@ -793,11 +985,38 @@ dependencies: "@types/node" "*" +"@types/chai-as-promised@^7.1.3": + version "7.1.6" + resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-7.1.6.tgz#3b08cbe1e7206567a480dc6538bade374b19e4e1" + integrity sha512-cQLhk8fFarRVZAXUQV1xEnZgMoPxqKojBvRkqPCKPQCzEhpbbSKl1Uu75kDng7k5Ln6LQLUmNBjLlFthCgm1NA== + dependencies: + "@types/chai" "*" + +"@types/chai@*": + version "4.3.6" + resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.6.tgz#7b489e8baf393d5dd1266fb203ddd4ea941259e6" + integrity sha512-VOVRLM1mBxIRxydiViqPcKn6MIxZytrbMpd6RJLIWKxUNr3zux8no0Oc7kJx0WAPIitgZ0gkrDS+btlqQpubpw== + "@types/chai@^4.3.1": version "4.3.3" resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.3.3.tgz#3c90752792660c4b562ad73b3fbd68bf3bc7ae07" integrity sha512-hC7OMnszpxhZPduX+m+nrx+uFoLkWOMiR4oa/AZF3MuSETYTZmFfJAHqZEM8MVlvfG7BEUcgvtwoCTxBp6hm3g== +"@types/json-schema@^7.0.12": + version "7.0.14" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.14.tgz#74a97a5573980802f32c8e47b663530ab3b6b7d1" + integrity sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw== + +"@types/json5@^0.0.29": + version "0.0.29" + resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" + integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== + +"@types/lodash@^4.14.199": + version "4.14.199" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.199.tgz#c3edb5650149d847a277a8961a7ad360c474e9bf" + integrity sha512-Vrjz5N5Ia4SEzWWgIVwnHNEnb1UE1XMkvY5DGXrAeOGE9imk0hgTHh5GyDjLDJi9OTCn9oo9dXH1uToK1VRfrg== + "@types/lru-cache@^5.1.0": version "5.1.1" resolved "https://registry.yarnpkg.com/@types/lru-cache/-/lru-cache-5.1.1.tgz#c48c2e27b65d2a153b19bfc1a317e30872e01eef" @@ -816,9 +1035,9 @@ integrity sha512-Z61JK7DKDtdKTWwLeElSEBcWGRLY8g95ic5FoQqI9CMx0ns/Ghep3B4DfcEimiKMvtamNVULVNKEsiwV3aQmXw== "@types/node@*": - version "18.8.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.8.2.tgz#17d42c6322d917764dd3d2d3a10d7884925de067" - integrity sha512-cRMwIgdDN43GO4xMWAfJAecYn8wV4JbsOGHNfNUIDiuYkUYAR5ec4Rj7IO2SAhFPEfpPtLtUTbbny/TCT7aDwA== + version "20.6.0" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.6.0.tgz#9d7daa855d33d4efec8aea88cd66db1c2f0ebe16" + integrity sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg== "@types/node@^17.0.34": version "17.0.45" @@ -833,9 +1052,17 @@ "@types/node" "*" "@types/prettier@^2.1.1": - version "2.7.1" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.1.tgz#dfd20e2dc35f027cdd6c1908e80a5ddc7499670e" - integrity sha512-ri0UmynRRvZiiUJdiz38MmIblKK+oH30MztdBVR95dv/Ubw6neWSb8u1XpRb72L4qsZOhz+L+z9JD40SJmfWow== + version "2.7.3" + resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.3.tgz#3e51a17e291d01d17d3fc61422015a933af7a08f" + integrity sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA== + +"@types/readable-stream@^2.3.13": + version "2.3.15" + resolved "https://registry.yarnpkg.com/@types/readable-stream/-/readable-stream-2.3.15.tgz#3d79c9ceb1b6a57d5f6e6976f489b9b5384321ae" + integrity sha512-oM5JSKQCcICF1wvGgmecmHldZ48OZamtMxcGGVICOJA8o8cahXC1zEVAif8iwoc5j8etxFaRFnf095+CDsuoFQ== + dependencies: + "@types/node" "*" + safe-buffer "~5.1.1" "@types/resolve@^0.0.8": version "0.0.8" @@ -851,10 +1078,100 @@ dependencies: "@types/node" "*" -"@ungap/promise-all-settled@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" - integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== +"@types/semver@^7.5.0": + version "7.5.4" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.4.tgz#0a41252ad431c473158b22f9bfb9a63df7541cff" + integrity sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ== + +"@typescript-eslint/eslint-plugin@^6.7.4": + version "6.9.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.9.0.tgz#fdb6f3821c0167e3356e9d89c80e8230b2e401f4" + integrity sha512-lgX7F0azQwRPB7t7WAyeHWVfW1YJ9NIgd9mvGhfQpRY56X6AVf8mwM8Wol+0z4liE7XX3QOt8MN1rUKCfSjRIA== + dependencies: + "@eslint-community/regexpp" "^4.5.1" + "@typescript-eslint/scope-manager" "6.9.0" + "@typescript-eslint/type-utils" "6.9.0" + "@typescript-eslint/utils" "6.9.0" + "@typescript-eslint/visitor-keys" "6.9.0" + debug "^4.3.4" + graphemer "^1.4.0" + ignore "^5.2.4" + natural-compare "^1.4.0" + semver "^7.5.4" + ts-api-utils "^1.0.1" + +"@typescript-eslint/parser@^6.7.4": + version "6.9.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.9.0.tgz#2b402cadeadd3f211c25820e5433413347b27391" + integrity sha512-GZmjMh4AJ/5gaH4XF2eXA8tMnHWP+Pm1mjQR2QN4Iz+j/zO04b9TOvJYOX2sCNIQHtRStKTxRY1FX7LhpJT4Gw== + dependencies: + "@typescript-eslint/scope-manager" "6.9.0" + "@typescript-eslint/types" "6.9.0" + "@typescript-eslint/typescript-estree" "6.9.0" + "@typescript-eslint/visitor-keys" "6.9.0" + debug "^4.3.4" + +"@typescript-eslint/scope-manager@6.9.0": + version "6.9.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.9.0.tgz#2626e9a7fe0e004c3e25f3b986c75f584431134e" + integrity sha512-1R8A9Mc39n4pCCz9o79qRO31HGNDvC7UhPhv26TovDsWPBDx+Sg3rOZdCELIA3ZmNoWAuxaMOT7aWtGRSYkQxw== + dependencies: + "@typescript-eslint/types" "6.9.0" + "@typescript-eslint/visitor-keys" "6.9.0" + +"@typescript-eslint/type-utils@6.9.0": + version "6.9.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.9.0.tgz#23923c8c9677c2ad41457cf8e10a5f2946be1b04" + integrity sha512-XXeahmfbpuhVbhSOROIzJ+b13krFmgtc4GlEuu1WBT+RpyGPIA4Y/eGnXzjbDj5gZLzpAXO/sj+IF/x2GtTMjQ== + dependencies: + "@typescript-eslint/typescript-estree" "6.9.0" + "@typescript-eslint/utils" "6.9.0" + debug "^4.3.4" + ts-api-utils "^1.0.1" + +"@typescript-eslint/types@6.9.0": + version "6.9.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.9.0.tgz#86a0cbe7ac46c0761429f928467ff3d92f841098" + integrity sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw== + +"@typescript-eslint/typescript-estree@6.9.0": + version "6.9.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.0.tgz#d0601b245be873d8fe49f3737f93f8662c8693d4" + integrity sha512-NJM2BnJFZBEAbCfBP00zONKXvMqihZCrmwCaik0UhLr0vAgb6oguXxLX1k00oQyD+vZZ+CJn3kocvv2yxm4awQ== + dependencies: + "@typescript-eslint/types" "6.9.0" + "@typescript-eslint/visitor-keys" "6.9.0" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.5.4" + ts-api-utils "^1.0.1" + +"@typescript-eslint/utils@6.9.0": + version "6.9.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.9.0.tgz#5bdac8604fca4823f090e4268e681c84d3597c9f" + integrity sha512-5Wf+Jsqya7WcCO8me504FBigeQKVLAMPmUzYgDbWchINNh1KJbxCgVya3EQ2MjvJMVeXl3pofRmprqX6mfQkjQ== + dependencies: + "@eslint-community/eslint-utils" "^4.4.0" + "@types/json-schema" "^7.0.12" + "@types/semver" "^7.5.0" + "@typescript-eslint/scope-manager" "6.9.0" + "@typescript-eslint/types" "6.9.0" + "@typescript-eslint/typescript-estree" "6.9.0" + semver "^7.5.4" + +"@typescript-eslint/visitor-keys@6.9.0": + version "6.9.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.9.0.tgz#cc69421c10c4ac997ed34f453027245988164e80" + integrity sha512-dGtAfqjV6RFOtIP8I0B4ZTBRrlTT8NHHlZZSchQx3qReaoDeXhYM++M4So2AgFK9ZB0emRPA6JI1HkafzA2Ibg== + dependencies: + "@typescript-eslint/types" "6.9.0" + eslint-visitor-keys "^3.4.1" + +"@ungap/structured-clone@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" + integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== JSONStream@1.3.2: version "1.3.2" @@ -884,15 +1201,25 @@ abstract-level@^1.0.0, abstract-level@^1.0.2, abstract-level@^1.0.3: module-error "^1.0.1" queue-microtask "^1.2.3" +acorn-jsx@^5.3.2: + version "5.3.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== + acorn-walk@^8.1.1: version "8.2.0" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== acorn@^8.4.1: - version "8.8.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.0.tgz#88c0187620435c7f6015803f5539dae05a9dbea8" - integrity sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w== + version "8.10.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.10.0.tgz#8be5b3907a67221a81ab23c7889c4c5526b62ec5" + integrity sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw== + +acorn@^8.9.0: + version "8.11.2" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.2.tgz#ca0d78b51895be5390a5903c5b3bdcdaf78ae40b" + integrity sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w== adm-zip@^0.4.16: version "0.4.16" @@ -919,6 +1246,26 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" +ajv@^6.12.4, ajv@^6.12.6: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + +ajv@^8.0.1: + version "8.12.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.12.0.tgz#d1a0527323e22f53562c567c00991577dfbe19d1" + integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA== + dependencies: + fast-deep-equal "^3.1.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.2.2" + ansi-colors@4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" @@ -955,6 +1302,11 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0: dependencies: color-convert "^2.0.1" +antlr4@^4.11.0: + version "4.13.1" + resolved "https://registry.yarnpkg.com/antlr4/-/antlr4-4.13.1.tgz#1e0a1830a08faeb86217cb2e6c34716004e4253d" + integrity sha512-kiXTspaRYvnIArgE97z5YVVf/cDVQABr3abFRR6mE7yesLMkgu4ujuyV/sgxafQ8wgve0DJQUJ38Z8tkgA2izA== + antlr4@~4.8.0: version "4.8.0" resolved "https://registry.yarnpkg.com/antlr4/-/antlr4-4.8.0.tgz#f938ec171be7fc2855cd3a533e87647185b32b6a" @@ -971,9 +1323,9 @@ any-promise@^1.0.0: integrity sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A== anymatch@~3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" - integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg== + version "3.1.3" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" + integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== dependencies: normalize-path "^3.0.0" picomatch "^2.0.4" @@ -998,7 +1350,75 @@ array-back@^4.0.1, array-back@^4.0.2: resolved "https://registry.yarnpkg.com/array-back/-/array-back-4.0.2.tgz#8004e999a6274586beeb27342168652fdb89fa1e" integrity sha512-NbdMezxqf94cnNfWLL7V/im0Ub+Anbb0IoZhvzie8+4HJ4nMQuzHuy49FkGYCJK2yAloZ3meiB6AVMClbrI1vg== -asn1@^0.2.4: +array-buffer-byte-length@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz#fabe8bc193fea865f317fe7807085ee0dee5aead" + integrity sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A== + dependencies: + call-bind "^1.0.2" + is-array-buffer "^3.0.1" + +array-includes@^3.1.7: + version "3.1.7" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.7.tgz#8cd2e01b26f7a3086cbc87271593fe921c62abda" + integrity sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + get-intrinsic "^1.2.1" + is-string "^1.0.7" + +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + +array.prototype.findlastindex@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.3.tgz#b37598438f97b579166940814e2c0493a4f50207" + integrity sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + es-shim-unscopables "^1.0.0" + get-intrinsic "^1.2.1" + +array.prototype.flat@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz#1476217df8cff17d72ee8f3ba06738db5b387d18" + integrity sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + es-shim-unscopables "^1.0.0" + +array.prototype.flatmap@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz#c9a7c6831db8e719d6ce639190146c24bbd3e527" + integrity sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + es-shim-unscopables "^1.0.0" + +arraybuffer.prototype.slice@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.2.tgz#98bd561953e3e74bb34938e77647179dfe6e9f12" + integrity sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw== + dependencies: + array-buffer-byte-length "^1.0.0" + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + get-intrinsic "^1.2.1" + is-array-buffer "^3.0.2" + is-shared-array-buffer "^1.0.2" + +asn1@^0.2.6: version "0.2.6" resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.6.tgz#0d3a7bb6e64e02a90c0303b31f292868ea09a08d" integrity sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ== @@ -1010,19 +1430,25 @@ assertion-error@^1.1.0: resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== -async-eventemitter@^0.2.4: - version "0.2.4" - resolved "https://registry.yarnpkg.com/async-eventemitter/-/async-eventemitter-0.2.4.tgz#f5e7c8ca7d3e46aab9ec40a292baf686a0bafaca" - integrity sha512-pd20BwL7Yt1zwDFy+8MX8F1+WCT8aQeKj0kQnTrH9WaeRETlRamVhD0JtRPmrV4GfOJ2F9CvdQkZeZhnh2TuHw== - dependencies: - async "^2.4.0" +ast-parents@^0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/ast-parents/-/ast-parents-0.0.1.tgz#508fd0f05d0c48775d9eccda2e174423261e8dd3" + integrity sha512-XHusKxKz3zoYk1ic8Un640joHbFMhbqneyoZfoKnEGtf2ey9Uh/IdpcQplODdO/kENaMIWsD0nJm4+wX3UNLHA== -async@^2.4.0: - version "2.6.4" - resolved "https://registry.yarnpkg.com/async/-/async-2.6.4.tgz#706b7ff6084664cd7eae713f6f965433b5504221" - integrity sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA== - dependencies: - lodash "^4.17.14" +astral-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" + integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== + +at-least-node@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/at-least-node/-/at-least-node-1.0.0.tgz#602cd4b46e844ad4effc92a8011a3c46e0238dc2" + integrity sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg== + +available-typed-arrays@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" + integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== axios@^0.21.1: version "0.21.4" @@ -1060,17 +1486,15 @@ bech32@1.1.4: resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== -bigint-crypto-utils@^3.0.23: - version "3.1.7" - resolved "https://registry.yarnpkg.com/bigint-crypto-utils/-/bigint-crypto-utils-3.1.7.tgz#c4c1b537c7c1ab7aadfaecf3edfd45416bf2c651" - integrity sha512-zpCQpIE2Oy5WIQpjC9iYZf8Uh9QqoS51ZCooAcNvzv1AQ3VWdT52D0ksr1+/faeK8HVIej1bxXcP75YcqH3KPA== - dependencies: - bigint-mod-arith "^3.1.0" +big-integer@^1.6.44: + version "1.6.51" + resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.51.tgz#0df92a5d9880560d3ff2d5fd20245c889d130686" + integrity sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg== -bigint-mod-arith@^3.1.0: - version "3.1.2" - resolved "https://registry.yarnpkg.com/bigint-mod-arith/-/bigint-mod-arith-3.1.2.tgz#658e416bc593a463d97b59766226d0a3021a76b1" - integrity sha512-nx8J8bBeiRR+NlsROFH9jHswW5HO8mgfOSqW0AmjicMMvaONDa8AO+5ViKDUUNytBPWiwfvZP4/Bj4Y3lUfvgQ== +bigint-crypto-utils@^3.0.23: + version "3.3.0" + resolved "https://registry.yarnpkg.com/bigint-crypto-utils/-/bigint-crypto-utils-3.3.0.tgz#72ad00ae91062cf07f2b1def9594006c279c1d77" + integrity sha512-jOTSb+drvEDxEq6OuUybOAv/xxoh3cuYRUIPyu8sSHQNKM303UQ2R1DAo45o1AkcIXw6fzbaFI1+xGGdaXs2lg== binary-extensions@^2.0.0: version "2.2.0" @@ -1117,6 +1541,13 @@ bn.js@^5.2.0, bn.js@^5.2.1: resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== +bplist-parser@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/bplist-parser/-/bplist-parser-0.2.0.tgz#43a9d183e5bf9d545200ceac3e712f79ebbe8d0e" + integrity sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw== + dependencies: + big-integer "^1.6.44" + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -1132,7 +1563,7 @@ brace-expansion@^2.0.1: dependencies: balanced-match "^1.0.0" -braces@~3.0.2: +braces@^3.0.2, braces@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== @@ -1231,55 +1662,73 @@ buffer@^6.0.3: base64-js "^1.3.1" ieee754 "^1.2.1" -buildcheck@0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/buildcheck/-/buildcheck-0.0.3.tgz#70451897a95d80f7807e68fc412eb2e7e35ff4d5" - integrity sha512-pziaA+p/wdVImfcbsZLNF32EiWyujlQLwolMqUQE8xpKNOH7KmZQaY8sXN7DGOEzPAElo9QTaeNRfGnf3iOJbA== +buildcheck@~0.0.6: + version "0.0.6" + resolved "https://registry.yarnpkg.com/buildcheck/-/buildcheck-0.0.6.tgz#89aa6e417cfd1e2196e3f8fe915eb709d2fe4238" + integrity sha512-8f9ZJCUXyT1M35Jx7MkBgmBMo3oHTTBIPLiY9xyL0pl3T5RwcPEY8cUHr5LBNfu/fk6c2T4DJZuVM/8ZZT2D2A== -busboy@^1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/busboy/-/busboy-1.6.0.tgz#966ea36a9502e43cdb9146962523b92f531f6893" - integrity sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA== +bundle-name@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/bundle-name/-/bundle-name-3.0.0.tgz#ba59bcc9ac785fb67ccdbf104a2bf60c099f0e1a" + integrity sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw== dependencies: - streamsearch "^1.1.0" + run-applescript "^5.0.0" bytes@3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== -call-bind@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" - integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== +call-bind@^1.0.0, call-bind@^1.0.2, call-bind@^1.0.4, call-bind@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.5.tgz#6fa2b7845ce0ea49bf4d8b9ef64727a2c2e2e513" + integrity sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ== dependencies: - function-bind "^1.1.1" - get-intrinsic "^1.0.2" + function-bind "^1.1.2" + get-intrinsic "^1.2.1" + set-function-length "^1.1.1" + +callsites@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" + integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== camelcase@^6.0.0: version "6.3.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== +case@^1.6.3: + version "1.6.3" + resolved "https://registry.yarnpkg.com/case/-/case-1.6.3.tgz#0a4386e3e9825351ca2e6216c60467ff5f1ea1c9" + integrity sha512-mzDSXIPaFwVDvZAHqZ9VlbyF4yyXRuX6IvB06WvPYkqJVO24kX1PPhv9bfpKNFZyxYFmmgo03HUiD8iklmJYRQ== + catering@^2.1.0, catering@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/catering/-/catering-2.1.1.tgz#66acba06ed5ee28d5286133982a927de9a04b510" integrity sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w== +chai-as-promised@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/chai-as-promised/-/chai-as-promised-7.1.1.tgz#08645d825deb8696ee61725dbf590c012eb00ca0" + integrity sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA== + dependencies: + check-error "^1.0.2" + chai@^4.3.6: - version "4.3.6" - resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.6.tgz#ffe4ba2d9fa9d6680cc0b370adae709ec9011e9c" - integrity sha512-bbcp3YfHCUzMOvKqsztczerVgBKSsEijCySNlHHbX3VG1nskvqjz5Rfso1gGwD6w6oOV3eI60pKuMOV5MV7p3Q== + version "4.3.8" + resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.8.tgz#40c59718ad6928da6629c70496fe990b2bb5b17c" + integrity sha512-vX4YvVVtxlfSZ2VecZgFUTU5qPCYsobVI2O9FmwEXBhDigYGQA6jRXCycIs1yJnnWbZ6/+a2zNIF5DfVCcJBFQ== dependencies: assertion-error "^1.1.0" check-error "^1.0.2" - deep-eql "^3.0.1" + deep-eql "^4.1.2" get-func-name "^2.0.0" loupe "^2.3.1" pathval "^1.1.1" type-detect "^4.0.5" -chalk@4.1.2, chalk@^4.1.0: +chalk@4.1.2, chalk@^4.0.0, chalk@^4.1.0, chalk@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -1335,14 +1784,14 @@ cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: safe-buffer "^5.0.1" classic-level@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/classic-level/-/classic-level-1.2.0.tgz#2d52bdec8e7a27f534e67fdeb890abef3e643c27" - integrity sha512-qw5B31ANxSluWz9xBzklRWTUAJ1SXIdaVKTVS7HcTGKOAmExx65Wo5BUICW+YGORe2FOUaDghoI9ZDxj82QcFg== + version "1.3.0" + resolved "https://registry.yarnpkg.com/classic-level/-/classic-level-1.3.0.tgz#5e36680e01dc6b271775c093f2150844c5edd5c8" + integrity sha512-iwFAJQYtqRTRM0F6L8h4JCt00ZSGdOyqh7yVrhhjrOpFhmBjNlRUey64MCiyo6UmQHMJ+No3c81nujPv+n9yrg== dependencies: abstract-level "^1.0.2" catering "^2.1.0" module-error "^1.0.1" - napi-macros "~2.0.0" + napi-macros "^2.2.2" node-gyp-build "^4.3.0" clean-stack@^2.0.0: @@ -1359,6 +1808,11 @@ cliui@^7.0.2: strip-ansi "^6.0.0" wrap-ansi "^7.0.0" +code-block-writer@^12.0.0: + version "12.0.0" + resolved "https://registry.yarnpkg.com/code-block-writer/-/code-block-writer-12.0.0.tgz#4dd58946eb4234105aff7f0035977b2afdc2a770" + integrity sha512-q4dMFMlXtKR3XNBHyMHt/3pwYNA69EDk00lloMOaaUMKPUXBw6lpXtbu3MMVG6/uOihGnRDOlkyqsONEUj60+w== + color-convert@^1.9.0: version "1.9.3" resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" @@ -1413,12 +1867,22 @@ commander@3.0.2: resolved "https://registry.yarnpkg.com/commander/-/commander-3.0.2.tgz#6837c3fb677ad9933d1cfba42dd14d5117d6b39e" integrity sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow== +commander@^10.0.0: + version "10.0.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06" + integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug== + commander@^2.19.0: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== commander@^9.4.1: + version "9.5.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-9.5.0.tgz#bc08d1eb5cedf7ccb797a96199d41c7bc3e60d30" + integrity sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ== + +commander@~9.4.1: version "9.4.1" resolved "https://registry.yarnpkg.com/commander/-/commander-9.4.1.tgz#d1dd8f2ce6faf93147295c0df13c7c21141cfbdd" integrity sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw== @@ -1448,13 +1912,23 @@ core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85" integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ== -cpu-features@~0.0.4: - version "0.0.4" - resolved "https://registry.yarnpkg.com/cpu-features/-/cpu-features-0.0.4.tgz#0023475bb4f4c525869c162e4108099e35bf19d8" - integrity sha512-fKiZ/zp1mUwQbnzb9IghXtHtDoTMtNeb8oYGx6kX2SYfhnG0HNdBEBIzB9b5KlXu5DQPhfy3mInbBxFcgwAr3A== +cosmiconfig@^8.0.0: + version "8.3.6" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-8.3.6.tgz#060a2b871d66dba6c8538ea1118ba1ac16f5fae3" + integrity sha512-kcZ6+W5QzcJ3P1Mt+83OUv/oHFqZHIx8DuxG6eZ5RGMERoLqp4BuGjhHLYGK+Kf5XVkQvqBSmAy/nGWN3qDgEA== + dependencies: + import-fresh "^3.3.0" + js-yaml "^4.1.0" + parse-json "^5.2.0" + path-type "^4.0.0" + +cpu-features@~0.0.8: + version "0.0.9" + resolved "https://registry.yarnpkg.com/cpu-features/-/cpu-features-0.0.9.tgz#5226b92f0f1c63122b0a3eb84cb8335a4de499fc" + integrity sha512-AKjgn2rP2yJyfbepsmLfiYcmtNn/2eUvocUyM/09yB0YDiz39HteK/5/T4Onf0pmdYDMgkBoGvRLvEguzyL7wQ== dependencies: - buildcheck "0.0.3" - nan "^2.15.0" + buildcheck "~0.0.6" + nan "^2.17.0" crc-32@^1.2.0: version "1.2.2" @@ -1489,14 +1963,23 @@ create-require@^1.1.0: resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== -debug@4, debug@4.3.4, debug@^4.1.1, debug@^4.3.1, debug@^4.3.3: +cross-spawn@^7.0.2, cross-spawn@^7.0.3: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +debug@4, debug@4.3.4, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== dependencies: ms "2.1.2" -debug@^3.2.6: +debug@^3.2.6, debug@^3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" integrity sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ== @@ -1513,18 +1996,64 @@ decimal.js-light@^2.5.0: resolved "https://registry.yarnpkg.com/decimal.js-light/-/decimal.js-light-2.5.1.tgz#134fd32508f19e208f4fb2f8dac0d2626a867934" integrity sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg== -deep-eql@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-3.0.1.tgz#dfc9404400ad1c8fe023e7da1df1c147c4b444df" - integrity sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw== +deep-eql@^4.0.1, deep-eql@^4.1.2: + version "4.1.3" + resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.3.tgz#7c7775513092f7df98d8df9996dd085eb668cc6d" + integrity sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw== dependencies: type-detect "^4.0.0" -deep-extend@~0.6.0: +deep-extend@^0.6.0, deep-extend@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" integrity sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA== +deep-is@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" + integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== + +default-browser-id@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/default-browser-id/-/default-browser-id-3.0.0.tgz#bee7bbbef1f4e75d31f98f4d3f1556a14cea790c" + integrity sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA== + dependencies: + bplist-parser "^0.2.0" + untildify "^4.0.0" + +default-browser@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/default-browser/-/default-browser-4.0.0.tgz#53c9894f8810bf86696de117a6ce9085a3cbc7da" + integrity sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA== + dependencies: + bundle-name "^3.0.0" + default-browser-id "^3.0.0" + execa "^7.1.1" + titleize "^3.0.0" + +define-data-property@^1.0.1, define-data-property@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.1.tgz#c35f7cd0ab09883480d12ac5cb213715587800b3" + integrity sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ== + dependencies: + get-intrinsic "^1.2.1" + gopd "^1.0.1" + has-property-descriptors "^1.0.0" + +define-lazy-prop@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz#dbb19adfb746d7fc6d734a06b72f4a00d021255f" + integrity sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg== + +define-properties@^1.1.3, define-properties@^1.1.4, define-properties@^1.2.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.1.tgz#10781cc616eb951a80a034bafcaa7377f6af2b6c" + integrity sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg== + dependencies: + define-data-property "^1.0.1" + has-property-descriptors "^1.0.0" + object-keys "^1.1.1" + depd@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" @@ -1540,6 +2069,13 @@ diff@^4.0.1: resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== +dir-glob@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== + dependencies: + path-type "^4.0.0" + docker-modem@^1.0.8: version "1.0.9" resolved "https://registry.yarnpkg.com/docker-modem/-/docker-modem-1.0.9.tgz#a1f13e50e6afb6cf3431b2d5e7aac589db6aaba8" @@ -1551,9 +2087,9 @@ docker-modem@^1.0.8: split-ca "^1.0.0" docker-modem@^3.0.0: - version "3.0.6" - resolved "https://registry.yarnpkg.com/docker-modem/-/docker-modem-3.0.6.tgz#8c76338641679e28ec2323abb65b3276fb1ce597" - integrity sha512-h0Ow21gclbYsZ3mkHDfsYNDqtRhXS8fXr51bU0qr1dxgTMJj0XufbzX+jhNOvA8KuEEzn6JbvLVhXyv+fny9Uw== + version "3.0.8" + resolved "https://registry.yarnpkg.com/docker-modem/-/docker-modem-3.0.8.tgz#ef62c8bdff6e8a7d12f0160988c295ea8705e77a" + integrity sha512-f0ReSURdM3pcKPNS30mxOHSbaFLcknGmQjwSfmbcdOw1XWKXVhukM3NJHhr7NpY9BIyyWQb0EBo3KQvvuU5egQ== dependencies: debug "^4.1.1" readable-stream "^3.5.0" @@ -1570,14 +2106,28 @@ dockerode@^2.5.8: tar-fs "~1.16.3" dockerode@^3.3.4: - version "3.3.4" - resolved "https://registry.yarnpkg.com/dockerode/-/dockerode-3.3.4.tgz#875de614a1be797279caa9fe27e5637cf0e40548" - integrity sha512-3EUwuXnCU+RUlQEheDjmBE0B7q66PV9Rw5NiH1sXwINq0M9c5ERP9fxgkw36ZHOtzf4AGEEYySnkx/sACC9EgQ== + version "3.3.5" + resolved "https://registry.yarnpkg.com/dockerode/-/dockerode-3.3.5.tgz#7ae3f40f2bec53ae5e9a741ce655fff459745629" + integrity sha512-/0YNa3ZDNeLr/tSckmD69+Gq+qVNhvKfAHNeZJBnp7EOP6RGKV8ORrJHkUn20So5wU+xxT7+1n5u8PjHbfjbSA== dependencies: "@balena/dockerignore" "^1.0.2" docker-modem "^3.0.0" tar-fs "~2.0.1" +doctrine@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.1.0.tgz#5cd01fc101621b42c4cd7f5d1a66243716d3f39d" + integrity sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw== + dependencies: + esutils "^2.0.2" + +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + elliptic@6.5.4, elliptic@^6.5.2, elliptic@^6.5.4: version "6.5.4" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" @@ -1591,11 +2141,6 @@ elliptic@6.5.4, elliptic@^6.5.2, elliptic@^6.5.4: minimalistic-assert "^1.0.1" minimalistic-crypto-utils "^1.0.1" -emoji-regex@^10.1.0: - version "10.2.1" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-10.2.1.tgz#a41c330d957191efd3d9dfe6e1e8e1e9ab048b3f" - integrity sha512-97g6QgOk8zlDRdgq1WxwgTMgEWGVAQvB5Fdpgc1MkNy56la5SKP9GsMXKDOdqwn90/41a8yPwIGk1Y6WVbeMQA== - emoji-regex@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" @@ -1608,18 +2153,109 @@ end-of-stream@^1.0.0, end-of-stream@^1.1.0, end-of-stream@^1.4.1: dependencies: once "^1.4.0" +enhanced-resolve@^5.12.0: + version "5.15.0" + resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz#1af946c7d93603eb88e9896cee4904dc012e9c35" + integrity sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg== + dependencies: + graceful-fs "^4.2.4" + tapable "^2.2.0" + enquirer@^2.3.0: - version "2.3.6" - resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" - integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg== + version "2.4.1" + resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.4.1.tgz#93334b3fbd74fc7097b224ab4a8fb7e40bf4ae56" + integrity sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ== dependencies: ansi-colors "^4.1.1" + strip-ansi "^6.0.1" + +entities@~3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/entities/-/entities-3.0.1.tgz#2b887ca62585e96db3903482d336c1006c3001d4" + integrity sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q== env-paths@^2.2.0: version "2.2.1" resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2" integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A== +error-ex@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" + integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== + dependencies: + is-arrayish "^0.2.1" + +es-abstract@^1.22.1: + version "1.22.3" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.22.3.tgz#48e79f5573198de6dee3589195727f4f74bc4f32" + integrity sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA== + dependencies: + array-buffer-byte-length "^1.0.0" + arraybuffer.prototype.slice "^1.0.2" + available-typed-arrays "^1.0.5" + call-bind "^1.0.5" + es-set-tostringtag "^2.0.1" + es-to-primitive "^1.2.1" + function.prototype.name "^1.1.6" + get-intrinsic "^1.2.2" + get-symbol-description "^1.0.0" + globalthis "^1.0.3" + gopd "^1.0.1" + has-property-descriptors "^1.0.0" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.0" + internal-slot "^1.0.5" + is-array-buffer "^3.0.2" + is-callable "^1.2.7" + is-negative-zero "^2.0.2" + is-regex "^1.1.4" + is-shared-array-buffer "^1.0.2" + is-string "^1.0.7" + is-typed-array "^1.1.12" + is-weakref "^1.0.2" + object-inspect "^1.13.1" + object-keys "^1.1.1" + object.assign "^4.1.4" + regexp.prototype.flags "^1.5.1" + safe-array-concat "^1.0.1" + safe-regex-test "^1.0.0" + string.prototype.trim "^1.2.8" + string.prototype.trimend "^1.0.7" + string.prototype.trimstart "^1.0.7" + typed-array-buffer "^1.0.0" + typed-array-byte-length "^1.0.0" + typed-array-byte-offset "^1.0.0" + typed-array-length "^1.0.4" + unbox-primitive "^1.0.2" + which-typed-array "^1.1.13" + +es-set-tostringtag@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.0.2.tgz#11f7cc9f63376930a5f20be4915834f4bc74f9c9" + integrity sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q== + dependencies: + get-intrinsic "^1.2.2" + has-tostringtag "^1.0.0" + hasown "^2.0.0" + +es-shim-unscopables@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz#1f6942e71ecc7835ed1c8a83006d8771a63a3763" + integrity sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw== + dependencies: + hasown "^2.0.0" + +es-to-primitive@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" + integrity sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA== + dependencies: + is-callable "^1.1.4" + is-date-object "^1.0.1" + is-symbol "^1.0.2" + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -1635,10 +2271,160 @@ escape-string-regexp@^1.0.5: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg== -ethereum-cryptography@0.1.3, ethereum-cryptography@^0.1.3: - version "0.1.3" - resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" - integrity sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ== +eslint-import-resolver-node@^0.3.9: + version "0.3.9" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz#d4eaac52b8a2e7c3cd1903eb00f7e053356118ac" + integrity sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g== + dependencies: + debug "^3.2.7" + is-core-module "^2.13.0" + resolve "^1.22.4" + +eslint-import-resolver-typescript@^3.6.1: + version "3.6.1" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.6.1.tgz#7b983680edd3f1c5bce1a5829ae0bc2d57fe9efa" + integrity sha512-xgdptdoi5W3niYeuQxKmzVDTATvLYqhpwmykwsh7f6HIOStGWEIL9iqZgQDF9u9OEzrRwR8no5q2VT+bjAujTg== + dependencies: + debug "^4.3.4" + enhanced-resolve "^5.12.0" + eslint-module-utils "^2.7.4" + fast-glob "^3.3.1" + get-tsconfig "^4.5.0" + is-core-module "^2.11.0" + is-glob "^4.0.3" + +eslint-module-utils@^2.7.4, eslint-module-utils@^2.8.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz#e439fee65fc33f6bba630ff621efc38ec0375c49" + integrity sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw== + dependencies: + debug "^3.2.7" + +eslint-plugin-import@^2.29.0: + version "2.29.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.29.0.tgz#8133232e4329ee344f2f612885ac3073b0b7e155" + integrity sha512-QPOO5NO6Odv5lpoTkddtutccQjysJuFxoPS7fAHO+9m9udNHvTCPSAMW9zGAYj8lAIdr40I8yPCdUYrncXtrwg== + dependencies: + array-includes "^3.1.7" + array.prototype.findlastindex "^1.2.3" + array.prototype.flat "^1.3.2" + array.prototype.flatmap "^1.3.2" + debug "^3.2.7" + doctrine "^2.1.0" + eslint-import-resolver-node "^0.3.9" + eslint-module-utils "^2.8.0" + hasown "^2.0.0" + is-core-module "^2.13.1" + is-glob "^4.0.3" + minimatch "^3.1.2" + object.fromentries "^2.0.7" + object.groupby "^1.0.1" + object.values "^1.1.7" + semver "^6.3.1" + tsconfig-paths "^3.14.2" + +eslint-plugin-prettier@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.0.1.tgz#a3b399f04378f79f066379f544e42d6b73f11515" + integrity sha512-m3u5RnR56asrwV/lDC4GHorlW75DsFfmUcjfCYylTUs85dBRnB7VM6xG8eCMJdeDRnppzmxZVf1GEPJvl1JmNg== + dependencies: + prettier-linter-helpers "^1.0.0" + synckit "^0.8.5" + +eslint-scope@^7.2.2: + version "7.2.2" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" + integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== + dependencies: + esrecurse "^4.3.0" + estraverse "^5.2.0" + +eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" + integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== + +eslint@^8.51.0: + version "8.52.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.52.0.tgz#d0cd4a1fac06427a61ef9242b9353f36ea7062fc" + integrity sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@eslint-community/regexpp" "^4.6.1" + "@eslint/eslintrc" "^2.1.2" + "@eslint/js" "8.52.0" + "@humanwhocodes/config-array" "^0.11.13" + "@humanwhocodes/module-importer" "^1.0.1" + "@nodelib/fs.walk" "^1.2.8" + "@ungap/structured-clone" "^1.2.0" + ajv "^6.12.4" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" + doctrine "^3.0.0" + escape-string-regexp "^4.0.0" + eslint-scope "^7.2.2" + eslint-visitor-keys "^3.4.3" + espree "^9.6.1" + esquery "^1.4.2" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + find-up "^5.0.0" + glob-parent "^6.0.2" + globals "^13.19.0" + graphemer "^1.4.0" + ignore "^5.2.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + is-path-inside "^3.0.3" + js-yaml "^4.1.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" + natural-compare "^1.4.0" + optionator "^0.9.3" + strip-ansi "^6.0.1" + text-table "^0.2.0" + +espree@^9.6.0, espree@^9.6.1: + version "9.6.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" + integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== + dependencies: + acorn "^8.9.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^3.4.1" + +esquery@^1.4.2: + version "1.5.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" + integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== + dependencies: + estraverse "^5.1.0" + +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + +estraverse@^5.1.0, estraverse@^5.2.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" + integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +ethereum-cryptography@0.1.3, ethereum-cryptography@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" + integrity sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ== dependencies: "@types/pbkdf2" "^3.0.0" "@types/secp256k1" "^4.0.1" @@ -1657,14 +2443,14 @@ ethereum-cryptography@0.1.3, ethereum-cryptography@^0.1.3: setimmediate "^1.0.5" ethereum-cryptography@^1.0.3: - version "1.1.2" - resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-1.1.2.tgz#74f2ac0f0f5fe79f012c889b3b8446a9a6264e6d" - integrity sha512-XDSJlg4BD+hq9N2FjvotwUET9Tfxpxc3kWGE2AqUG5vcbeunnbImVk3cj6e/xT3phdW21mE8R5IugU4fspQDcQ== + version "1.2.0" + resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-1.2.0.tgz#5ccfa183e85fdaf9f9b299a79430c044268c9b3a" + integrity sha512-6yFQC9b5ug6/17CQpCyE3k9eKBMdhyVjzUy1WkiuY/E4vj/SXDBbCw8QEIaXqf0Mf2SnY6RmpDcwlUmBSS0EJw== dependencies: - "@noble/hashes" "1.1.2" - "@noble/secp256k1" "1.6.3" - "@scure/bip32" "1.1.0" - "@scure/bip39" "1.1.0" + "@noble/hashes" "1.2.0" + "@noble/secp256k1" "1.7.1" + "@scure/bip32" "1.1.5" + "@scure/bip39" "1.1.1" ethereumjs-abi@^0.6.8: version "0.6.8" @@ -1687,10 +2473,10 @@ ethereumjs-util@^6.0.0, ethereumjs-util@^6.2.1: ethjs-util "0.1.6" rlp "^2.2.3" -ethers@^5.7.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.1.tgz#48c83a44900b5f006eb2f65d3ba6277047fd4f33" - integrity sha512-5krze4dRLITX7FpU8J4WscXqADiKmyeNlylmmDLbS95DaZpBhDe2YSwRQwKXWNyXcox7a3gBgm/MkGXV1O1S/Q== +ethers@^5.7.0, ethers@^5.7.1: + version "5.7.2" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.7.2.tgz#3a7deeabbb8c030d4126b24f84e525466145872e" + integrity sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg== dependencies: "@ethersproject/abi" "5.7.0" "@ethersproject/abstract-provider" "5.7.0" @@ -1710,7 +2496,7 @@ ethers@^5.7.0: "@ethersproject/networks" "5.7.1" "@ethersproject/pbkdf2" "5.7.0" "@ethersproject/properties" "5.7.0" - "@ethersproject/providers" "5.7.1" + "@ethersproject/providers" "5.7.2" "@ethersproject/random" "5.7.0" "@ethersproject/rlp" "5.7.0" "@ethersproject/sha2" "5.7.0" @@ -1744,6 +2530,81 @@ evp_bytestokey@^1.0.3: md5.js "^1.3.4" safe-buffer "^5.1.1" +execa@^5.0.0: + version "5.1.1" + resolved "https://registry.yarnpkg.com/execa/-/execa-5.1.1.tgz#f80ad9cbf4298f7bd1d4c9555c21e93741c411dd" + integrity sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg== + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.0" + human-signals "^2.1.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.1" + onetime "^5.1.2" + signal-exit "^3.0.3" + strip-final-newline "^2.0.0" + +execa@^7.1.1: + version "7.2.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-7.2.0.tgz#657e75ba984f42a70f38928cedc87d6f2d4fe4e9" + integrity sha512-UduyVP7TLB5IcAQl+OzLyLcS/l32W/GLg+AhHJ+ow40FOk2U3SAllPwR44v4vmdFwIWqpdwxxpQbF1n5ta9seA== + dependencies: + cross-spawn "^7.0.3" + get-stream "^6.0.1" + human-signals "^4.3.0" + is-stream "^3.0.0" + merge-stream "^2.0.0" + npm-run-path "^5.1.0" + onetime "^6.0.0" + signal-exit "^3.0.7" + strip-final-newline "^3.0.0" + +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + +fast-diff@^1.1.2, fast-diff@^1.2.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.3.0.tgz#ece407fa550a64d638536cd727e129c61616e0f0" + integrity sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw== + +fast-glob@^3.2.12, fast-glob@^3.2.9, fast-glob@^3.3.0, fast-glob@^3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.1.tgz#784b4e897340f3dbbef17413b3f11acf03c874c4" + integrity sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + +fast-json-stable-stringify@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" + integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== + +fast-levenshtein@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== + +fastq@^1.6.0: + version "1.15.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a" + integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw== + dependencies: + reusify "^1.0.4" + +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== + dependencies: + flat-cache "^3.0.4" + fill-range@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" @@ -1758,7 +2619,7 @@ find-replace@^3.0.0: dependencies: array-back "^3.0.1" -find-up@5.0.0: +find-up@5.0.0, find-up@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== @@ -1773,16 +2634,37 @@ find-up@^2.1.0: dependencies: locate-path "^2.0.0" +flat-cache@^3.0.4: + version "3.1.1" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.1.1.tgz#a02a15fdec25a8f844ff7cc658f03dd99eb4609b" + integrity sha512-/qM2b3LUIaIgviBQovTLvijfyOQXPtSRnRK26ksj2J7rzPIecePUIpJsZ4T02Qg+xiAEKIs5K8dsHEd+VaKa/Q== + dependencies: + flatted "^3.2.9" + keyv "^4.5.3" + rimraf "^3.0.2" + flat@^5.0.2: version "5.0.2" resolved "https://registry.yarnpkg.com/flat/-/flat-5.0.2.tgz#8ca6fe332069ffa9d324c327198c598259ceb241" integrity sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ== +flatted@^3.2.9: + version "3.2.9" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf" + integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ== + follow-redirects@^1.12.1, follow-redirects@^1.14.0: version "1.15.2" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== +for-each@^0.3.3: + version "0.3.3" + resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" + integrity sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw== + dependencies: + is-callable "^1.1.3" + fp-ts@1.19.3: version "1.19.3" resolved "https://registry.yarnpkg.com/fp-ts/-/fp-ts-1.19.3.tgz#261a60d1088fbff01f91256f91d21d0caaaaa96f" @@ -1809,6 +2691,15 @@ fs-extra@^0.30.0: path-is-absolute "^1.0.0" rimraf "^2.2.8" +fs-extra@^11.1.1: + version "11.1.1" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.1.1.tgz#da69f7c39f3b002378b0954bb6ae7efdc0876e2d" + integrity sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + fs-extra@^7.0.0, fs-extra@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" @@ -1818,26 +2709,56 @@ fs-extra@^7.0.0, fs-extra@^7.0.1: jsonfile "^4.0.0" universalify "^0.1.0" +fs-extra@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" + integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== + dependencies: + at-least-node "^1.0.0" + graceful-fs "^4.2.0" + jsonfile "^6.0.1" + universalify "^2.0.0" + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== fsevents@~2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + version "2.3.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + +function.prototype.name@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.6.tgz#cdf315b7d90ee77a4c6ee216c3c3362da07533fd" + integrity sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + functions-have-names "^1.2.3" + functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g== +functions-have-names@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" + integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== + get-caller-file@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" @@ -1848,22 +2769,55 @@ get-func-name@^2.0.0: resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41" integrity sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig== -get-intrinsic@^1.0.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.3.tgz#063c84329ad93e83893c7f4f243ef63ffa351385" - integrity sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A== +get-intrinsic@^1.0.2, get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@^1.2.0, get-intrinsic@^1.2.1, get-intrinsic@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.2.tgz#281b7622971123e1ef4b3c90fd7539306da93f3b" + integrity sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA== dependencies: - function-bind "^1.1.1" - has "^1.0.3" + function-bind "^1.1.2" + has-proto "^1.0.1" has-symbols "^1.0.3" + hasown "^2.0.0" + +get-stdin@~9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-9.0.0.tgz#3983ff82e03d56f1b2ea0d3e60325f39d703a575" + integrity sha512-dVKBjfWisLAicarI2Sf+JuBE/DghV4UzNAVe9yhEJuzeREd3JhOTE9cUaJTeSa77fsbQUK3pcOpJfM59+VKZaA== -glob-parent@~5.1.2: +get-stream@^6.0.0, get-stream@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" + integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== + +get-symbol-description@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6" + integrity sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.1.1" + +get-tsconfig@^4.5.0: + version "4.7.2" + resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.7.2.tgz#0dcd6fb330391d46332f4c6c1bf89a6514c2ddce" + integrity sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A== + dependencies: + resolve-pkg-maps "^1.0.0" + +glob-parent@^5.1.2, glob-parent@~5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== dependencies: is-glob "^4.0.1" +glob-parent@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + glob@7.1.7: version "7.1.7" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.7.tgz#3b193e9233f01d42d0b3f78294bbeeb418f94a90" @@ -1900,34 +2854,94 @@ glob@^7.1.2, glob@^7.1.3, glob@^7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^8.0.3: + version "8.1.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" + integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^5.0.1" + once "^1.3.0" + +glob@~8.0.3: + version "8.0.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e" + integrity sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^5.0.1" + once "^1.3.0" + +globals@^13.19.0: + version "13.23.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.23.0.tgz#ef31673c926a0976e1f61dab4dca57e0c0a8af02" + integrity sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA== + dependencies: + type-fest "^0.20.2" + +globalthis@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf" + integrity sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA== + dependencies: + define-properties "^1.1.3" + +globby@^11.1.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" + integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.2.9" + ignore "^5.2.0" + merge2 "^1.4.1" + slash "^3.0.0" + +gopd@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== + dependencies: + get-intrinsic "^1.1.3" + graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9: version "4.2.10" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== -hardhat-typechain@^0.3.5: - version "0.3.5" - resolved "https://registry.yarnpkg.com/hardhat-typechain/-/hardhat-typechain-0.3.5.tgz#8e50616a9da348b33bd001168c8fda9c66b7b4af" - integrity sha512-w9lm8sxqTJACY+V7vijiH+NkPExnmtiQEjsV9JKD1KgMdVk2q8y+RhvU/c4B7+7b1+HylRUCxpOIvFuB3rE4+w== +graceful-fs@^4.2.0, graceful-fs@^4.2.4: + version "4.2.11" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" + integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== + +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== -hardhat@^2.11.0: - version "2.11.2" - resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.11.2.tgz#c81388630255823bb1717ec07c4ee651b1fbe97f" - integrity sha512-BdsXC1CFJQDJKmAgCwpmGhFuVU6dcqlgMgT0Kg/xmFAFVugkpYu6NRmh4AaJ3Fah0/BR9DOR4XgQGIbg4eon/Q== +hardhat@=2.16.0: + version "2.16.0" + resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.16.0.tgz#c5611d433416b31f6ce92f733b1f1b5236ad6230" + integrity sha512-7VQEJPQRAZdtrYUZaU9GgCpP3MBNy/pTdscARNJQMWKj5C+R7V32G5uIZKIqZ4QiqXa6CBfxxe+G+ahxUbHZHA== dependencies: "@ethersproject/abi" "^5.1.2" "@metamask/eth-sig-util" "^4.0.0" - "@nomicfoundation/ethereumjs-block" "^4.0.0" - "@nomicfoundation/ethereumjs-blockchain" "^6.0.0" - "@nomicfoundation/ethereumjs-common" "^3.0.0" - "@nomicfoundation/ethereumjs-evm" "^1.0.0" - "@nomicfoundation/ethereumjs-rlp" "^4.0.0" - "@nomicfoundation/ethereumjs-statemanager" "^1.0.0" - "@nomicfoundation/ethereumjs-trie" "^5.0.0" - "@nomicfoundation/ethereumjs-tx" "^4.0.0" - "@nomicfoundation/ethereumjs-util" "^8.0.0" - "@nomicfoundation/ethereumjs-vm" "^6.0.0" - "@nomicfoundation/solidity-analyzer" "^0.0.3" + "@nomicfoundation/ethereumjs-block" "5.0.1" + "@nomicfoundation/ethereumjs-blockchain" "7.0.1" + "@nomicfoundation/ethereumjs-common" "4.0.1" + "@nomicfoundation/ethereumjs-evm" "2.0.1" + "@nomicfoundation/ethereumjs-rlp" "5.0.1" + "@nomicfoundation/ethereumjs-statemanager" "2.0.1" + "@nomicfoundation/ethereumjs-trie" "6.0.1" + "@nomicfoundation/ethereumjs-tx" "5.0.1" + "@nomicfoundation/ethereumjs-util" "9.0.1" + "@nomicfoundation/ethereumjs-vm" "7.0.1" + "@nomicfoundation/solidity-analyzer" "^0.1.0" "@sentry/node" "^5.18.1" "@types/bn.js" "^5.1.0" "@types/lru-cache" "^5.1.0" @@ -1954,7 +2968,6 @@ hardhat@^2.11.0: mnemonist "^0.38.0" mocha "^10.0.0" p-map "^4.0.0" - qs "^6.7.0" raw-body "^2.4.1" resolve "1.17.0" semver "^6.3.0" @@ -1962,10 +2975,15 @@ hardhat@^2.11.0: source-map-support "^0.5.13" stacktrace-parser "^0.1.10" tsort "0.0.1" - undici "^5.4.0" + undici "^5.14.0" uuid "^8.3.2" ws "^7.4.6" +has-bigints@^1.0.1, has-bigints@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa" + integrity sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ== + has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" @@ -1976,11 +2994,30 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -has-symbols@^1.0.3: +has-property-descriptors@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz#52ba30b6c5ec87fd89fa574bc1c39125c6f65340" + integrity sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg== + dependencies: + get-intrinsic "^1.2.2" + +has-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.1.tgz#1885c1305538958aff469fef37937c22795408e0" + integrity sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg== + +has-symbols@^1.0.2, has-symbols@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== +has-tostringtag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" + integrity sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== + dependencies: + has-symbols "^1.0.2" + has@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" @@ -2005,6 +3042,13 @@ hash.js@1.1.7, hash.js@^1.0.0, hash.js@^1.0.3, hash.js@^1.1.7: inherits "^2.0.3" minimalistic-assert "^1.0.1" +hasown@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.0.tgz#f4c513d454a57b7c7e1650778de226b11700546c" + integrity sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA== + dependencies: + function-bind "^1.1.2" + he@1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" @@ -2038,6 +3082,16 @@ https-proxy-agent@^5.0.0: agent-base "6" debug "4" +human-signals@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-2.1.0.tgz#dc91fcba42e4d06e4abaed33b3e7a3c02f514ea0" + integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== + +human-signals@^4.3.0: + version "4.3.1" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-4.3.1.tgz#ab7f811e851fca97ffbd2c1fe9a958964de321b2" + integrity sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ== + iconv-lite@0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" @@ -2050,10 +3104,28 @@ ieee754@^1.1.13, ieee754@^1.2.1: resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== +ignore@^5.2.0, ignore@^5.2.4, ignore@~5.2.4: + version "5.2.4" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324" + integrity sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ== + immutable@^4.0.0-rc.12: - version "4.1.0" - resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.1.0.tgz#f795787f0db780183307b9eb2091fcac1f6fafef" - integrity sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ== + version "4.3.4" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.3.4.tgz#2e07b33837b4bb7662f288c244d1ced1ef65a78f" + integrity sha512-fsXeu4J4i6WNWSikpI88v/PcVflZz+6kMhUfIwc5SY+poQRPnaf5V7qds6SUyUN3cVxEzuCab7QIoLOQ+DQ1wA== + +import-fresh@^3.2.1, import-fresh@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + +imurmurhash@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" + integrity sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA== indent-string@^4.0.0: version "4.0.0" @@ -2073,6 +3145,20 @@ inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, i resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== +ini@~3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/ini/-/ini-3.0.1.tgz#c76ec81007875bc44d544ff7a11a55d12294102d" + integrity sha512-it4HyVAUTKBc6m8e1iXWvXSTdndF7HbdN713+kvLrymxTaU4AUBWrJ4vEooP+V7fexnVD3LKcBshjGGPefSMUQ== + +internal-slot@^1.0.5: + version "1.0.6" + resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.6.tgz#37e756098c4911c5e912b8edbf71ed3aa116f930" + integrity sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg== + dependencies: + get-intrinsic "^1.2.2" + hasown "^2.0.0" + side-channel "^1.0.4" + io-ts@1.10.4: version "1.10.4" resolved "https://registry.yarnpkg.com/io-ts/-/io-ts-1.10.4.tgz#cd5401b138de88e4f920adbcb7026e2d1967e6e2" @@ -2080,6 +3166,27 @@ io-ts@1.10.4: dependencies: fp-ts "^1.0.0" +is-array-buffer@^3.0.1, is-array-buffer@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/is-array-buffer/-/is-array-buffer-3.0.2.tgz#f2653ced8412081638ecb0ebbd0c41c6e0aecbbe" + integrity sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.2.0" + is-typed-array "^1.1.10" + +is-arrayish@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" + integrity sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg== + +is-bigint@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.4.tgz#08147a1875bc2b32005d41ccd8291dffc6691df3" + integrity sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg== + dependencies: + has-bigints "^1.0.1" + is-binary-path@~2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" @@ -2087,18 +3194,55 @@ is-binary-path@~2.1.0: dependencies: binary-extensions "^2.0.0" +is-boolean-object@^1.1.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.2.tgz#5c6dc200246dd9321ae4b885a114bb1f75f63719" + integrity sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA== + dependencies: + call-bind "^1.0.2" + has-tostringtag "^1.0.0" + is-buffer@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.5.tgz#ebc252e400d22ff8d77fa09888821a24a658c191" integrity sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ== -is-core-module@^2.9.0: - version "2.10.0" - resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.10.0.tgz#9012ede0a91c69587e647514e1d5277019e728ed" - integrity sha512-Erxj2n/LDAZ7H8WNJXd9tw38GYM3dv8rk8Zcs+jJuxYTW7sozH+SS8NtrSjVL1/vpLvWi1hxy96IzjJ3EHTJJg== +is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.7: + version "1.2.7" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" + integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== + +is-core-module@^2.11.0, is-core-module@^2.13.1: + version "2.13.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384" + integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw== + dependencies: + hasown "^2.0.0" + +is-core-module@^2.13.0: + version "2.13.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.0.tgz#bb52aa6e2cbd49a30c2ba68c42bf3435ba6072db" + integrity sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ== dependencies: has "^1.0.3" +is-date-object@^1.0.1: + version "1.0.5" + resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.5.tgz#0841d5536e724c25597bf6ea62e1bd38298df31f" + integrity sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ== + dependencies: + has-tostringtag "^1.0.0" + +is-docker@^2.0.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa" + integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ== + +is-docker@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-3.0.0.tgz#90093aa3106277d8a77a5910dbae71747e15a200" + integrity sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ== + is-extglob@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" @@ -2109,7 +3253,7 @@ is-fullwidth-code-point@^3.0.0: resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== -is-glob@^4.0.1, is-glob@~4.0.1: +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: version "4.0.3" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== @@ -2121,43 +3265,184 @@ is-hex-prefixed@1.0.0: resolved "https://registry.yarnpkg.com/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz#7d8d37e6ad77e5d127148913c573e082d777f554" integrity sha512-WvtOiug1VFrE9v1Cydwm+FnXd3+w9GaeVUss5W4v/SLy3UW00vP+6iNF2SdnfiBoLy4bTqVdkftNGTUeOFVsbA== +is-inside-container@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-inside-container/-/is-inside-container-1.0.0.tgz#e81fba699662eb31dbdaf26766a61d4814717ea4" + integrity sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA== + dependencies: + is-docker "^3.0.0" + +is-negative-zero@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.2.tgz#7bf6f03a28003b8b3965de3ac26f664d765f3150" + integrity sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA== + +is-number-object@^1.0.4: + version "1.0.7" + resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.7.tgz#59d50ada4c45251784e9904f5246c742f07a42fc" + integrity sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ== + dependencies: + has-tostringtag "^1.0.0" + is-number@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== +is-path-inside@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" + integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== + is-plain-obj@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== +is-regex@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" + integrity sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg== + dependencies: + call-bind "^1.0.2" + has-tostringtag "^1.0.0" + +is-shared-array-buffer@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz#8f259c573b60b6a32d4058a1a07430c0a7344c79" + integrity sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA== + dependencies: + call-bind "^1.0.2" + +is-stream@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077" + integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg== + +is-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-3.0.0.tgz#e6bfd7aa6bef69f4f472ce9bb681e3e57b4319ac" + integrity sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA== + +is-string@^1.0.5, is-string@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" + integrity sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg== + dependencies: + has-tostringtag "^1.0.0" + +is-symbol@^1.0.2, is-symbol@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.4.tgz#a6dac93b635b063ca6872236de88910a57af139c" + integrity sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg== + dependencies: + has-symbols "^1.0.2" + +is-typed-array@^1.1.10, is-typed-array@^1.1.12, is-typed-array@^1.1.9: + version "1.1.12" + resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.12.tgz#d0bab5686ef4a76f7a73097b95470ab199c57d4a" + integrity sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg== + dependencies: + which-typed-array "^1.1.11" + is-unicode-supported@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== +is-weakref@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.0.2.tgz#9529f383a9338205e89765e0392efc2f100f06f2" + integrity sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ== + dependencies: + call-bind "^1.0.2" + +is-wsl@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" + integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== + dependencies: + is-docker "^2.0.0" + isarray@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf" integrity sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ== +isarray@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" + integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== + isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" integrity sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ== +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== + +js-sdsl@^4.1.4: + version "4.4.2" + resolved "https://registry.yarnpkg.com/js-sdsl/-/js-sdsl-4.4.2.tgz#2e3c031b1f47d3aca8b775532e3ebb0818e7f847" + integrity sha512-dwXFwByc/ajSV6m5bcKAPwe4yDDF6D614pxmIi5odytzxRlwqF6nwoiCek80Ixc7Cvma5awClxrzFtxCQvcM8w== + js-sha3@0.8.0, js-sha3@^0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.8.0.tgz#b9b7a5da73afad7dedd0f8c463954cbde6818840" integrity sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q== -js-yaml@4.1.0: +js-tokens@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-yaml@4.1.0, js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== dependencies: argparse "^2.0.1" +json-buffer@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" + integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== + +json-parse-even-better-errors@^2.3.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" + integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== + +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-schema-traverse@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== + +json5@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593" + integrity sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA== + dependencies: + minimist "^1.2.0" + +jsonc-parser@~3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.0.tgz#31ff3f4c2b9793f89c67212627c51c6394f88e76" + integrity sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w== + jsonfile@^2.1.0: version "2.4.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" @@ -2172,20 +3457,36 @@ jsonfile@^4.0.0: optionalDependencies: graceful-fs "^4.1.6" +jsonfile@^6.0.1: + version "6.1.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae" + integrity sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ== + dependencies: + universalify "^2.0.0" + optionalDependencies: + graceful-fs "^4.1.6" + jsonparse@^1.2.0: version "1.3.1" resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg== keccak@^3.0.0, keccak@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.2.tgz#4c2c6e8c54e04f2670ee49fa734eb9da152206e0" - integrity sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ== + version "3.0.3" + resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.3.tgz#4bc35ad917be1ef54ff246f904c2bbbf9ac61276" + integrity sha512-JZrLIAJWuZxKbCilMpNz5Vj7Vtb4scDG3dMXLOsbzBmQGyjwE61BbW7bJkfKKCShXiQZt3T6sBgALRtmd+nZaQ== dependencies: node-addon-api "^2.0.0" node-gyp-build "^4.2.0" readable-stream "^3.6.0" +keyv@^4.5.3: + version "4.5.4" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" + integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== + dependencies: + json-buffer "3.0.1" + klaw@^1.0.0: version "1.3.1" resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439" @@ -2214,6 +3515,26 @@ level@^8.0.0: browser-level "^1.0.1" classic-level "^1.2.0" +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + +lines-and-columns@^1.1.6: + version "1.2.4" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" + integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== + +linkify-it@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-4.0.1.tgz#01f1d5e508190d06669982ba31a7d9f56a5751ec" + integrity sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw== + dependencies: + uc.micro "^1.0.1" + locate-path@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" @@ -2234,7 +3555,17 @@ lodash.camelcase@^4.3.0: resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" integrity sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA== -lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15: +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + +lodash.truncate@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" + integrity sha512-jttmRe7bRse52OsWIMDLaXxWqRAmtIUccAQ3garviCqJjafXOfNMO0yMfNpdD6zbGaTU0P5Nz7e7gAT6cKmJRw== + +lodash@^4.17.11, lodash@^4.17.15, lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -2248,9 +3579,9 @@ log-symbols@4.1.0: is-unicode-supported "^0.1.0" loupe@^2.3.1: - version "2.3.4" - resolved "https://registry.yarnpkg.com/loupe/-/loupe-2.3.4.tgz#7e0b9bffc76f148f9be769cb1321d3dcf3cb25f3" - integrity sha512-OvKfgCC2Ndby6aSTREl5aCCPTNIzlDfQZvZxNUrBrihDhL3xcrYegTblhmEiCrg2kKQz4XsFIaemE5BF4ybSaQ== + version "2.3.6" + resolved "https://registry.yarnpkg.com/loupe/-/loupe-2.3.6.tgz#76e4af498103c532d1ecc9be102036a21f787b53" + integrity sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA== dependencies: get-func-name "^2.0.0" @@ -2278,6 +3609,39 @@ make-error@^1.1.1: resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== +markdown-it@13.0.1: + version "13.0.1" + resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-13.0.1.tgz#c6ecc431cacf1a5da531423fc6a42807814af430" + integrity sha512-lTlxriVoy2criHP0JKRhO2VDG9c2ypWCsT237eDiLqi09rmbKoUetyGHq2uOIRoRS//kfoJckS0eUzzkDR+k2Q== + dependencies: + argparse "^2.0.1" + entities "~3.0.1" + linkify-it "^4.0.1" + mdurl "^1.0.1" + uc.micro "^1.0.5" + +markdownlint-cli@^0.33.0: + version "0.33.0" + resolved "https://registry.yarnpkg.com/markdownlint-cli/-/markdownlint-cli-0.33.0.tgz#703af1234c32c309ab52fcd0e8bc797a34e2b096" + integrity sha512-zMK1oHpjYkhjO+94+ngARiBBrRDEUMzooDHBAHtmEIJ9oYddd9l3chCReY2mPlecwH7gflQp1ApilTo+o0zopQ== + dependencies: + commander "~9.4.1" + get-stdin "~9.0.0" + glob "~8.0.3" + ignore "~5.2.4" + js-yaml "^4.1.0" + jsonc-parser "~3.2.0" + markdownlint "~0.27.0" + minimatch "~5.1.2" + run-con "~1.2.11" + +markdownlint@~0.27.0: + version "0.27.0" + resolved "https://registry.yarnpkg.com/markdownlint/-/markdownlint-0.27.0.tgz#9dabf7710a4999e2835e3c68317f1acd0bc89049" + integrity sha512-HtfVr/hzJJmE0C198F99JLaeada+646B5SaG2pVoEakLFI6iRGsvMqrnnrflq8hm1zQgwskEgqSnhDW11JBp0w== + dependencies: + markdown-it "13.0.1" + mcl-wasm@^0.7.1: version "0.7.9" resolved "https://registry.yarnpkg.com/mcl-wasm/-/mcl-wasm-0.7.9.tgz#c1588ce90042a8700c3b60e40efb339fc07ab87f" @@ -2292,6 +3656,11 @@ md5.js@^1.3.4: inherits "^2.0.1" safe-buffer "^5.1.2" +mdurl@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" + integrity sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g== + memory-level@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/memory-level/-/memory-level-1.0.0.tgz#7323c3fd368f9af2f71c3cd76ba403a17ac41692" @@ -2306,6 +3675,34 @@ memorystream@^0.3.1: resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2" integrity sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw== +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +merge2@^1.3.0, merge2@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + +micromatch@^4.0.4: + version "4.0.5" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" + integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA== + dependencies: + braces "^3.0.2" + picomatch "^2.3.1" + +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +mimic-fn@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-4.0.0.tgz#60a90550d5cb0b239cca65d893b1a53b29871ecc" + integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw== + minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" @@ -2323,17 +3720,31 @@ minimatch@5.0.1: dependencies: brace-expansion "^2.0.1" -minimatch@^3.0.4, minimatch@^3.1.1: +minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== dependencies: brace-expansion "^1.1.7" -minimist@^1.2.6: - version "1.2.6" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" - integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== +minimatch@^5.0.1, minimatch@~5.1.2: + version "5.1.6" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" + integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== + dependencies: + brace-expansion "^2.0.1" + +minimatch@^7.4.3: + version "7.4.6" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-7.4.6.tgz#845d6f254d8f4a5e4fd6baf44d5f10c8448365fb" + integrity sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw== + dependencies: + brace-expansion "^2.0.1" + +minimist@^1.2.0, minimist@^1.2.6, minimist@^1.2.8: + version "1.2.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" + integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== mkdirp-classic@^0.5.2: version "0.5.3" @@ -2352,6 +3763,11 @@ mkdirp@^1.0.4: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== +mkdirp@^2.1.6: + version "2.1.6" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-2.1.6.tgz#964fbcb12b2d8c5d6fbc62a963ac95a273e2cc19" + integrity sha512-+hEnITedc8LAtIP9u3HJDFIdcLV2vXP33sqLLIzkv1Db1zO/1OxbvYf0Y1OC/S/Qo5dxHXepofhmxL02PsKe+A== + mnemonist@^0.38.0: version "0.38.5" resolved "https://registry.yarnpkg.com/mnemonist/-/mnemonist-0.38.5.tgz#4adc7f4200491237fe0fa689ac0b86539685cade" @@ -2360,11 +3776,10 @@ mnemonist@^0.38.0: obliterator "^2.0.0" mocha@^10.0.0: - version "10.0.0" - resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.0.0.tgz#205447d8993ec755335c4b13deba3d3a13c4def9" - integrity sha512-0Wl+elVUD43Y0BqPZBzZt8Tnkw9CMUdNYnUsTfOM1vuhJVZL+kiesFYsqwBkEEuEixaiPe5ZQdqDgX2jddhmoA== + version "10.2.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.2.0.tgz#1fd4a7c32ba5ac372e03a17eef435bd00e5c68b8" + integrity sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg== dependencies: - "@ungap/promise-all-settled" "1.1.2" ansi-colors "4.1.1" browser-stdout "1.3.1" chokidar "3.5.3" @@ -2411,7 +3826,7 @@ mz@^2.7.0: object-assign "^4.0.1" thenify-all "^1.0.0" -nan@^2.15.0, nan@^2.16.0: +nan@^2.17.0: version "2.17.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.17.0.tgz#c0150a2368a182f033e9aa5195ec76ea41a199cb" integrity sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ== @@ -2421,10 +3836,15 @@ nanoid@3.3.3: resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.3.tgz#fd8e8b7aa761fe807dba2d1b98fb7241bb724a25" integrity sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w== -napi-macros@~2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/napi-macros/-/napi-macros-2.0.0.tgz#2b6bae421e7b96eb687aa6c77a7858640670001b" - integrity sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg== +napi-macros@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/napi-macros/-/napi-macros-2.2.2.tgz#817fef20c3e0e40a963fbf7b37d1600bd0201044" + integrity sha512-hmEVtAGYzVQpCKdbQea4skABsdXW4RUh5t5mJ2zzqowJS2OyXZTU1KhDVFhx+NlWZ4ap9mqR9TcDO3LTTttd+g== + +natural-compare@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" + integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== node-addon-api@^2.0.0: version "2.0.2" @@ -2432,31 +3852,88 @@ node-addon-api@^2.0.0: integrity sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA== node-fetch@^2.6.0: - version "2.6.8" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.8.tgz#a68d30b162bc1d8fd71a367e81b997e1f4d4937e" - integrity sha512-RZ6dBYuj8dRSfxpUSu+NsdF1dpPpluJxwOp+6IoDp/sH2QNDSvurYsAa+F1WxY2RjA1iP93xhcsUoYbF2XBqVg== + version "2.7.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== dependencies: whatwg-url "^5.0.0" node-gyp-build@^4.2.0, node-gyp-build@^4.3.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.5.0.tgz#7a64eefa0b21112f89f58379da128ac177f20e40" - integrity sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg== + version "4.6.1" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.6.1.tgz#24b6d075e5e391b8d5539d98c7fc5c210cac8a3e" + integrity sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ== normalize-path@^3.0.0, normalize-path@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== +npm-run-path@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== + dependencies: + path-key "^3.0.0" + +npm-run-path@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-5.1.0.tgz#bc62f7f3f6952d9894bd08944ba011a6ee7b7e00" + integrity sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q== + dependencies: + path-key "^4.0.0" + object-assign@^4.0.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== -object-inspect@^1.9.0: - version "1.12.2" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.2.tgz#c0641f26394532f28ab8d796ab954e43c009a8ea" - integrity sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ== +object-inspect@^1.13.1, object-inspect@^1.9.0: + version "1.13.1" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2" + integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ== + +object-keys@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" + integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== + +object.assign@^4.1.4: + version "4.1.4" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.4.tgz#9673c7c7c351ab8c4d0b516f4343ebf4dfb7799f" + integrity sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.4" + has-symbols "^1.0.3" + object-keys "^1.1.1" + +object.fromentries@^2.0.7: + version "2.0.7" + resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.7.tgz#71e95f441e9a0ea6baf682ecaaf37fa2a8d7e616" + integrity sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + +object.groupby@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object.groupby/-/object.groupby-1.0.1.tgz#d41d9f3c8d6c778d9cbac86b4ee9f5af103152ee" + integrity sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + get-intrinsic "^1.2.1" + +object.values@^1.1.7: + version "1.1.7" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.7.tgz#617ed13272e7e1071b43973aa1655d9291b8442a" + integrity sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" obliterator@^2.0.0: version "2.0.4" @@ -2470,6 +3947,47 @@ once@^1.3.0, once@^1.3.1, once@^1.4.0: dependencies: wrappy "1" +onetime@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.2.tgz#d0e96ebb56b07476df1dd9c4806e5237985ca45e" + integrity sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg== + dependencies: + mimic-fn "^2.1.0" + +onetime@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-6.0.0.tgz#7c24c18ed1fd2e9bca4bd26806a33613c77d34b4" + integrity sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ== + dependencies: + mimic-fn "^4.0.0" + +open@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/open/-/open-9.1.0.tgz#684934359c90ad25742f5a26151970ff8c6c80b6" + integrity sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg== + dependencies: + default-browser "^4.0.0" + define-lazy-prop "^3.0.0" + is-inside-container "^1.0.0" + is-wsl "^2.2.0" + +optionator@^0.9.3: + version "0.9.3" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" + integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg== + dependencies: + "@aashutoshrathi/word-wrap" "^1.2.3" + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + +ordinal@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/ordinal/-/ordinal-1.0.3.tgz#1a3c7726a61728112f50944ad7c35c06ae3a0d4d" + integrity sha512-cMddMgb2QElm8G7vdaa02jhUNbTSrhsgAGUz1OokD83uJTwSUn+nKoNoKVVaRa08yF6sgfO7Maou1+bgLd9rdQ== + os-tmpdir@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" @@ -2522,6 +4040,28 @@ p-try@^1.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" integrity sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww== +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + +parse-json@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" + integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-even-better-errors "^2.3.0" + lines-and-columns "^1.1.6" + +path-browserify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd" + integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g== + path-exists@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" @@ -2537,11 +4077,26 @@ path-is-absolute@^1.0.0: resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg== +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +path-key@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-4.0.0.tgz#295588dc3aee64154f877adb9d780b81c554bf18" + integrity sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ== + path-parse@^1.0.6, path-parse@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + pathington@^1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/pathington/-/pathington-1.1.7.tgz#caf2d2db899a31fea4e81e3657af6acde5171903" @@ -2563,11 +4118,26 @@ pbkdf2@^3.0.17: safe-buffer "^5.0.1" sha.js "^2.4.8" -picomatch@^2.0.4, picomatch@^2.2.1: +picocolors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" + integrity sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ== + +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== +pluralize@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-8.0.0.tgz#1a6fa16a38d12a1901e0320fa017051c539ce3b1" + integrity sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA== + +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + preprocess@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/preprocess/-/preprocess-3.2.0.tgz#36b3e2c52331fbc6fabb26d4fd5709304b7e3675" @@ -2575,28 +4145,51 @@ preprocess@^3.2.0: dependencies: xregexp "3.1.0" -prettier-plugin-solidity@^1.0.0-alpha.27: - version "1.0.0-rc.1" - resolved "https://registry.yarnpkg.com/prettier-plugin-solidity/-/prettier-plugin-solidity-1.0.0-rc.1.tgz#97b6129430b262cb0b25cc4c865f9515be9c6ede" - integrity sha512-horUGyCBbfNHWvJ44UVEcsfVySEoG2gxGs7TcBfTZWNvD4VU6rjzwAkrUtKV6VvRZWn9dh01XZ2UhhB3eVnMXQ== +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== dependencies: - "@solidity-parser/parser" "^0.14.5" - emoji-regex "^10.1.0" - escape-string-regexp "^4.0.0" - semver "^7.3.7" + fast-diff "^1.1.2" + +prettier-plugin-solidity@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/prettier-plugin-solidity/-/prettier-plugin-solidity-1.1.3.tgz#9a35124f578404caf617634a8cab80862d726cba" + integrity sha512-fQ9yucPi2sBbA2U2Xjh6m4isUTJ7S7QLc/XDDsktqqxYfTwdYKJ0EnnywXHwCGAaYbQNK+HIYPL1OemxuMsgeg== + dependencies: + "@solidity-parser/parser" "^0.16.0" + semver "^7.3.8" solidity-comments-extractor "^0.0.7" - string-width "^4.2.3" -prettier@^2.1.2, prettier@^2.3.0, prettier@^2.3.1: +prettier@^2.1.2: version "2.7.1" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== +prettier@^2.3.1, prettier@^2.8.3: + version "2.8.8" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" + integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== + +prettier@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.3.tgz#432a51f7ba422d1469096c0fdc28e235db8f9643" + integrity sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg== + process-nextick-args@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== +proper-lockfile@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/proper-lockfile/-/proper-lockfile-4.1.2.tgz#c8b9de2af6b2f1601067f98e01ac66baa223141f" + integrity sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA== + dependencies: + graceful-fs "^4.2.4" + retry "^0.12.0" + signal-exit "^3.0.2" + pump@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/pump/-/pump-1.0.3.tgz#5dfe8311c33bbf6fc18261f9f34702c47c08a954" @@ -2613,12 +4206,10 @@ pump@^3.0.0: end-of-stream "^1.1.0" once "^1.3.1" -qs@^6.7.0: - version "6.11.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" - integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q== - dependencies: - side-channel "^1.0.4" +punycode@^2.1.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f" + integrity sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA== queue-microtask@^1.2.2, queue-microtask@^1.2.3: version "1.2.3" @@ -2633,9 +4224,9 @@ randombytes@^2.1.0: safe-buffer "^5.1.0" raw-body@^2.4.1: - version "2.5.1" - resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.1.tgz#fe1b1628b181b700215e5fd42389f98b71392857" - integrity sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig== + version "2.5.2" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.2.tgz#99febd83b90e08975087e8f1f9419a149366b68a" + integrity sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA== dependencies: bytes "3.1.2" http-errors "2.0.0" @@ -2643,9 +4234,9 @@ raw-body@^2.4.1: unpipe "1.0.0" readable-stream@^2.2.2, readable-stream@^2.3.0, readable-stream@^2.3.5: - version "2.3.7" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" - integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + version "2.3.8" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b" + integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA== dependencies: core-util-is "~1.0.0" inherits "~2.0.3" @@ -2656,9 +4247,9 @@ readable-stream@^2.2.2, readable-stream@^2.3.0, readable-stream@^2.3.5: util-deprecate "~1.0.1" readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.5.0, readable-stream@^3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" - integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + version "3.6.2" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967" + integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA== dependencies: inherits "^2.0.3" string_decoder "^1.1.1" @@ -2686,16 +4277,35 @@ reduce-flatten@^2.0.0: resolved "https://registry.yarnpkg.com/reduce-flatten/-/reduce-flatten-2.0.0.tgz#734fd84e65f375d7ca4465c69798c25c9d10ae27" integrity sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w== +regexp.prototype.flags@^1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.1.tgz#90ce989138db209f81492edd734183ce99f9677e" + integrity sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + set-function-name "^2.0.0" + require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== -require-from-string@^2.0.0: +require-from-string@^2.0.0, require-from-string@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + +resolve-pkg-maps@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz#616b3dc2c57056b5588c31cdf4b3d64db133720f" + integrity sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw== + resolve@1.17.0: version "1.17.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.17.0.tgz#b25941b54968231cc2d1bb76a79cb7f2c0bf8444" @@ -2704,14 +4314,33 @@ resolve@1.17.0: path-parse "^1.0.6" resolve@^1.10.0, resolve@^1.8.1: - version "1.22.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" - integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== + version "1.22.4" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.4.tgz#1dc40df46554cdaf8948a486a10f6ba1e2026c34" + integrity sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg== + dependencies: + is-core-module "^2.13.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + +resolve@^1.22.4: + version "1.22.8" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" + integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== dependencies: - is-core-module "^2.9.0" + is-core-module "^2.13.0" path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +retry@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" + integrity sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow== + +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + rimraf@^2.2.8: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" @@ -2719,6 +4348,13 @@ rimraf@^2.2.8: dependencies: glob "^7.1.3" +rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + ripemd160@^2.0.0, ripemd160@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" @@ -2734,6 +4370,23 @@ rlp@^2.2.3: dependencies: bn.js "^5.2.0" +run-applescript@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/run-applescript/-/run-applescript-5.0.0.tgz#e11e1c932e055d5c6b40d98374e0268d9b11899c" + integrity sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg== + dependencies: + execa "^5.0.0" + +run-con@~1.2.11: + version "1.2.12" + resolved "https://registry.yarnpkg.com/run-con/-/run-con-1.2.12.tgz#51c319910e45a3bd71ee773564a89d96635c8c64" + integrity sha512-5257ILMYIF4RztL9uoZ7V9Q97zHtNHn5bN3NobeAnzB1P3ASLgg8qocM2u+R18ttp+VEM78N2LK8XcNVtnSRrg== + dependencies: + deep-extend "^0.6.0" + ini "~3.0.0" + minimist "^1.2.8" + strip-json-comments "~3.1.1" + run-parallel-limit@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/run-parallel-limit/-/run-parallel-limit-1.1.0.tgz#be80e936f5768623a38a963262d6bef8ff11e7ba" @@ -2741,11 +4394,28 @@ run-parallel-limit@^1.1.0: dependencies: queue-microtask "^1.2.2" +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" + rustbn.js@~0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/rustbn.js/-/rustbn.js-0.2.0.tgz#8082cb886e707155fd1cb6f23bd591ab8d55d0ca" integrity sha512-4VlvkRUuCJvr2J6Y0ImW7NvTCriMi7ErOAqWk1y69vAdoNIzCF3yPmgeNzx+RQTLEDFq5sHfscn1MwHxP9hNfA== +safe-array-concat@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/safe-array-concat/-/safe-array-concat-1.0.1.tgz#91686a63ce3adbea14d61b14c99572a8ff84754c" + integrity sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.2.1" + has-symbols "^1.0.3" + isarray "^2.0.5" + safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" @@ -2756,6 +4426,15 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== +safe-regex-test@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.0.tgz#793b874d524eb3640d1873aad03596db2d4f2295" + integrity sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.1.3" + is-regex "^1.1.4" + "safer-buffer@>= 2.1.2 < 3", safer-buffer@~2.1.0: version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" @@ -2776,19 +4455,19 @@ secp256k1@^4.0.1: node-gyp-build "^4.2.0" semver@^5.5.0, semver@^5.6.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" - integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + version "5.7.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" + integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== -semver@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" - integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== +semver@^6.3.0, semver@^6.3.1: + version "6.3.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" + integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.3.7: - version "7.3.8" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.8.tgz#07a78feafb3f7b32347d725e33de7e2a2df67798" - integrity sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A== +semver@^7.3.8, semver@^7.5.1, semver@^7.5.2, semver@^7.5.4: + version "7.5.4" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== dependencies: lru-cache "^6.0.0" @@ -2799,6 +4478,25 @@ serialize-javascript@6.0.0: dependencies: randombytes "^2.1.0" +set-function-length@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.1.1.tgz#4bc39fafb0307224a33e106a7d35ca1218d659ed" + integrity sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ== + dependencies: + define-data-property "^1.1.1" + get-intrinsic "^1.2.1" + gopd "^1.0.1" + has-property-descriptors "^1.0.0" + +set-function-name@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/set-function-name/-/set-function-name-2.0.1.tgz#12ce38b7954310b9f61faa12701620a0c882793a" + integrity sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA== + dependencies: + define-data-property "^1.0.1" + functions-have-names "^1.2.3" + has-property-descriptors "^1.0.0" + setimmediate@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" @@ -2817,6 +4515,18 @@ sha.js@^2.4.0, sha.js@^2.4.8: inherits "^2.0.1" safe-buffer "^5.0.1" +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + side-channel@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" @@ -2826,6 +4536,25 @@ side-channel@^1.0.4: get-intrinsic "^1.0.2" object-inspect "^1.9.0" +signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: + version "3.0.7" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" + integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== + +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + +slice-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b" + integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== + dependencies: + ansi-styles "^4.0.0" + astral-regex "^2.0.0" + is-fullwidth-code-point "^3.0.0" + solc@0.7.3: version "0.7.3" resolved "https://registry.yarnpkg.com/solc/-/solc-0.7.3.tgz#04646961bd867a744f63d2b4e3c0701ffdc7d78a" @@ -2841,6 +4570,31 @@ solc@0.7.3: semver "^5.5.0" tmp "0.0.33" +solhint@^3.6.2: + version "3.6.2" + resolved "https://registry.yarnpkg.com/solhint/-/solhint-3.6.2.tgz#2b2acbec8fdc37b2c68206a71ba89c7f519943fe" + integrity sha512-85EeLbmkcPwD+3JR7aEMKsVC9YrRSxd4qkXuMzrlf7+z2Eqdfm1wHWq1ffTuo5aDhoZxp2I9yF3QkxZOxOL7aQ== + dependencies: + "@solidity-parser/parser" "^0.16.0" + ajv "^6.12.6" + antlr4 "^4.11.0" + ast-parents "^0.0.1" + chalk "^4.1.2" + commander "^10.0.0" + cosmiconfig "^8.0.0" + fast-diff "^1.2.0" + glob "^8.0.3" + ignore "^5.2.4" + js-yaml "^4.1.0" + lodash "^4.17.21" + pluralize "^8.0.0" + semver "^7.5.2" + strip-ansi "^6.0.1" + table "^6.8.1" + text-table "^0.2.0" + optionalDependencies: + prettier "^2.8.3" + solidity-comments-extractor@^0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/solidity-comments-extractor/-/solidity-comments-extractor-0.0.7.tgz#99d8f1361438f84019795d928b931f4e5c39ca19" @@ -2880,15 +4634,15 @@ split-ca@^1.0.0, split-ca@^1.0.1: integrity sha512-Q5thBSxp5t8WPTTJQS59LrGqOZqOsrhDGDVm8azCqIBjSBd7nd9o2PM+mDulQQkh8h//4U6hFZnc/mul8t5pWQ== ssh2@^1.11.0: - version "1.11.0" - resolved "https://registry.yarnpkg.com/ssh2/-/ssh2-1.11.0.tgz#ce60186216971e12f6deb553dcf82322498fe2e4" - integrity sha512-nfg0wZWGSsfUe/IBJkXVll3PEZ//YH2guww+mP88gTpuSU4FtZN7zu9JoeTGOyCNx2dTDtT9fOpWwlzyj4uOOw== + version "1.14.0" + resolved "https://registry.yarnpkg.com/ssh2/-/ssh2-1.14.0.tgz#8f68440e1b768b66942c9e4e4620b2725b3555bb" + integrity sha512-AqzD1UCqit8tbOKoj6ztDDi1ffJZ2rV2SwlgrVVrHPkV5vWqGJOVp5pmtj18PunkPJAuKQsnInyKV+/Nb2bUnA== dependencies: - asn1 "^0.2.4" + asn1 "^0.2.6" bcrypt-pbkdf "^1.0.2" optionalDependencies: - cpu-features "~0.0.4" - nan "^2.16.0" + cpu-features "~0.0.8" + nan "^2.17.0" stacktrace-parser@^0.1.10: version "0.1.10" @@ -2902,11 +4656,6 @@ statuses@2.0.1: resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== -streamsearch@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-1.1.0.tgz#404dd1e2247ca94af554e841a8ef0eaa238da764" - integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg== - string-format@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/string-format/-/string-format-2.0.0.tgz#f2df2e7097440d3b65de31b6d40d54c96eaffb9b" @@ -2921,6 +4670,33 @@ string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.1" +string.prototype.trim@^1.2.8: + version "1.2.8" + resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz#f9ac6f8af4bd55ddfa8895e6aea92a96395393bd" + integrity sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + +string.prototype.trimend@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz#1bb3afc5008661d73e2dc015cd4853732d6c471e" + integrity sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + +string.prototype.trimstart@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz#d4cdb44b83a4737ffbac2d406e405d43d0184298" + integrity sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + string_decoder@^1.1.1: version "1.3.0" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" @@ -2947,6 +4723,21 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1: dependencies: ansi-regex "^5.0.1" +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA== + +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + +strip-final-newline@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-3.0.0.tgz#52894c313fbff318835280aed60ff71ebf12b8fd" + integrity sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw== + strip-hex-prefix@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz#0c5f155fef1151373377de9dbb588da05500e36f" @@ -2954,7 +4745,7 @@ strip-hex-prefix@1.0.0: dependencies: is-hex-prefixed "1.0.0" -strip-json-comments@3.1.1: +strip-json-comments@3.1.1, strip-json-comments@^3.1.1, strip-json-comments@~3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== @@ -2985,6 +4776,14 @@ supports-preserve-symlinks-flag@^1.0.0: resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== +synckit@^0.8.5: + version "0.8.5" + resolved "https://registry.yarnpkg.com/synckit/-/synckit-0.8.5.tgz#b7f4358f9bb559437f9f167eb6bc46b3c9818fa3" + integrity sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q== + dependencies: + "@pkgr/utils" "^2.3.1" + tslib "^2.5.0" + table-layout@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/table-layout/-/table-layout-1.0.2.tgz#c4038a1853b0136d63365a734b6931cf4fad4a04" @@ -2995,6 +4794,22 @@ table-layout@^1.0.2: typical "^5.2.0" wordwrapjs "^4.0.0" +table@^6.8.1: + version "6.8.1" + resolved "https://registry.yarnpkg.com/table/-/table-6.8.1.tgz#ea2b71359fe03b017a5fbc296204471158080bdf" + integrity sha512-Y4X9zqrCftUhMeH2EptSSERdVKt/nEdijTOacGD/97EKjhQ/Qs8RTlEGABSJNNN8lac9kheH+af7yAkEWlgneA== + dependencies: + ajv "^8.0.1" + lodash.truncate "^4.4.2" + slice-ansi "^4.0.0" + string-width "^4.2.3" + strip-ansi "^6.0.1" + +tapable@^2.2.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.1.tgz#1967a73ef4060a82f12ab96af86d52fdb76eeca0" + integrity sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ== + tar-fs@~1.16.3: version "1.16.3" resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-1.16.3.tgz#966a628841da2c4010406a82167cbd5e0c72d509" @@ -3049,6 +4864,11 @@ template-file@^6.0.1: mkdirp "^1.0.4" p-limit "^4.0.0" +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== + thenify-all@^1.0.0: version "1.6.0" resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" @@ -3068,6 +4888,11 @@ thenify-all@^1.0.0: resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== +titleize@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/titleize/-/titleize-3.0.0.tgz#71c12eb7fdd2558aa8a44b0be83b8a76694acd53" + integrity sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ== + tmp@0.0.33: version "0.0.33" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" @@ -3097,10 +4922,15 @@ tr46@~0.0.3: resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== +ts-api-utils@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.3.tgz#f12c1c781d04427313dbac808f453f050e54a331" + integrity sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg== + ts-command-line-args@^2.2.0: - version "2.3.1" - resolved "https://registry.yarnpkg.com/ts-command-line-args/-/ts-command-line-args-2.3.1.tgz#b6188e42efc6cf7a8898e438a873fbb15505ddd6" - integrity sha512-FR3y7pLl/fuUNSmnPhfLArGqRrpojQgIEEOVzYx9DhTmfIN7C9RWSfpkJEF4J+Gk7aVx5pak8I7vWZsaN4N84g== + version "2.5.1" + resolved "https://registry.yarnpkg.com/ts-command-line-args/-/ts-command-line-args-2.5.1.tgz#e64456b580d1d4f6d948824c274cf6fa5f45f7f0" + integrity sha512-H69ZwTw3rFHb5WYpQya40YAX2/w7Ut75uUECbgBIsLmM+BNuYnxsltfyyLMxy6sEeKxgijLTnQtLd0nKd6+IYw== dependencies: chalk "^4.1.0" command-line-args "^5.1.1" @@ -3132,6 +4962,14 @@ ts-generator@^0.1.1: resolve "^1.8.1" ts-essentials "^1.0.0" +ts-morph@^19.0.0: + version "19.0.0" + resolved "https://registry.yarnpkg.com/ts-morph/-/ts-morph-19.0.0.tgz#43e95fb0156c3fe3c77c814ac26b7d0be2f93169" + integrity sha512-D6qcpiJdn46tUqV45vr5UGM2dnIEuTGNxVhg0sk5NX11orcouwj6i1bMqZIz2mZTZB1Hcgy7C3oEVhAT+f6mbQ== + dependencies: + "@ts-morph/common" "~0.20.0" + code-block-writer "^12.0.0" + ts-node@^10.7.0: version "10.9.1" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" @@ -3151,11 +4989,26 @@ ts-node@^10.7.0: v8-compile-cache-lib "^3.0.1" yn "3.1.1" +tsconfig-paths@^3.14.2: + version "3.14.2" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088" + integrity sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g== + dependencies: + "@types/json5" "^0.0.29" + json5 "^1.0.2" + minimist "^1.2.6" + strip-bom "^3.0.0" + tslib@^1.9.3: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== +tslib@^2.5.0, tslib@^2.6.0: + version "2.6.2" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" + integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== + tsort@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/tsort/-/tsort-0.0.1.tgz#e2280f5e817f8bf4275657fd0f9aebd44f5a2786" @@ -3176,11 +5029,23 @@ tweetnacl@^1.0.3: resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + type-detect@^4.0.0, type-detect@^4.0.5: version "4.0.8" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + type-fest@^0.21.3: version "0.21.3" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" @@ -3192,9 +5057,9 @@ type-fest@^0.7.1: integrity sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg== typechain@^8.1.1: - version "8.1.1" - resolved "https://registry.yarnpkg.com/typechain/-/typechain-8.1.1.tgz#9c2e8012c2c4c586536fc18402dcd7034c4ff0bd" - integrity sha512-uF/sUvnXTOVF2FHKhQYnxHk4su4JjZR8vr4mA2mBaRwHTbwh0jIlqARz9XJr1tA0l7afJGvEa1dTSi4zt039LQ== + version "8.3.1" + resolved "https://registry.yarnpkg.com/typechain/-/typechain-8.3.1.tgz#dccbc839b94877997536c356380eff7325395cfb" + integrity sha512-fA7clol2IP/56yq6vkMTR+4URF1nGjV82Wx6Rf09EsqD4tkzMAvEaqYxVFCavJm/1xaRga/oD55K+4FtuXwQOQ== dependencies: "@types/prettier" "^2.1.1" debug "^4.3.1" @@ -3207,15 +5072,54 @@ typechain@^8.1.1: ts-command-line-args "^2.2.0" ts-essentials "^7.0.1" +typed-array-buffer@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz#18de3e7ed7974b0a729d3feecb94338d1472cd60" + integrity sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.2.1" + is-typed-array "^1.1.10" + +typed-array-byte-length@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz#d787a24a995711611fb2b87a4052799517b230d0" + integrity sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA== + dependencies: + call-bind "^1.0.2" + for-each "^0.3.3" + has-proto "^1.0.1" + is-typed-array "^1.1.10" + +typed-array-byte-offset@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz#cbbe89b51fdef9cd6aaf07ad4707340abbc4ea0b" + integrity sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg== + dependencies: + available-typed-arrays "^1.0.5" + call-bind "^1.0.2" + for-each "^0.3.3" + has-proto "^1.0.1" + is-typed-array "^1.1.10" + +typed-array-length@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.4.tgz#89d83785e5c4098bec72e08b319651f0eac9c1bb" + integrity sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng== + dependencies: + call-bind "^1.0.2" + for-each "^0.3.3" + is-typed-array "^1.1.9" + typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== typescript@^4.6.4: - version "4.8.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" - integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== + version "4.9.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" + integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== typical@^4.0.0: version "4.0.0" @@ -3227,23 +5131,55 @@ typical@^5.2.0: resolved "https://registry.yarnpkg.com/typical/-/typical-5.2.0.tgz#4daaac4f2b5315460804f0acf6cb69c52bb93066" integrity sha512-dvdQgNDNJo+8B2uBQoqdb11eUCE1JQXhvjC/CZtgvZseVd5TYMXnq0+vuUemXbd/Se29cTaUuPX3YIc2xgbvIg== -undici@^5.4.0: - version "5.11.0" - resolved "https://registry.yarnpkg.com/undici/-/undici-5.11.0.tgz#1db25f285821828fc09d3804b9e2e934ae86fc13" - integrity sha512-oWjWJHzFet0Ow4YZBkyiJwiK5vWqEYoH7BINzJAJOLedZ++JpAlCbUktW2GQ2DS2FpKmxD/JMtWUUWl1BtghGw== +uc.micro@^1.0.1, uc.micro@^1.0.5: + version "1.0.6" + resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" + integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== + +unbox-primitive@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" + integrity sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw== + dependencies: + call-bind "^1.0.2" + has-bigints "^1.0.2" + has-symbols "^1.0.3" + which-boxed-primitive "^1.0.2" + +undici@^5.14.0: + version "5.26.4" + resolved "https://registry.yarnpkg.com/undici/-/undici-5.26.4.tgz#dc861c35fb53ae025a173a790d984aa9b2e279a1" + integrity sha512-OG+QOf0fTLtazL9P9X7yqWxQ+Z0395Wk6DSkyTxtaq3wQEjIroVe7Y4asCX/vcCxYpNGMnwz8F0qbRYUoaQVMw== dependencies: - busboy "^1.6.0" + "@fastify/busboy" "^2.0.0" universalify@^0.1.0: version "0.1.2" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== +universalify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" + integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ== + unpipe@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== +untildify@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/untildify/-/untildify-4.0.0.tgz#2bc947b953652487e4600949fb091e3ae8cd919b" + integrity sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw== + +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" @@ -3272,6 +5208,35 @@ whatwg-url@^5.0.0: tr46 "~0.0.3" webidl-conversions "^3.0.0" +which-boxed-primitive@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6" + integrity sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg== + dependencies: + is-bigint "^1.0.1" + is-boolean-object "^1.1.0" + is-number-object "^1.0.4" + is-string "^1.0.5" + is-symbol "^1.0.3" + +which-typed-array@^1.1.11, which-typed-array@^1.1.13: + version "1.1.13" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.13.tgz#870cd5be06ddb616f504e7b039c4c24898184d36" + integrity sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow== + dependencies: + available-typed-arrays "^1.0.5" + call-bind "^1.0.4" + for-each "^0.3.3" + gopd "^1.0.1" + has-tostringtag "^1.0.0" + +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + wordwrapjs@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/wordwrapjs/-/wordwrapjs-4.0.1.tgz#d9790bccfb110a0fc7836b5ebce0937b37a8b98f" @@ -3382,7 +5347,7 @@ yocto-queue@^1.0.0: resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.0.0.tgz#7f816433fb2cbc511ec8bf7d263c3b58a1a3c251" integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g== -zksync-web3@^0.13.0: - version "0.13.0" - resolved "https://registry.yarnpkg.com/zksync-web3/-/zksync-web3-0.13.0.tgz#979633eb507c8501185ebacbaa543e91c8ab423c" - integrity sha512-7E16RMVTi+6+AyjeRNn3e6CNbQ29UCoFO2osTjkPBgQjTortA0aqjrVAyAEi7o4g22Q2iLsPD2T7llUmTI8bBw== +zksync-web3@^0.14.3: + version "0.14.3" + resolved "https://registry.yarnpkg.com/zksync-web3/-/zksync-web3-0.14.3.tgz#64ac2a16d597464c3fc4ae07447a8007631c57c9" + integrity sha512-hT72th4AnqyLW1d5Jlv8N2B/qhEnl2NePK2A3org7tAa24niem/UAaHMkEvmWI3SF9waYUPtqAtjpf+yvQ9zvQ==