From 3b09fe9f7667f5a570ff4239fe00cdb31b2a7c53 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Thu, 24 Mar 2022 15:01:52 -0400 Subject: [PATCH 01/25] fix(rhc): typo in healthcheck docker-compose Fixes a typo in the primary docker-compose file. replica-healthcheck should be replica_healthcheck to conform with the style used everywhere else. --- .circleci/config.yml | 4 ++-- .github/workflows/integration.yml | 2 +- ops/docker-compose.yml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5fd78fe56ad82..aa108aa083340 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -224,7 +224,7 @@ jobs: command: yarn --frozen-lockfile - save_cache: key: v1-yarn-install-{{ checksum "yarn.lock" }} - paths: + paths: - node_modules - packages/common-ts/node_modules - packages/contracts/node_modules @@ -362,7 +362,7 @@ jobs: name: Bring up the stack command: | docker-compose build --progress=plain - docker-compose up -d --scale replica-healthcheck=1 + docker-compose up -d --scale replica_healthcheck=1 working_directory: ops - run: name: Wait for sequencer diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 5a6b4b8b6ec59..96b17ef59a2db 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -50,7 +50,7 @@ jobs: working-directory: ./ops run: | ./scripts/stats.sh & - docker-compose -f docker-compose.yml up -d --scale replica-healthcheck=1 + docker-compose -f docker-compose.yml up -d --scale replica_healthcheck=1 - name: Wait for the Sequencer node working-directory: ./ops diff --git a/ops/docker-compose.yml b/ops/docker-compose.yml index fe43db1ffecf2..4ba72ee5fc729 100644 --- a/ops/docker-compose.yml +++ b/ops/docker-compose.yml @@ -174,7 +174,7 @@ services: - ${REPLICA_HTTP_PORT:-8549}:8545 - ${REPLICA_WS_PORT:-8550}:8546 - replica-healthcheck: + replica_healthcheck: depends_on: - l2geth - replica @@ -203,7 +203,7 @@ services: environment: L1_URL: http://l1_chain:8545 L2_URL: http://l2geth:8545 - HEALTHCHECK_URL: http://replica-healthcheck:7300/metrics + HEALTHCHECK_URL: http://replica_healthcheck:7300/metrics REPLICA_URL: http://replica:8545 VERIFIER_URL: http://verifier:8545 URL: http://deployer:8081/addresses.json From 162ff89ca5aed00659b27833f919ee78d8841984 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Thu, 24 Mar 2022 19:07:31 -0400 Subject: [PATCH 02/25] fix(go): bug causing gas oracle to crash locally Fixes a bug in the gas oracle docker setup that caused the oracle to crash whenever it ran locally. Tweaks the ensureConnection function to check more regularly and properly manage retries. --- .changeset/lovely-weeks-hang.md | 5 +++++ go/gas-oracle/oracle/gas_price_oracle.go | 16 ++++++++++++---- ops/docker-compose.yml | 6 +++--- ops/docker/Dockerfile.gas-oracle | 1 - ops/scripts/gas-oracle.sh | 20 -------------------- 5 files changed, 20 insertions(+), 28 deletions(-) create mode 100644 .changeset/lovely-weeks-hang.md delete mode 100755 ops/scripts/gas-oracle.sh diff --git a/.changeset/lovely-weeks-hang.md b/.changeset/lovely-weeks-hang.md new file mode 100644 index 0000000000000..0d04a29c48d9f --- /dev/null +++ b/.changeset/lovely-weeks-hang.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/gas-oracle': patch +--- + +Fixes a bug that would cause the service to crash on startup if the RPC URLs were not immediately available diff --git a/go/gas-oracle/oracle/gas_price_oracle.go b/go/gas-oracle/oracle/gas_price_oracle.go index 68fa9a31eb2fb..d6faeb762fc42 100644 --- a/go/gas-oracle/oracle/gas_price_oracle.go +++ b/go/gas-oracle/oracle/gas_price_oracle.go @@ -187,11 +187,15 @@ func NewGasPriceOracle(cfg *Config) (*GasPriceOracle, error) { } // Ensure that we can actually connect to both backends + log.Info("Connecting to layer two") if err := ensureConnection(l2Client); err != nil { - log.Error("Unable to connect to layer two", "addr", cfg.layerTwoHttpUrl) + log.Error("Unable to connect to layer two") + return nil, err } + log.Info("Connecting to layer one") if err := ensureConnection(l1Client); err != nil { - log.Error("Unable to connect to layer one", "addr", cfg.ethereumHttpUrl) + log.Error("Unable to connect to layer one") + return nil, err } address := cfg.gasPriceOracleAddress @@ -315,14 +319,18 @@ func NewGasPriceOracle(cfg *Config) (*GasPriceOracle, error) { // Ensure that we can actually connect func ensureConnection(client *ethclient.Client) error { - t := time.NewTicker(5 * time.Second) + t := time.NewTicker(1 * time.Second) + retries := 0 defer t.Stop() for ; true; <-t.C { _, err := client.ChainID(context.Background()) if err == nil { break } else { - return err + retries += 1 + if retries > 90 { + return err + } } } return nil diff --git a/ops/docker-compose.yml b/ops/docker-compose.yml index fe43db1ffecf2..b0f093d7e7246 100644 --- a/ops/docker-compose.yml +++ b/ops/docker-compose.yml @@ -224,11 +224,11 @@ services: context: .. dockerfile: ./ops/docker/Dockerfile.gas-oracle image: ethereumoptimism/gas-oracle:${DOCKER_TAG_GAS_ORACLE:-latest} - entrypoint: ./gas-oracle.sh environment: - GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL: http://l2geth:8545 + GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL: http://l1_chain:8545 + GAS_PRICE_ORACLE_LAYER_TWO_HTTP_URL: http://l2geth:8545 # Default hardhat account 5 - GAS_PRICE_ORACLE_PRIVATE_KEY: '0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba' + GAS_PRICE_ORACLE_PRIVATE_KEY: "0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba" batch_submitter: depends_on: diff --git a/ops/docker/Dockerfile.gas-oracle b/ops/docker/Dockerfile.gas-oracle index 96b5a1fca00c8..8eb1e85c0b454 100644 --- a/ops/docker/Dockerfile.gas-oracle +++ b/ops/docker/Dockerfile.gas-oracle @@ -11,5 +11,4 @@ RUN apk add --no-cache ca-certificates jq curl COPY --from=builder /gas-oracle/gas-oracle /usr/local/bin/ WORKDIR /usr/local/bin/ -COPY ./ops/scripts/gas-oracle.sh . ENTRYPOINT ["gas-oracle"] diff --git a/ops/scripts/gas-oracle.sh b/ops/scripts/gas-oracle.sh deleted file mode 100755 index a8ed6c5d27fb0..0000000000000 --- a/ops/scripts/gas-oracle.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -RETRIES=${RETRIES:-40} - -if [[ -z $GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL ]]; then - echo "Must set env GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL" - exit 1 -fi - -# waits for l2geth to be up -curl --fail \ - --show-error \ - --silent \ - --retry-connrefused \ - --retry $RETRIES \ - --retry-delay 1 \ - --output /dev/null \ - $GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL - -exec gas-oracle "$@" From 847a63384cb5eb74a243a3703c2490f7354e5be1 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Fri, 4 Mar 2022 14:21:27 -0800 Subject: [PATCH 03/25] ops: bump hardhat version in docker hardhat-node --- .changeset/weak-walls-cross.md | 5 +++++ ops/docker/hardhat/hardhat.config.js | 7 ++++--- ops/docker/hardhat/package.json | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .changeset/weak-walls-cross.md diff --git a/.changeset/weak-walls-cross.md b/.changeset/weak-walls-cross.md new file mode 100644 index 0000000000000..b5bfc8db19bb7 --- /dev/null +++ b/.changeset/weak-walls-cross.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/hardhat-node': patch +--- + +Bump to hardhat@2.9.1 diff --git a/ops/docker/hardhat/hardhat.config.js b/ops/docker/hardhat/hardhat.config.js index 515318a09c2e0..354e316ea817b 100644 --- a/ops/docker/hardhat/hardhat.config.js +++ b/ops/docker/hardhat/hardhat.config.js @@ -1,13 +1,14 @@ const isForkModeEnabled = !!process.env.FORK_URL const forkUrl = process.env.FORK_URL -const forkStartingBlock = parseInt(process.env.FORK_STARTING_BLOCK) || undefined -const gasPrice = parseInt(process.env.GAS_PRICE) || 0 +const forkStartingBlock = + parseInt(process.env.FORK_STARTING_BLOCK, 10) || undefined +const gasPrice = parseInt(process.env.GAS_PRICE, 10) || 0 const config = { networks: { hardhat: { gasPrice, - initialBaseFeePerGas: 0 + initialBaseFeePerGas: 0, }, }, analytics: { enabled: false }, diff --git a/ops/docker/hardhat/package.json b/ops/docker/hardhat/package.json index c063a2ba9a381..ce5c45739028f 100644 --- a/ops/docker/hardhat/package.json +++ b/ops/docker/hardhat/package.json @@ -6,6 +6,6 @@ }, "license": "MIT", "dependencies": { - "hardhat": "^2.7.0" + "hardhat": "^2.9.2" } } From d9a51154c262e50f11add6eda248235096efd036 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Fri, 4 Mar 2022 14:23:50 -0800 Subject: [PATCH 04/25] packages: bump to hardhat@2.9.2 See release notes here: https://github.com/NomicFoundation/hardhat/releases/tag/hardhat%402.9.0 This is a performance release, so it is good to upgrade here to improve the time of CI. The compilation happens in parallel with this release, as well as tests being able to be ran in parallel. We do not make use of any forked network tests currently, but this PR does help to speed up that usecase as well. --- .changeset/twelve-shrimps-add.md | 9 + integration-tests/package.json | 2 +- packages/contracts/package.json | 2 +- packages/data-transport-layer/package.json | 2 +- packages/message-relayer/package.json | 2 +- packages/sdk/package.json | 2 +- yarn.lock | 349 ++++++++++++--------- 7 files changed, 220 insertions(+), 148 deletions(-) create mode 100644 .changeset/twelve-shrimps-add.md diff --git a/.changeset/twelve-shrimps-add.md b/.changeset/twelve-shrimps-add.md new file mode 100644 index 0000000000000..6a1331acb8ab2 --- /dev/null +++ b/.changeset/twelve-shrimps-add.md @@ -0,0 +1,9 @@ +--- +'@eth-optimism/contracts': patch +'@eth-optimism/data-transport-layer': patch +'@eth-optimism/integration-tests': patch +'@eth-optimism/message-relayer': patch +'@eth-optimism/sdk': patch +--- + +Bump to hardhat@2.9.1 diff --git a/integration-tests/package.json b/integration-tests/package.json index 126acc3b3e67c..77be4814db648 100644 --- a/integration-tests/package.json +++ b/integration-tests/package.json @@ -63,7 +63,7 @@ "eslint-plugin-unicorn": "^32.0.1", "ethereum-waffle": "^3.3.0", "ethers": "^5.5.4", - "hardhat": "^2.3.0", + "hardhat": "^2.9.2", "hardhat-gas-reporter": "^1.0.4", "lint-staged": "11.0.0", "mocha": "^8.4.0", diff --git a/packages/contracts/package.json b/packages/contracts/package.json index ecf8c0cfe5447..0c8b0d38d5051 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -97,7 +97,7 @@ "ethereum-waffle": "^3.3.0", "ethers": "^5.5.4", "glob": "^7.1.6", - "hardhat": "^2.3.0", + "hardhat": "^2.9.2", "hardhat-deploy": "^0.9.3", "hardhat-gas-reporter": "^1.0.4", "hardhat-output-validator": "^0.1.18", diff --git a/packages/data-transport-layer/package.json b/packages/data-transport-layer/package.json index 1343483a1e2db..5516964d6f63e 100644 --- a/packages/data-transport-layer/package.json +++ b/packages/data-transport-layer/package.json @@ -79,7 +79,7 @@ "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-react": "^7.24.0", "eslint-plugin-unicorn": "^32.0.1", - "hardhat": "^2.3.0", + "hardhat": "^2.9.2", "lint-staged": "11.0.0", "mocha": "^8.4.0", "pino-pretty": "^4.7.1", diff --git a/packages/message-relayer/package.json b/packages/message-relayer/package.json index 9838e7dc33b90..a7465313ef327 100644 --- a/packages/message-relayer/package.json +++ b/packages/message-relayer/package.json @@ -50,7 +50,7 @@ "eslint-plugin-react": "^7.24.0", "eslint-plugin-unicorn": "^32.0.1", "ethereum-waffle": "^3.3.0", - "hardhat": "^2.3.0", + "hardhat": "^2.9.2", "lint-staged": "11.0.0", "prettier": "^2.3.1", "ts-node": "^10.0.0", diff --git a/packages/sdk/package.json b/packages/sdk/package.json index f4ee27def52a0..8535d23e45d06 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -55,7 +55,7 @@ "eslint-plugin-unicorn": "^32.0.1", "ethereum-waffle": "^3.4.0", "ethers": "^5.5.4", - "hardhat": "^2.3.0", + "hardhat": "^2.9.2", "lint-staged": "11.0.0", "mocha": "^8.4.0", "nyc": "^15.1.0", diff --git a/yarn.lock b/yarn.lock index 2de3da757a90b..071118b3929db 100644 --- a/yarn.lock +++ b/yarn.lock @@ -550,29 +550,28 @@ patch-package "^6.2.2" postinstall-postinstall "^2.1.0" -"@ethereumjs/block@^3.4.0": - version "3.4.0" - resolved "https://registry.yarnpkg.com/@ethereumjs/block/-/block-3.4.0.tgz#4747b0c06220ee10cbdfe1cbde8cbb0677b1b074" - integrity sha512-umKAoTX32yXzErpIksPHodFc/5y8bmZMnOl6hWy5Vd8xId4+HKFUOyEiN16Y97zMwFRysRpcrR6wBejfqc6Bmg== +"@ethereumjs/block@^3.5.0", "@ethereumjs/block@^3.6.0", "@ethereumjs/block@^3.6.1": + version "3.6.1" + resolved "https://registry.yarnpkg.com/@ethereumjs/block/-/block-3.6.1.tgz#50574d3e993ae247dcfe2abbdb91d2a4a22accb9" + integrity sha512-o5d/zpGl4SdVfdTfrsq9ZgYMXddc0ucKMiFW5OphBCX+ep4xzYnSjboFcZXT2V/tcSBr84VrKWWp21CGVb3DGw== dependencies: - "@ethereumjs/common" "^2.4.0" - "@ethereumjs/tx" "^3.3.0" - ethereumjs-util "^7.1.0" - merkle-patricia-tree "^4.2.0" + "@ethereumjs/common" "^2.6.1" + "@ethereumjs/tx" "^3.5.0" + ethereumjs-util "^7.1.4" + merkle-patricia-tree "^4.2.3" -"@ethereumjs/blockchain@^5.4.0": - version "5.4.0" - resolved "https://registry.yarnpkg.com/@ethereumjs/blockchain/-/blockchain-5.4.0.tgz#28d712627d3442b2bb1f50dd5acba7cde1021993" - integrity sha512-wAuKLaew6PL52kH8YPXO7PbjjKV12jivRSyHQehkESw4slSLLfYA6Jv7n5YxyT2ajD7KNMPVh7oyF/MU6HcOvg== +"@ethereumjs/blockchain@^5.5.0", "@ethereumjs/blockchain@^5.5.1": + version "5.5.1" + resolved "https://registry.yarnpkg.com/@ethereumjs/blockchain/-/blockchain-5.5.1.tgz#60f1f50592c06cc47e1704800b88b7d32f609742" + integrity sha512-JS2jeKxl3tlaa5oXrZ8mGoVBCz6YqsGG350XVNtHAtNZXKk7pU3rH4xzF2ru42fksMMqzFLzKh9l4EQzmNWDqA== dependencies: - "@ethereumjs/block" "^3.4.0" - "@ethereumjs/common" "^2.4.0" - "@ethereumjs/ethash" "^1.0.0" + "@ethereumjs/block" "^3.6.0" + "@ethereumjs/common" "^2.6.0" + "@ethereumjs/ethash" "^1.1.0" debug "^2.2.0" - ethereumjs-util "^7.1.0" + ethereumjs-util "^7.1.3" level-mem "^5.0.1" lru-cache "^5.1.1" - rlp "^2.2.4" semaphore-async-await "^1.5.1" "@ethereumjs/common@^2.3.0", "@ethereumjs/common@^2.4.0": @@ -583,17 +582,26 @@ crc-32 "^1.2.0" ethereumjs-util "^7.1.0" -"@ethereumjs/ethash@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@ethereumjs/ethash/-/ethash-1.0.0.tgz#4e77f85b37be1ade5393e8719bdabac3e796ddaa" - integrity sha512-iIqnGG6NMKesyOxv2YctB2guOVX18qMAWlj3QlZyrc+GqfzLqoihti+cVNQnyNxr7eYuPdqwLQOFuPe6g/uKjw== +"@ethereumjs/common@^2.6.0", "@ethereumjs/common@^2.6.1", "@ethereumjs/common@^2.6.2": + version "2.6.2" + resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-2.6.2.tgz#eb006c9329c75c80f634f340dc1719a5258244df" + integrity sha512-vDwye5v0SVeuDky4MtKsu+ogkH2oFUV8pBKzH/eNBzT8oI91pKa8WyzDuYuxOQsgNgv5R34LfFDh2aaw3H4HbQ== dependencies: + crc-32 "^1.2.0" + ethereumjs-util "^7.1.4" + +"@ethereumjs/ethash@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@ethereumjs/ethash/-/ethash-1.1.0.tgz#7c5918ffcaa9cb9c1dc7d12f77ef038c11fb83fb" + integrity sha512-/U7UOKW6BzpA+Vt+kISAoeDie1vAvY4Zy2KF5JJb+So7+1yKmJeJEHOGSnQIj330e9Zyl3L5Nae6VZyh2TJnAA== + dependencies: + "@ethereumjs/block" "^3.5.0" "@types/levelup" "^4.3.0" buffer-xor "^2.0.1" - ethereumjs-util "^7.0.7" + ethereumjs-util "^7.1.1" miller-rabin "^4.0.0" -"@ethereumjs/tx@^3.2.1", "@ethereumjs/tx@^3.3.0": +"@ethereumjs/tx@^3.2.1": version "3.3.0" resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.3.0.tgz#14ed1b7fa0f28e1cd61e3ecbdab824205f6a4378" integrity sha512-yTwEj2lVzSMgE6Hjw9Oa1DZks/nKTWM8Wn4ykDNapBPua2f4nXO3qKnni86O6lgDj5fVNRqbDsD0yy7/XNGDEA== @@ -601,24 +609,31 @@ "@ethereumjs/common" "^2.4.0" ethereumjs-util "^7.1.0" -"@ethereumjs/vm@^5.5.2": - version "5.5.2" - resolved "https://registry.yarnpkg.com/@ethereumjs/vm/-/vm-5.5.2.tgz#918a2c1000aaa9fdbe6007a4fdc2c62833122adf" - integrity sha512-AydZ4wfvZAsBuFzs3xVSA2iU0hxhL8anXco3UW3oh9maVC34kTEytOfjHf06LTEfN0MF9LDQ4ciLa7If6ZN/sg== +"@ethereumjs/tx@^3.4.0", "@ethereumjs/tx@^3.5.0": + version "3.5.0" + resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.5.0.tgz#783b0aeb08518b9991b23f5155763bbaf930a037" + integrity sha512-/+ZNbnJhQhXC83Xuvy6I9k4jT5sXiV0tMR9C+AzSSpcCV64+NB8dTE1m3x98RYMqb8+TLYWA+HML4F5lfXTlJw== dependencies: - "@ethereumjs/block" "^3.4.0" - "@ethereumjs/blockchain" "^5.4.0" - "@ethereumjs/common" "^2.4.0" - "@ethereumjs/tx" "^3.3.0" + "@ethereumjs/common" "^2.6.1" + ethereumjs-util "^7.1.4" + +"@ethereumjs/vm@^5.6.0": + version "5.7.1" + resolved "https://registry.yarnpkg.com/@ethereumjs/vm/-/vm-5.7.1.tgz#3bf757fbad0081838ccb4f22003cd73319ab3616" + integrity sha512-NiFm5FMaeDGZ9ojBL+Y9Y/xhW6S4Fgez+zPBM402T5kLsfeAR9mrRVckYhvkGVJ6FMwsY820CLjYP5OVwMjLTg== + dependencies: + "@ethereumjs/block" "^3.6.1" + "@ethereumjs/blockchain" "^5.5.1" + "@ethereumjs/common" "^2.6.2" + "@ethereumjs/tx" "^3.5.0" async-eventemitter "^0.2.4" core-js-pure "^3.0.1" - debug "^2.2.0" - ethereumjs-util "^7.1.0" + debug "^4.3.3" + ethereumjs-util "^7.1.4" functional-red-black-tree "^1.0.1" mcl-wasm "^0.7.1" - merkle-patricia-tree "^4.2.0" + merkle-patricia-tree "^4.2.3" rustbn.js "~0.2.0" - util.promisify "^1.0.1" "@ethersproject/abi@5.0.0-beta.153": version "5.0.0-beta.153" @@ -2221,6 +2236,17 @@ globby "^11.0.0" read-yaml-file "^1.1.0" +"@metamask/eth-sig-util@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@metamask/eth-sig-util/-/eth-sig-util-4.0.0.tgz#11553ba06de0d1352332c1bde28c8edd00e0dcf6" + integrity sha512-LczOjjxY4A7XYloxzyxJIHONELmUxVZncpOLoClpEcTiebiVdM46KRPYXGuULro9oNNR2xdVx3yoKiQjdfWmoA== + dependencies: + ethereumjs-abi "^0.6.8" + ethereumjs-util "^6.2.1" + ethjs-util "^0.1.6" + tweetnacl "^1.0.3" + tweetnacl-util "^0.15.1" + "@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" @@ -2681,11 +2707,6 @@ dependencies: "@sinonjs/commons" "^1.7.0" -"@solidity-parser/parser@^0.11.0": - version "0.11.1" - resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.11.1.tgz#fa840af64840c930f24a9c82c08d4a092a068add" - integrity sha512-H8BSBoKE8EubJa0ONqecA2TviT3TnHeC4NpgnAHSUiuhZoQBfPB4L2P9bs8R6AoTW10Endvh3vc+fomVMIDIYQ== - "@solidity-parser/parser@^0.12.0": version "0.12.2" resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.12.2.tgz#1afad367cb29a2ed8cdd4a3a62701c2821fb578f" @@ -2698,10 +2719,10 @@ dependencies: antlr4ts "^0.5.0-alpha.4" -"@solidity-parser/parser@^0.14.0": - version "0.14.0" - resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.14.0.tgz#d51f074efb0acce0e953ec48133561ed710cebc0" - integrity sha512-cX0JJRcmPtNUJpzD2K7FdA7qQsTOk1UZnFx2k7qAg9ZRvuaH5NBe5IEdBMXGlmf2+FmjhqbygJ26H8l2SV7aKQ== +"@solidity-parser/parser@^0.14.1": + version "0.14.1" + resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.14.1.tgz#179afb29f4e295a77cc141151f26b3848abc3c46" + integrity sha512-eLjj2L6AuQjBB6s/ibwCAc0DwrR5Ge+ys+wgWo+bviU7fV2nTMQhU63CGaDKXg9iTmMxwhkyoggdIR7ZGRfMgw== dependencies: antlr4ts "^0.5.0-alpha.4" @@ -5058,6 +5079,21 @@ chokidar@3.5.1: optionalDependencies: fsevents "~2.3.1" +chokidar@3.5.3: + version "3.5.3" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" + integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== + dependencies: + anymatch "~3.1.2" + braces "~3.0.2" + glob-parent "~5.1.2" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.6.0" + optionalDependencies: + fsevents "~2.3.2" + chokidar@^3.4.0, chokidar@^3.4.3, chokidar@^3.5.2: version "3.5.2" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.2.tgz#dba3976fcadb016f66fd365021d91600d01c1e75" @@ -5833,6 +5869,13 @@ debug@4.3.1: dependencies: ms "2.1.2" +debug@4.3.3, debug@^4.3.3: + version "4.3.3" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.3.tgz#04266e0b70a98d4462e6e288e38259213332b664" + integrity sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q== + dependencies: + ms "2.1.2" + debug@^3.1.0, debug@^3.2.7: version "3.2.7" resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a" @@ -6858,16 +6901,6 @@ eth-sig-util@^1.4.2: ethereumjs-abi "git+https://github.com/ethereumjs/ethereumjs-abi.git" ethereumjs-util "^5.1.1" -eth-sig-util@^2.5.2: - version "2.5.4" - resolved "https://registry.yarnpkg.com/eth-sig-util/-/eth-sig-util-2.5.4.tgz#577b01fe491b6bf59b0464be09633e20c1677bc5" - integrity sha512-aCMBwp8q/4wrW4QLsF/HYBOSA7TpLKmkVwP3pYQNkEEseW2Rr8Z5Uxc9/h6HX+OG3tuHo+2bINVSihIeBfym6A== - dependencies: - ethereumjs-abi "0.6.8" - ethereumjs-util "^5.1.1" - tweetnacl "^1.0.3" - tweetnacl-util "^0.15.0" - eth-tx-summary@^3.1.2: version "3.2.4" resolved "https://registry.yarnpkg.com/eth-tx-summary/-/eth-tx-summary-3.2.4.tgz#e10eb95eb57cdfe549bf29f97f1e4f1db679035c" @@ -7061,7 +7094,7 @@ ethereumjs-util@6.2.0: rlp "^2.2.3" secp256k1 "^3.0.1" -ethereumjs-util@6.2.1, ethereumjs-util@^6.0.0, ethereumjs-util@^6.1.0, ethereumjs-util@^6.2.0: +ethereumjs-util@6.2.1, ethereumjs-util@^6.0.0, ethereumjs-util@^6.1.0, ethereumjs-util@^6.2.0, ethereumjs-util@^6.2.1: version "6.2.1" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-6.2.1.tgz#fcb4e4dd5ceacb9d2305426ab1a5cd93e3163b69" integrity sha512-W2Ktez4L01Vexijrm5EB6w7dg4n/TgpoYU4avuT5T3Vmnw/eCRtiBrJfQYS/DCSvDIOLn2k57GcHdeBcgVxAqw== @@ -7098,7 +7131,7 @@ ethereumjs-util@^5.0.0, ethereumjs-util@^5.0.1, ethereumjs-util@^5.1.1, ethereum rlp "^2.0.0" safe-buffer "^5.1.1" -ethereumjs-util@^7.0.10, ethereumjs-util@^7.0.2, ethereumjs-util@^7.0.7, ethereumjs-util@^7.1.0: +ethereumjs-util@^7.0.10, ethereumjs-util@^7.0.2, ethereumjs-util@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.0.tgz#e2b43a30bfcdbcb432a4eb42bd5f2393209b3fd5" integrity sha512-kR+vhu++mUDARrsMMhsjjzPduRVAeundLGXucGRHF3B4oEltOUspfgCVco4kckucj3FMlLaZHUl9n7/kdmr6Tw== @@ -7110,6 +7143,17 @@ ethereumjs-util@^7.0.10, ethereumjs-util@^7.0.2, ethereumjs-util@^7.0.7, ethereu ethjs-util "0.1.6" rlp "^2.2.4" +ethereumjs-util@^7.1.1, ethereumjs-util@^7.1.3, ethereumjs-util@^7.1.4: + version "7.1.4" + resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.4.tgz#a6885bcdd92045b06f596c7626c3e89ab3312458" + integrity sha512-p6KmuPCX4mZIqsQzXfmSx9Y0l2hqf+VkAiwSisW3UKUFdk8ZkAt+AYaor83z2nSi6CU2zSsXMlD80hAbNEGM0A== + dependencies: + "@types/bn.js" "^5.1.0" + bn.js "^5.1.2" + create-hash "^1.1.2" + ethereum-cryptography "^0.1.3" + rlp "^2.2.4" + ethereumjs-vm@4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/ethereumjs-vm/-/ethereumjs-vm-4.2.0.tgz#e885e861424e373dbc556278f7259ff3fca5edab" @@ -7258,7 +7302,7 @@ ethjs-unit@0.1.6: bn.js "4.11.6" number-to-bn "1.7.0" -ethjs-util@0.1.6, ethjs-util@^0.1.3: +ethjs-util@0.1.6, ethjs-util@^0.1.3, ethjs-util@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/ethjs-util/-/ethjs-util-0.1.6.tgz#f308b62f185f9fe6237132fb2a9818866a5cd536" integrity sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w== @@ -8198,6 +8242,18 @@ glob@7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" +glob@7.2.0, glob@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" + integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + glob@^5.0.15: version "5.0.15" resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1" @@ -8221,18 +8277,6 @@ glob@^7.0.0, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, gl once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.2.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" - integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^3.0.4" - once "^1.3.0" - path-is-absolute "^1.0.0" - global-modules@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/global-modules/-/global-modules-2.0.0.tgz#997605ad2345f27f51539bea26574421215c7780" @@ -8431,76 +8475,25 @@ hardhat-watcher@^2.1.1: dependencies: chokidar "^3.4.3" -hardhat@^2.3.0: - version "2.6.1" - resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.6.1.tgz#4553ca555c1ba8ed7c3c5a5a93e6082a2869b3ae" - integrity sha512-0LozdYbPsiTc6ZXsfDQUTV3L0p4CMO5TRbd5qmeWiCYGmhd+7Mvdg4N+nA8w0g3gZ2OKFUmHIYlAbExI488ceQ== - dependencies: - "@ethereumjs/block" "^3.4.0" - "@ethereumjs/blockchain" "^5.4.0" - "@ethereumjs/common" "^2.4.0" - "@ethereumjs/tx" "^3.3.0" - "@ethereumjs/vm" "^5.5.2" - "@ethersproject/abi" "^5.1.2" - "@sentry/node" "^5.18.1" - "@solidity-parser/parser" "^0.11.0" - "@types/bn.js" "^5.1.0" - "@types/lru-cache" "^5.1.0" - abort-controller "^3.0.0" - adm-zip "^0.4.16" - ansi-escapes "^4.3.0" - chalk "^2.4.2" - chokidar "^3.4.0" - ci-info "^2.0.0" - debug "^4.1.1" - enquirer "^2.3.0" - env-paths "^2.2.0" - eth-sig-util "^2.5.2" - ethereum-cryptography "^0.1.2" - ethereumjs-abi "^0.6.8" - ethereumjs-util "^7.1.0" - find-up "^2.1.0" - fp-ts "1.19.3" - fs-extra "^7.0.1" - glob "^7.1.3" - https-proxy-agent "^5.0.0" - immutable "^4.0.0-rc.12" - io-ts "1.10.4" - lodash "^4.17.11" - merkle-patricia-tree "^4.2.0" - mnemonist "^0.38.0" - mocha "^7.1.2" - node-fetch "^2.6.0" - qs "^6.7.0" - raw-body "^2.4.1" - resolve "1.17.0" - semver "^6.3.0" - slash "^3.0.0" - solc "0.7.3" - source-map-support "^0.5.13" - stacktrace-parser "^0.1.10" - "true-case-path" "^2.2.1" - tsort "0.0.1" - uuid "^3.3.2" - ws "^7.4.6" - -hardhat@^2.7.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.7.0.tgz#d8f01bc07bdd88ccaa00719ddb18618bc59a73b5" - integrity sha512-DqweY3KH5gwExoZ8EtsAfioj0Hk0NBXWXT3fMXWkiQNfyYBoZLrqdPNkbJ/E2LD4mZ+BKF7v/1chYR9ZCn2Z+g== +hardhat@^2.9.2: + version "2.9.2" + resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.9.2.tgz#123f3fed6810ef8637b127b73ca44bb9c9efc249" + integrity sha512-elTcUK1EdFverWinybQ+DoJzsM6sgiHUYs0ZYNNXMfESty6ESHiFSwkfJsC88/q09vmIz6YVaMh73BYnYd+feQ== dependencies: - "@ethereumjs/block" "^3.4.0" - "@ethereumjs/blockchain" "^5.4.0" - "@ethereumjs/common" "^2.4.0" - "@ethereumjs/tx" "^3.3.0" - "@ethereumjs/vm" "^5.5.2" + "@ethereumjs/block" "^3.6.0" + "@ethereumjs/blockchain" "^5.5.0" + "@ethereumjs/common" "^2.6.0" + "@ethereumjs/tx" "^3.4.0" + "@ethereumjs/vm" "^5.6.0" "@ethersproject/abi" "^5.1.2" + "@metamask/eth-sig-util" "^4.0.0" "@sentry/node" "^5.18.1" - "@solidity-parser/parser" "^0.14.0" + "@solidity-parser/parser" "^0.14.1" "@types/bn.js" "^5.1.0" "@types/lru-cache" "^5.1.0" abort-controller "^3.0.0" adm-zip "^0.4.16" + aggregate-error "^3.0.0" ansi-escapes "^4.3.0" chalk "^2.4.2" chokidar "^3.4.0" @@ -8508,22 +8501,20 @@ hardhat@^2.7.0: debug "^4.1.1" enquirer "^2.3.0" env-paths "^2.2.0" - eth-sig-util "^2.5.2" ethereum-cryptography "^0.1.2" ethereumjs-abi "^0.6.8" - ethereumjs-util "^7.1.0" + ethereumjs-util "^7.1.3" find-up "^2.1.0" fp-ts "1.19.3" fs-extra "^7.0.1" glob "^7.1.3" - https-proxy-agent "^5.0.0" immutable "^4.0.0-rc.12" io-ts "1.10.4" lodash "^4.17.11" - merkle-patricia-tree "^4.2.0" + merkle-patricia-tree "^4.2.2" mnemonist "^0.38.0" - mocha "^7.1.2" - node-fetch "^2.6.0" + mocha "^9.2.0" + p-map "^4.0.0" qs "^6.7.0" raw-body "^2.4.1" resolve "1.17.0" @@ -8534,6 +8525,7 @@ hardhat@^2.7.0: stacktrace-parser "^0.1.10" "true-case-path" "^2.2.1" tsort "0.0.1" + undici "^4.14.1" uuid "^8.3.2" ws "^7.4.6" @@ -9593,6 +9585,13 @@ js-yaml@4.0.0: dependencies: argparse "^2.0.1" +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" + jsbi@^3.1.4: version "3.2.5" resolved "https://registry.yarnpkg.com/jsbi/-/jsbi-3.2.5.tgz#b37bb90e0e5c2814c1c2a1bcd8c729888a2e37d6" @@ -10348,7 +10347,7 @@ log-symbols@4.0.0: dependencies: chalk "^4.0.0" -log-symbols@^4.1.0: +log-symbols@4.1.0, log-symbols@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== @@ -10730,7 +10729,7 @@ merkle-patricia-tree@^2.1.2, merkle-patricia-tree@^2.3.2: rlp "^2.0.0" semaphore ">=1.0.1" -merkle-patricia-tree@^4.0.0, merkle-patricia-tree@^4.2.0: +merkle-patricia-tree@^4.0.0: version "4.2.1" resolved "https://registry.yarnpkg.com/merkle-patricia-tree/-/merkle-patricia-tree-4.2.1.tgz#fc43e7b162e597a0720ccdd702bf1d49765691d2" integrity sha512-25reMgrT8PhJy0Ba0U7fMZD2oobS1FPWB9vQa0uBpJYIQYYuFXEHoqEkTqA/UzX+s9br3pmUVVY/TOsFt/x0oQ== @@ -10743,6 +10742,18 @@ merkle-patricia-tree@^4.0.0, merkle-patricia-tree@^4.2.0: rlp "^2.2.4" semaphore-async-await "^1.5.1" +merkle-patricia-tree@^4.2.2, merkle-patricia-tree@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/merkle-patricia-tree/-/merkle-patricia-tree-4.2.3.tgz#b4e5d485d231f02b255ed79a7852f9d12ee0c09f" + integrity sha512-S4xevdXl5KvdBGgUxhQcxoep0onqXiIhzfwZp4M78kIuJH3Pu9o9IUgqhzSFOR2ykLO6t265026Xb6PY0q2UFQ== + dependencies: + "@types/levelup" "^4.3.0" + ethereumjs-util "^7.1.4" + level-mem "^5.0.1" + level-ws "^2.0.0" + readable-stream "^3.6.0" + semaphore-async-await "^1.5.1" + merkletreejs@^0.2.18: version "0.2.24" resolved "https://registry.yarnpkg.com/merkletreejs/-/merkletreejs-0.2.24.tgz#6dc52b3e0946846c25816216f1b60094a18a5e7a" @@ -11027,7 +11038,7 @@ mnemonist@^0.38.0: dependencies: obliterator "^1.6.1" -mocha@^7.1.1, mocha@^7.1.2: +mocha@^7.1.1: version "7.2.0" resolved "https://registry.yarnpkg.com/mocha/-/mocha-7.2.0.tgz#01cc227b00d875ab1eed03a75106689cfed5a604" integrity sha512-O9CIypScywTVpNaRrCAgoUnJgozpIofjKUYmJhiCIJMiuYnLI6otcb1/kpW9/n/tJODHGZ7i8aLQoDVsMtOKQQ== @@ -11088,6 +11099,36 @@ mocha@^8.4.0: yargs-parser "20.2.4" yargs-unparser "2.0.0" +mocha@^9.2.0: + version "9.2.1" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-9.2.1.tgz#a1abb675aa9a8490798503af57e8782a78f1338e" + integrity sha512-T7uscqjJVS46Pq1XDXyo9Uvey9gd3huT/DD9cYBb4K2Xc/vbKRPUWK067bxDQRK0yIz6Jxk73IrnimvASzBNAQ== + dependencies: + "@ungap/promise-all-settled" "1.1.2" + ansi-colors "4.1.1" + browser-stdout "1.3.1" + chokidar "3.5.3" + debug "4.3.3" + diff "5.0.0" + escape-string-regexp "4.0.0" + find-up "5.0.0" + glob "7.2.0" + growl "1.10.5" + he "1.2.0" + js-yaml "4.1.0" + log-symbols "4.1.0" + minimatch "3.0.4" + ms "2.1.3" + nanoid "3.2.0" + serialize-javascript "6.0.0" + strip-json-comments "3.1.1" + supports-color "8.1.1" + which "2.0.2" + workerpool "6.2.0" + yargs "16.2.0" + yargs-parser "20.2.4" + yargs-unparser "2.0.0" + mock-fs@^4.1.0: version "4.14.0" resolved "https://registry.yarnpkg.com/mock-fs/-/mock-fs-4.14.0.tgz#ce5124d2c601421255985e6e94da80a7357b1b18" @@ -11213,6 +11254,11 @@ nanoid@3.1.20: resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.20.tgz#badc263c6b1dcf14b71efaa85f6ab4c1d6cfc788" integrity sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw== +nanoid@3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.2.0.tgz#62667522da6673971cca916a6d3eff3f415ff80c" + integrity sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA== + nanomatch@^1.2.9: version "1.2.13" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" @@ -13605,6 +13651,13 @@ serialize-javascript@5.0.1: dependencies: randombytes "^2.1.0" +serialize-javascript@6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" + integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== + dependencies: + randombytes "^2.1.0" + serve-static@1.14.1: version "1.14.1" resolved "https://registry.yarnpkg.com/serve-static/-/serve-static-1.14.1.tgz#666e636dc4f010f7ef29970a88a674320898b2f9" @@ -15031,7 +15084,7 @@ tunnel-agent@^0.6.0: dependencies: safe-buffer "^5.0.1" -tweetnacl-util@^0.15.0: +tweetnacl-util@^0.15.0, tweetnacl-util@^0.15.1: version "0.15.1" resolved "https://registry.yarnpkg.com/tweetnacl-util/-/tweetnacl-util-0.15.1.tgz#b80fcdb5c97bcc508be18c44a4be50f022eea00b" integrity sha512-RKJBIj8lySrShN4w6i/BonWp2Z/uxwC3h4y7xsRrpP59ZboCd0GpEVsOnMDYLMmKBpYhb5TgHzZXy7wTfYFBRw== @@ -15242,6 +15295,11 @@ underscore@1.9.1: resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.9.1.tgz#06dce34a0e68a7babc29b365b8e74b8925203961" integrity sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg== +undici@^4.14.1: + version "4.15.0" + resolved "https://registry.yarnpkg.com/undici/-/undici-4.15.0.tgz#507ec94bce46bec5c76e934938c50b825eda8258" + integrity sha512-kHppwh/y49FLEXl/zYCCbGB0D3nrcWNBczNYCsDdNYzWPs80aQgfKic1PVkJEIc2YlR7m0Lf5i559zbr0AA7FQ== + union-value@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" @@ -15410,7 +15468,7 @@ util-promisify@^2.1.0: dependencies: object.getownpropertydescriptors "^2.0.3" -util.promisify@^1.0.0, util.promisify@^1.0.1: +util.promisify@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.1.1.tgz#77832f57ced2c9478174149cae9b96e9918cd54b" integrity sha512-/s3UsZUrIfa6xDhr7zZhnE9SLQ5RIXyYfiVnMMyMDzOc8WhWN4Nbh36H842OyurKbCDAesZOJaVyvmSl6fhGQw== @@ -16158,6 +16216,11 @@ workerpool@6.1.0: resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.1.0.tgz#a8e038b4c94569596852de7a8ea4228eefdeb37b" integrity sha512-toV7q9rWNYha963Pl/qyeZ6wG+3nnsyvolaNUS8+R5Wtw6qJPTxIlOP1ZSvcGhEJw+l3HMMmtiNo9Gl61G4GVg== +workerpool@6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.0.tgz#827d93c9ba23ee2019c3ffaff5c27fccea289e8b" + integrity sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A== + wrap-ansi@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" From 7dc5bff48dd9e2d091fbd04b8e4675c1149a5214 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 9 Mar 2022 22:18:00 -0500 Subject: [PATCH 05/25] fix(ct): bug in GasPriceOracle test Fixes a bug in the GasPriceOracle test suite that seems to only have had an impact because hardhat got significantly faster between the current iteration and the older one. --- .../test/contracts/L2/predeploys/OVM_GasPriceOracle.spec.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/contracts/test/contracts/L2/predeploys/OVM_GasPriceOracle.spec.ts b/packages/contracts/test/contracts/L2/predeploys/OVM_GasPriceOracle.spec.ts index f13b6217256bb..2a0c3422c2cad 100644 --- a/packages/contracts/test/contracts/L2/predeploys/OVM_GasPriceOracle.spec.ts +++ b/packages/contracts/test/contracts/L2/predeploys/OVM_GasPriceOracle.spec.ts @@ -26,9 +26,9 @@ describe('OVM_GasPriceOracle', () => { await signer1.getAddress() ) - OVM_GasPriceOracle.setOverhead(2750) - OVM_GasPriceOracle.setScalar(1500000) - OVM_GasPriceOracle.setDecimals(6) + await OVM_GasPriceOracle.setOverhead(2750) + await OVM_GasPriceOracle.setScalar(1500000) + await OVM_GasPriceOracle.setDecimals(6) }) describe('owner', () => { From b6d8a0ce3f15d7960ffef7a89a84ee3d066175c7 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Fri, 25 Mar 2022 11:08:22 -0400 Subject: [PATCH 06/25] feat(ct): run tests in parallel Adds parallel test execution to contracts to speed things up a bit. --- packages/contracts/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/contracts/package.json b/packages/contracts/package.json index 386718b3dbfcb..b018f8c2beb12 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -23,7 +23,7 @@ "autogen:markdown": "ts-node scripts/generate-markdown.ts", "autogen:artifacts": "ts-node scripts/generate-artifacts.ts && ts-node scripts/generate-deployed-artifacts.ts", "test": "yarn test:contracts", - "test:contracts": "hardhat test --show-stack-traces", + "test:contracts": "hardhat test --show-stack-traces --parallel", "test:coverage": "NODE_OPTIONS=--max_old_space_size=8192 hardhat coverage && istanbul check-coverage --statements 90 --branches 84 --functions 88 --lines 90", "test:slither": "slither .", "pretest:slither": "rm -f @openzeppelin && rm -f @ens && rm -f hardhat && ln -s ../../node_modules/@openzeppelin @openzeppelin && ln -s ../../node_modules/@ens @ens && ln -s ../../node_modules/hardhat hardhat", From 51673b90bf33ab10f1fa389a81a83ba2cf9eea12 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Fri, 25 Mar 2022 11:02:47 -0400 Subject: [PATCH 07/25] fix(cmn): have BaseService throw on missing options Fixes a bug where BaseServiceV2 was not properly throwing when options were missing. --- .changeset/sharp-terms-pay.md | 5 +++++ packages/common-ts/src/base-service/base-service-v2.ts | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100644 .changeset/sharp-terms-pay.md diff --git a/.changeset/sharp-terms-pay.md b/.changeset/sharp-terms-pay.md new file mode 100644 index 0000000000000..249af5b617971 --- /dev/null +++ b/.changeset/sharp-terms-pay.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/common-ts': patch +--- + +Have BaseServiceV2 throw when options are undefined diff --git a/packages/common-ts/src/base-service/base-service-v2.ts b/packages/common-ts/src/base-service/base-service-v2.ts index 17b7b1cad7288..1041196a3fd21 100644 --- a/packages/common-ts/src/base-service/base-service-v2.ts +++ b/packages/common-ts/src/base-service/base-service-v2.ts @@ -218,6 +218,16 @@ export abstract class BaseServiceV2< return acc }, {}) as TOptions + // Make sure all options are defined. + for (const [optionName, optionSpec] of Object.entries(params.optionsSpec)) { + if ( + optionSpec.default === undefined && + this.options[optionName] === undefined + ) { + throw new Error(`missing required option: ${optionName}`) + } + } + // Create the metrics objects. this.metrics = Object.keys(params.metricsSpec || {}).reduce((acc, key) => { const spec = params.metricsSpec[key] From 4fba3fd2eb5fe926b9ce32a4f4a5da931310d98e Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Fri, 25 Mar 2022 12:07:23 -0400 Subject: [PATCH 08/25] fix(infra): use older version of hc by default Updates replica.yml in our infra folder to use an older version of the healthcheck service by default. We'll use latest when we update our environment variables everywhere later. --- infra/op-replica/docker-compose/replica.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/infra/op-replica/docker-compose/replica.yml b/infra/op-replica/docker-compose/replica.yml index 15ccbdfe2ec2e..c794633e55551 100644 --- a/infra/op-replica/docker-compose/replica.yml +++ b/infra/op-replica/docker-compose/replica.yml @@ -34,7 +34,8 @@ services: - ../scripts/:/scripts/ <<: *logging replica-healthcheck: - image: ethereumoptimism/replica-healthcheck:${HC_IMAGE_TAG:-latest} + # TODO: Update this to latest when we fix the environment variables + image: ethereumoptimism/replica-healthcheck:${HC_IMAGE_TAG:-0.3.11} restart: ${RESTART} env_file: - ${SHARED_ENV_PATH}/replica-healthcheck.env From 6926b29307b9b8e6baba757a436ce0c37ec4f9a7 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Fri, 25 Mar 2022 14:45:25 -0400 Subject: [PATCH 09/25] feat(l2geth): add configurable genesis timeout Adds a configurable timeout for fetching the genesis file when running l2Geth. Useful for people who want to run a node on slower internet and need more than 60 seconds to fetch the genesis file. --- .changeset/tiny-melons-float.md | 5 +++++ l2geth/cmd/geth/chaincmd.go | 9 +++++---- l2geth/cmd/geth/main.go | 1 + l2geth/cmd/geth/usage.go | 1 + l2geth/cmd/utils/flags.go | 6 ++++++ packages/contracts/package.json | 2 +- 6 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 .changeset/tiny-melons-float.md diff --git a/.changeset/tiny-melons-float.md b/.changeset/tiny-melons-float.md new file mode 100644 index 0000000000000..bd1b9bef643ca --- /dev/null +++ b/.changeset/tiny-melons-float.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Adds a flag for changing the genesis fetch timeout diff --git a/l2geth/cmd/geth/chaincmd.go b/l2geth/cmd/geth/chaincmd.go index b0fdd262fc14a..d44f201323217 100644 --- a/l2geth/cmd/geth/chaincmd.go +++ b/l2geth/cmd/geth/chaincmd.go @@ -56,6 +56,7 @@ var ( ArgsUsage: " ()", Flags: []cli.Flag{ utils.DataDirFlag, + utils.RollupGenesisTimeoutSecondsFlag, }, Category: "BLOCKCHAIN COMMANDS", Description: ` @@ -65,7 +66,7 @@ participating. It expects either a path or an HTTP URL to the genesis file as an argument. If an HTTP URL is specified for the genesis file, then a hex-encoded SHA256 hash of the -genesis file must be included as a second argument. The hash provided on the CLI +genesis file must be included as a second argument. The hash provided on the CLI will be checked against the hash of the genesis file downloaded from the URL.`, } dumpChainCfgCommand = cli.Command{ @@ -236,7 +237,7 @@ func initGenesis(ctx *cli.Context) error { log.Info("Fetching genesis file", "url", genesisPathOrURL) - genesisData, err := fetchGenesis(genesisPathOrURL) + genesisData, err := fetchGenesis(genesisPathOrURL, time.Duration(ctx.GlobalInt(utils.RollupGenesisTimeoutSecondsFlag.Name))) if err != nil { utils.Fatalf("Failed to fetch genesis file: %v", err) } @@ -640,9 +641,9 @@ func hashish(x string) bool { return err != nil } -func fetchGenesis(url string) ([]byte, error) { +func fetchGenesis(url string, timeout time.Duration) ([]byte, error) { client := &http.Client{ - Timeout: 60 * time.Second, + Timeout: timeout, } resp, err := client.Get(url) if err != nil { diff --git a/l2geth/cmd/geth/main.go b/l2geth/cmd/geth/main.go index c38bc1163ec24..5c2f1ad4b7b0c 100644 --- a/l2geth/cmd/geth/main.go +++ b/l2geth/cmd/geth/main.go @@ -163,6 +163,7 @@ var ( utils.RollupEnforceFeesFlag, utils.RollupFeeThresholdDownFlag, utils.RollupFeeThresholdUpFlag, + utils.RollupGenesisTimeoutSecondsFlag, utils.SequencerClientHttpFlag, utils.TxPublisherEnableFlag, utils.TxPublisherProjectIDFlag, diff --git a/l2geth/cmd/geth/usage.go b/l2geth/cmd/geth/usage.go index 115e1ea43134d..a71c3b8995069 100644 --- a/l2geth/cmd/geth/usage.go +++ b/l2geth/cmd/geth/usage.go @@ -77,6 +77,7 @@ var AppHelpFlagGroups = []flagGroup{ utils.RollupEnforceFeesFlag, utils.RollupFeeThresholdDownFlag, utils.RollupFeeThresholdUpFlag, + utils.RollupGenesisTimeoutSecondsFlag, utils.SequencerClientHttpFlag, utils.TxPublisherEnableFlag, utils.TxPublisherProjectIDFlag, diff --git a/l2geth/cmd/utils/flags.go b/l2geth/cmd/utils/flags.go index 6cdea5412daf2..8af3d2b5e62cc 100644 --- a/l2geth/cmd/utils/flags.go +++ b/l2geth/cmd/utils/flags.go @@ -862,6 +862,12 @@ var ( Usage: "Allow txs with fees above the current fee up to this amount, must be > 1", EnvVar: "ROLLUP_FEE_THRESHOLD_UP", } + RollupGenesisTimeoutSecondsFlag = cli.DurationFlag{ + Name: "rollup.genesistimeoutseconds", + Usage: "Timeout for the genesis file to be fetched", + Value: time.Second * 60, + EnvVar: "ROLLUP_GENESIS_TIMEOUT_SECONDS", + } SequencerClientHttpFlag = cli.StringFlag{ Name: "sequencer.clienthttp", Usage: "HTTP endpoint for the sequencer client", diff --git a/packages/contracts/package.json b/packages/contracts/package.json index b018f8c2beb12..386718b3dbfcb 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -23,7 +23,7 @@ "autogen:markdown": "ts-node scripts/generate-markdown.ts", "autogen:artifacts": "ts-node scripts/generate-artifacts.ts && ts-node scripts/generate-deployed-artifacts.ts", "test": "yarn test:contracts", - "test:contracts": "hardhat test --show-stack-traces --parallel", + "test:contracts": "hardhat test --show-stack-traces", "test:coverage": "NODE_OPTIONS=--max_old_space_size=8192 hardhat coverage && istanbul check-coverage --statements 90 --branches 84 --functions 88 --lines 90", "test:slither": "slither .", "pretest:slither": "rm -f @openzeppelin && rm -f @ens && rm -f hardhat && ln -s ../../node_modules/@openzeppelin @openzeppelin && ln -s ../../node_modules/@ens @ens && ln -s ../../node_modules/hardhat hardhat", From 8d82fa3824ae16b38d9ddcf4948e30cb254f6c22 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Fri, 25 Mar 2022 11:18:59 -0400 Subject: [PATCH 10/25] feat(itests): run external tests once per day Runs the external SNX tests once per day. --- .github/workflows/ext-test-snx.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ext-test-snx.yml b/.github/workflows/ext-test-snx.yml index 676929c6ed449..71f4d54d4914e 100644 --- a/.github/workflows/ext-test-snx.yml +++ b/.github/workflows/ext-test-snx.yml @@ -1,6 +1,9 @@ name: Exteral Tests (Synthetix) -on: workflow_dispatch +on: + schedule: + # run these tests once per day + - cron: '0 0 * * *' jobs: integration: From c5131b4f07b57bf80b74dc4c8e47d0fbc55820df Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Fri, 25 Mar 2022 16:34:49 -0400 Subject: [PATCH 11/25] fix(itests): collect all logs for ext tests Update ext-test-snx to collect all logs to prevent the option from going stale in the future. --- .github/workflows/ext-test-snx.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ext-test-snx.yml b/.github/workflows/ext-test-snx.yml index 71f4d54d4914e..8bd813b498b17 100644 --- a/.github/workflows/ext-test-snx.yml +++ b/.github/workflows/ext-test-snx.yml @@ -72,7 +72,6 @@ jobs: if: failure() uses: jwalton/gh-docker-logs@v1 with: - images: 'ethereumoptimism/hardhat,ethereumoptimism/deployer,ethereumoptimism/data-transport-layer,ethereumoptimism/l2geth,ethereumoptimism/message-relayer,ethereumoptimism/batch-submitter,ethereumoptimism/l2geth,ethereumoptimism/integration-tests' dest: '~/logs' - name: Tar logs From 4d5a0ef52037512e3f959eb638dcc49b4cb802e8 Mon Sep 17 00:00:00 2001 From: Matthew Slipper Date: Sat, 26 Mar 2022 00:33:21 -0600 Subject: [PATCH 12/25] ci: Remove GH actions CI builds The actions responsible for building/deploying changesets have been left in place until a CircleCI implementation is built. --- .github/workflows/batch-submitter.yml | 38 ----- .github/workflows/bss-core.yml | 35 ---- .github/workflows/gas-oracle.yml | 38 ----- .github/workflows/geth.yml | 53 ------- .github/workflows/golangci-lint.yml | 42 ----- .github/workflows/indexer.yml | 38 ----- .github/workflows/integration.yml | 78 --------- .github/workflows/proxyd.yml | 37 ----- .github/workflows/static-analysis.yml | 61 ------- .github/workflows/teleportr.yml | 42 ----- .github/workflows/ts-packages.yml | 220 -------------------------- 11 files changed, 682 deletions(-) delete mode 100644 .github/workflows/batch-submitter.yml delete mode 100644 .github/workflows/bss-core.yml delete mode 100644 .github/workflows/gas-oracle.yml delete mode 100644 .github/workflows/geth.yml delete mode 100644 .github/workflows/golangci-lint.yml delete mode 100644 .github/workflows/indexer.yml delete mode 100644 .github/workflows/integration.yml delete mode 100644 .github/workflows/proxyd.yml delete mode 100644 .github/workflows/static-analysis.yml delete mode 100644 .github/workflows/teleportr.yml delete mode 100644 .github/workflows/ts-packages.yml diff --git a/.github/workflows/batch-submitter.yml b/.github/workflows/batch-submitter.yml deleted file mode 100644 index 3a973a2ee005b..0000000000000 --- a/.github/workflows/batch-submitter.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: batch-submitter unit tests - -on: - push: - paths: - - 'go/batch-submitter/**' - branches: - - 'master' - - 'develop' - - '*rc' - - 'release/*' - pull_request: - branches: - - '*' - workflow_dispatch: - -defaults: - run: - working-directory: './go/batch-submitter' - -jobs: - tests: - runs-on: ubuntu-latest - - steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: 1.16.x - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Install - run: make - - - name: Test - run: make test diff --git a/.github/workflows/bss-core.yml b/.github/workflows/bss-core.yml deleted file mode 100644 index a67a554a7529f..0000000000000 --- a/.github/workflows/bss-core.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: bss-core unit tests - -on: - push: - paths: - - 'go/bss-core/**' - branches: - - 'master' - - 'develop' - - '*rc' - - 'release/*' - pull_request: - branches: - - '*' - workflow_dispatch: - -defaults: - run: - working-directory: './go/bss-core' - -jobs: - tests: - runs-on: ubuntu-latest - - steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: 1.16.x - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Test - run: go test -v ./... diff --git a/.github/workflows/gas-oracle.yml b/.github/workflows/gas-oracle.yml deleted file mode 100644 index aca9ac7b819f9..0000000000000 --- a/.github/workflows/gas-oracle.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: gas-oracle unit tests - -on: - push: - paths: - - 'go/gas-oracle/**' - branches: - - 'master' - - 'develop' - - '*rc' - - 'release/*' - pull_request: - branches: - - '*' - workflow_dispatch: - -defaults: - run: - working-directory: ./go/gas-oracle - -jobs: - tests: - runs-on: ubuntu-latest - - steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: 1.16.x - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Install - run: make - - - name: Test - run: make test diff --git a/.github/workflows/geth.yml b/.github/workflows/geth.yml deleted file mode 100644 index ce7a883f54f5f..0000000000000 --- a/.github/workflows/geth.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: geth unit tests - -on: - push: - paths: - - 'l2geth/**' - branches: - - 'master' - - 'develop' - - '*rc' - - 'release/*' - pull_request: - paths: - - 'l2geth/**' - workflow_dispatch: - -defaults: - run: - working-directory: ./l2geth - -jobs: - lint: - runs-on: ubuntu-latest - - steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: 1.15.x - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Lint - run: make lint - - tests: - runs-on: ubuntu-latest - - steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: 1.15.x - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Install - run: make - - - name: Test - run: make test diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml deleted file mode 100644 index 8c1e8d33abe14..0000000000000 --- a/.github/workflows/golangci-lint.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: golangci-lint -on: - push: - paths: - - 'go/gas-oracle/**' - - 'go/batch-submitter/**' - - 'go/bss-core/**' - - 'go/teleportr/**' - branches: - - 'master' - - 'develop' - - '*rc' - - 'release/*' - pull_request: - branches: - - '*' -jobs: - golangci: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: golangci-lint gas-oracle - uses: golangci/golangci-lint-action@v2 - with: - version: v1.29 - working-directory: go/gas-oracle - - name: golangci-lint batch-submitter - uses: golangci/golangci-lint-action@v2 - with: - version: v1.29 - working-directory: go/batch-submitter - - name: golangci-lint bss-core - uses: golangci/golangci-lint-action@v2 - with: - version: v1.29 - working-directory: go/bss-core - - name: golangci-lint teleportr - uses: golangci/golangci-lint-action@v2 - with: - version: v1.29 - working-directory: go/teleportr diff --git a/.github/workflows/indexer.yml b/.github/workflows/indexer.yml deleted file mode 100644 index dff22a90f4fed..0000000000000 --- a/.github/workflows/indexer.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: indexer unit tests - -on: - push: - paths: - - 'go/indexer/**' - branches: - - 'master' - - 'develop' - - '*rc' - - 'release/*' - pull_request: - branches: - - '*' - workflow_dispatch: - -defaults: - run: - working-directory: './go/indexer' - -jobs: - tests: - runs-on: ubuntu-latest - - steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: 1.16.x - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Install - run: make - - - name: Test - run: make test diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml deleted file mode 100644 index 96b17ef59a2db..0000000000000 --- a/.github/workflows/integration.yml +++ /dev/null @@ -1,78 +0,0 @@ -name: integration - -on: - push: - branches: - - 'master' - - 'develop' - - '*rc' - - 'release/*' - pull_request: - workflow_dispatch: - -jobs: - integration: - runs-on: ubuntu-latest - services: - registry: - image: registry:2 - ports: - - 5000:5000 - strategy: - matrix: - batch-type: - - zlib - - legacy - env: - DOCKER_BUILDKIT: 1 - COMPOSE_DOCKER_CLI_BUILD: 1 - steps: - # Monorepo tests - - uses: actions/checkout@v2 - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Set conditional env vars - run: | - echo "BATCH_SUBMITTER_SEQUENCER_BATCH_TYPE=${{ matrix.batch-type }}" >> $GITHUB_ENV - - - name: Bring the stack up - working-directory: ./ops - run: | - ./scripts/stats.sh & - docker-compose -f docker-compose.yml up -d --scale replica_healthcheck=1 - - - name: Wait for the Sequencer node - working-directory: ./ops - run: ./scripts/wait-for-sequencer.sh - - - name: Run the integration tests - working-directory: ./ops - run: docker-compose run integration_tests - - - name: Collect docker logs on failure - if: failure() - uses: jwalton/gh-docker-logs@v1 - with: - dest: '/home/runner/logs' - - - name: Tar logs - if: failure() - run: tar cvzf ./logs.tgz ~/logs - - - name: Upload logs to GitHub - if: failure() - uses: actions/upload-artifact@master - with: - name: logs.tgz - path: ./logs.tgz diff --git a/.github/workflows/proxyd.yml b/.github/workflows/proxyd.yml deleted file mode 100644 index 3d26f3f6c1717..0000000000000 --- a/.github/workflows/proxyd.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: proxyd unit tests - -on: - push: - branches: - - 'master' - - 'develop' - pull_request: - branches: - - '*' - workflow_dispatch: - -defaults: - run: - working-directory: ./go/proxyd - -jobs: - tests: - runs-on: ubuntu-latest - - steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: 1.15.x - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Build - run: make proxyd - - - name: Lint - run: make lint - - - name: Test - run: make test diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml deleted file mode 100644 index 32c9d6833c4c8..0000000000000 --- a/.github/workflows/static-analysis.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Static analysis - -on: - push: - branches: - - master - - develop - pull_request: - workflow_dispatch: - -env: - PYTEST_ADDOPTS: "--color=yes" - -jobs: - slither: - name: Slither run - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Fetch history - run: git fetch - - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: '16.x' - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install Dependencies - # only install dependencies if there was a change in the deps - # if: steps.yarn-cache.outputs.cache-hit != 'true' - run: yarn install - - - name: Build - run: yarn build - - - name: Set up Python 3.8 - uses: actions/setup-python@v2 - with: - python-version: '3.8' - - - name: Install Slither - run: pip3 install slither-analyzer - - - name: Run analysis - working-directory: ./packages/contracts - shell: bash - run: yarn test:slither - continue-on-error: false diff --git a/.github/workflows/teleportr.yml b/.github/workflows/teleportr.yml deleted file mode 100644 index 7cab49b8a6d37..0000000000000 --- a/.github/workflows/teleportr.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: teleportr unit tests - -on: - push: - paths: - - 'go/teleportr/**' - branches: - - 'master' - - 'develop' - - '*rc' - - 'release/*' - pull_request: - branches: - - '*' - workflow_dispatch: - -defaults: - run: - working-directory: './go/teleportr' - -jobs: - tests: - runs-on: ubuntu-latest - services: - postgres: - image: postgres - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: password - ports: - - 5432:5432 - steps: - - name: Install Go - uses: actions/setup-go@v2 - with: - go-version: 1.16.x - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Test - run: go test -v ./... diff --git a/.github/workflows/ts-packages.yml b/.github/workflows/ts-packages.yml deleted file mode 100644 index bc7c5a568fcae..0000000000000 --- a/.github/workflows/ts-packages.yml +++ /dev/null @@ -1,220 +0,0 @@ -name: typescript / contracts - -on: - push: - branches: - - 'master' - - 'develop' - - '*rc' - - 'release/*' - pull_request: - workflow_dispatch: - -jobs: - test: - name: Run unit tests - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Fetch history - run: git fetch - - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: '16.x' - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install Dependencies - # only install dependencies if there was a change in the deps - # if: steps.yarn-cache.outputs.cache-hit != 'true' - run: yarn install - - - name: Check yarn.lock for changes - run: git diff --exit-code - - - name: Build - run: yarn build - - - name: Test - run: yarn test - env: - FORCE_COLOR: 1 - ENABLE_GAS_REPORT: 1 - - name: Print gas report - run: cat packages/contracts/gas-report.txt - - - name: Run codechecks - working-directory: ./packages/contracts - run: yarn codechecks - env: - CC_SECRET: ${{ secrets.CC_SECRET }} - - test-coverage: - name: Generate test coverage - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Fetch history - run: git fetch - - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: '16.x' - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install Dependencies - # only install dependencies if there was a change in the deps - # if: steps.yarn-cache.outputs.cache-hit != 'true' - run: yarn install - - - name: Build - run: yarn build - - - name: Test Coverage - run: yarn test:coverage - - - uses: codecov/codecov-action@v1 - with: - files: ./packages/contracts/coverage.json - fail_ci_if_error: true - verbose: true - flags: contracts - - uses: codecov/codecov-action@v1 - with: - files: ./packages/core-utils/coverage.json - fail_ci_if_error: false - verbose: true - flags: core-utils - - uses: codecov/codecov-action@v1 - with: - files: ./packages/data-transport-layer/coverage.json - fail_ci_if_error: false - verbose: true - flags: data-transport-layer - - uses: codecov/codecov-action@v1 - with: - files: ./packages/message-relayer/coverage.json - fail_ci_if_error: false - verbose: true - flags: message-relayer - - uses: codecov/codecov-action@v1 - with: - files: ./packages/sdk/coverage.json - fail_ci_if_error: false - verbose: true - flags: sdk - - depcheck: - name: Check for unused dependencies - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Fetch history - run: git fetch - - - name: Setup node - uses: actions/setup-node@v1 - with: - node-version: '16.x' - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install Dependencies - # only install dependencies if there was a change in the deps - # if: steps.yarn-cache.outputs.cache-hit != 'true' - run: yarn install - - - name: Check packages/contracts - working-directory: ./packages/contracts - run: npx depcheck - - - name: Check packages/core-utils - working-directory: ./packages/core-utils - run: npx depcheck - - - name: Check packages/data-transport-layer - working-directory: ./packages/data-transport-layer - run: npx depcheck - - - name: Check packages/message-relayer - working-directory: ./packages/message-relayer - run: npx depcheck - - - name: Check packages/sdk - working-directory: ./packages/sdk - run: npx depcheck - - - name: Check integration-tests - working-directory: ./integration-tests - run: npx depcheck - - lint: - name: Linting - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Fetch history - run: git fetch - - uses: actions/setup-node@v1 - with: - node-version: '16.x' - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v2 - id: yarn-cache - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install Dependencies - # only install dependencies if there was a change in the deps - # if: steps.yarn-cache.outputs.cache-hit != 'true' - run: yarn install - - - name: Lint - run: yarn lint:check From c19571267afcb8f02e92ddc034311bc6ff69125f Mon Sep 17 00:00:00 2001 From: Matthew Slipper Date: Sun, 27 Mar 2022 12:58:21 -0600 Subject: [PATCH 13/25] ci: Use Alpine to reduce image size Image sizes were increased because the packages Dockerfile used `buster-slim` rather than Alpine. Unfortunately, the images will still be large because the `node_modules` directory contains dev dependencies. This is how it was before the CircleCI migration/larger build cleanup, and will need a larger rethink of how we build TypeScript projects in the monorepo before it can be solved. --- .changeset/popular-plants-change.md | 12 ++++++++++++ .circleci/config.yml | 24 ++++++++++++------------ ops/docker/Dockerfile.packages | 11 ++--------- ops/scripts/wait-for-sequencer.sh | 2 +- 4 files changed, 27 insertions(+), 22 deletions(-) create mode 100644 .changeset/popular-plants-change.md diff --git a/.changeset/popular-plants-change.md b/.changeset/popular-plants-change.md new file mode 100644 index 0000000000000..7223e2787de83 --- /dev/null +++ b/.changeset/popular-plants-change.md @@ -0,0 +1,12 @@ +--- +'@eth-optimism/integration-tests': patch +'@eth-optimism/common-ts': patch +'@eth-optimism/contracts': patch +'@eth-optimism/core-utils': patch +'@eth-optimism/data-transport-layer': patch +'@eth-optimism/message-relayer': patch +'@eth-optimism/replica-healthcheck': patch +'@eth-optimism/sdk': patch +--- + +Update Dockerfile to use Alpine diff --git a/.circleci/config.yml b/.circleci/config.yml index aa108aa083340..8ff863813d50b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -208,22 +208,22 @@ jobs: steps: - restore_cache: keys: - - v1-source-{{ .Branch }}-{{ .Revision }} - - v1-source-{{ .Branch }} + - v2-source-{{ .Branch }}-{{ .Revision }} + - v2-source-{{ .Branch }} - checkout - save_cache: - key: v1-source-{{ .Branch }}-{{ .Revision }} + key: v2-source-{{ .Branch }}-{{ .Revision }} paths: - ".git" - restore_cache: keys: - - v1-yarn-install-{{ checksum "yarn.lock" }} - - v1-yarn-install + - v2-yarn-install-{{ checksum "yarn.lock" }} + - v2-yarn-install - run: name: Install dependencies command: yarn --frozen-lockfile - save_cache: - key: v1-yarn-install-{{ checksum "yarn.lock" }} + key: v2-yarn-install-{{ checksum "yarn.lock" }} paths: - node_modules - packages/common-ts/node_modules @@ -238,7 +238,7 @@ jobs: name: Build monorepo command: yarn build - save_cache: - key: v1-yarn-build-{{ .Revision }} + key: v2-yarn-build-{{ .Revision }} paths: - "." @@ -248,7 +248,7 @@ jobs: steps: - restore_cache: keys: - - v1-yarn-build-{{ .Revision }} + - v2-yarn-build-{{ .Revision }} - checkout - run: name: Run Slither @@ -262,7 +262,7 @@ jobs: steps: - restore_cache: keys: - - v1-yarn-build-{{ .Revision }} + - v2-yarn-build-{{ .Revision }} - checkout - run: name: Lint @@ -283,7 +283,7 @@ jobs: steps: - restore_cache: keys: - - v1-yarn-build-{{ .Revision }} + - v2-yarn-build-{{ .Revision }} - checkout - run: name: Test @@ -306,7 +306,7 @@ jobs: steps: - restore_cache: keys: - - v1-yarn-build-{{ .Revision }} + - v2-yarn-build-{{ .Revision }} - checkout # Note: The below needs to be manually configured whenever we # add a new package to CI. @@ -385,7 +385,7 @@ jobs: steps: - restore_cache: keys: - - v1-yarn-build-{{ .Revision }} + - v2-yarn-build-{{ .Revision }} - checkout - run: name: Lint diff --git a/ops/docker/Dockerfile.packages b/ops/docker/Dockerfile.packages index 509ff8a10085c..5edf74263b9aa 100644 --- a/ops/docker/Dockerfile.packages +++ b/ops/docker/Dockerfile.packages @@ -2,16 +2,9 @@ # be used to build any of the follow-on services # # ### BASE: Install deps -# We do not use Alpine because there's a regression causing it to be very slow -# when used with typescript/hardhat: https://github.com/nomiclabs/hardhat/issues/1219 -FROM node:16.13-buster-slim as base +FROM node:16-alpine3.14 as base -RUN apt-get update -y && apt-get install -y --no-install-recommends git \ - curl \ - jq \ - python3 \ - ca-certificates \ - && rm -rf /var/lib/apt/lists/* +RUN apk --no-cache add curl jq python3 ca-certificates git make gcc musl-dev linux-headers bash # copy over the needed configs to run the dep installation # note: this approach can be a bit unhandy to maintain, but it allows diff --git a/ops/scripts/wait-for-sequencer.sh b/ops/scripts/wait-for-sequencer.sh index 1f5ea579e644f..86a6d1d1e2428 100755 --- a/ops/scripts/wait-for-sequencer.sh +++ b/ops/scripts/wait-for-sequencer.sh @@ -8,7 +8,7 @@ do sleep 1 if [ $i -eq $RETRIES ]; then echo 'Timed out waiting for sequencer' - break + exit 1 fi echo 'Waiting for sequencer...' ((i=i+1)) From cc03b98b4f2620eb176d7138690482ce9ee70221 Mon Sep 17 00:00:00 2001 From: Matthew Slipper Date: Thu, 31 Mar 2022 10:01:48 -0600 Subject: [PATCH 14/25] ci: Change cache keys Updates cache keys to fix the CircleCI permissions errors we've seen. Builds will be a bit slow while the cache rebuilds. --- .circleci/config.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8ff863813d50b..d4e800ffdb9aa 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -208,22 +208,22 @@ jobs: steps: - restore_cache: keys: - - v2-source-{{ .Branch }}-{{ .Revision }} - - v2-source-{{ .Branch }} + - v2-cache-source-{{ .Branch }}-{{ .Revision }} + - v2-cache-source-{{ .Branch }} - checkout - save_cache: - key: v2-source-{{ .Branch }}-{{ .Revision }} + key: v2-cache-source-{{ .Branch }}-{{ .Revision }} paths: - ".git" - restore_cache: keys: - - v2-yarn-install-{{ checksum "yarn.lock" }} - - v2-yarn-install + - v2-cache-yarn-install-{{ checksum "yarn.lock" }} + - v2-cache-yarn-install - run: name: Install dependencies command: yarn --frozen-lockfile - save_cache: - key: v2-yarn-install-{{ checksum "yarn.lock" }} + key: v2-cache-yarn-install-{{ checksum "yarn.lock" }} paths: - node_modules - packages/common-ts/node_modules @@ -238,7 +238,7 @@ jobs: name: Build monorepo command: yarn build - save_cache: - key: v2-yarn-build-{{ .Revision }} + key: v2-cache-yarn-build-{{ .Revision }} paths: - "." @@ -248,7 +248,7 @@ jobs: steps: - restore_cache: keys: - - v2-yarn-build-{{ .Revision }} + - v2-cache-yarn-build-{{ .Revision }} - checkout - run: name: Run Slither @@ -262,7 +262,7 @@ jobs: steps: - restore_cache: keys: - - v2-yarn-build-{{ .Revision }} + - v2-cache-yarn-build-{{ .Revision }} - checkout - run: name: Lint @@ -283,7 +283,7 @@ jobs: steps: - restore_cache: keys: - - v2-yarn-build-{{ .Revision }} + - v2-cache-yarn-build-{{ .Revision }} - checkout - run: name: Test @@ -306,7 +306,7 @@ jobs: steps: - restore_cache: keys: - - v2-yarn-build-{{ .Revision }} + - v2-cache-yarn-build-{{ .Revision }} - checkout # Note: The below needs to be manually configured whenever we # add a new package to CI. @@ -385,7 +385,7 @@ jobs: steps: - restore_cache: keys: - - v2-yarn-build-{{ .Revision }} + - v2-cache-yarn-build-{{ .Revision }} - checkout - run: name: Lint From 45b1b2de38f49f76ce65dbc1ec642f3a26d7053a Mon Sep 17 00:00:00 2001 From: Matthew Slipper Date: Thu, 31 Mar 2022 10:22:08 -0600 Subject: [PATCH 15/25] ci: Add Mergify --- .github/CODEOWNERS | 21 --------------- .github/labeler.yml | 8 +++++- .github/mergify.yml | 62 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 22 deletions(-) delete mode 100644 .github/CODEOWNERS create mode 100644 .github/mergify.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 476c30ed0e2a9..0000000000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,21 +0,0 @@ -go/bss-core @cfromknecht @tynes -go/batch-submitter @cfromknecht @tynes -go/gas-oracle @tynes -go/l2geth-exporter @optimisticben @mslipper -go/op-exporter @optimisticben @mslipper -go/proxyd @mslipper @inphi -go/teleportr @mslipper @cfromknecht - -integration-tests/ @tynes @mslipper - -packages/core-utils @smartcontracts @tynes -packages/common-ts/ @smartcontracts -packages/message-relayer/ @smartcontracts -packages/data-transport-layer/ @tynes @smartcontracts -packages/replica-healthcheck @optimisticben @tynes -packages/sdk @smartcontracts @mslipper -packages/contracts @elenadimitrova @maurelian @smartcontracts - -l2geth @tynes @cfromknecht @smartcontracts - -ops @tynes @optimisticben @mslipper diff --git a/.github/labeler.yml b/.github/labeler.yml index e7e4a36f1a3f4..29d28cad26a1e 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -10,7 +10,7 @@ - 'patches/**/*' M-ci: - - any: ['.github/**/*'] + - any: ['.github/**/*', '.circleci/**/*'] M-l2geth: - any: ['l2geth/**/*'] @@ -35,3 +35,9 @@ M-sdk: M-ops: - any: ['ops/**/*'] + +C-Protocol-Critical: + - any: + - 'packages/data-transport-layer/**/*.ts' + - 'packages/contracts/**/*.sol' + - 'pakages/l2geth/**/*.go' \ No newline at end of file diff --git a/.github/mergify.yml b/.github/mergify.yml new file mode 100644 index 0000000000000..542551106bf65 --- /dev/null +++ b/.github/mergify.yml @@ -0,0 +1,62 @@ +pull_request_rules: + - name: Automatic merge on approval + conditions: + - or: + - and: + - "label!=SR-Risk" + - "label!=C-Protocol-Critical" + - "#approved-reviews-by>=2" + - and: + - "label=SR-Risk" + - "#approved-reviews-by>=2" + - "approved-reviews-by=maurelian" + - and: + - "label=C-Protocol-Critical" + - "#approved-reviews-by>=2" + - or: + - "approved-reviews-by=tynes" + - "approved-reviews-by=smartcontracts" + actions: + merge: + method: squash + - name: Handle security critical PRs + conditions: + - "label=SR-Risk" + actions: + request_reviews: + users: + - "maurelian" + comment: + message: | + Hey there @{{author}}! You flagged this PR as security critical. To make review easier, please add a comment describing + + 1. The risks present in this PR. + 2. The mitigations you have added to try and reduce those risks. + - name: Request reviewers + conditions: + - -closed + actions: + request_reviews: + users: + - cfromknecht + - tynes + - mslipper + - inphi + - tuxcanfly + - smartcontracts + random_count: 2 + - name: Request protocol critical reviewers + conditions: + - label=C-Protocol-Critical + actions: + request_reviews: + users: + - tynes + - smartcontracts + random_count: 1 + - name: Ask to resolve conflict + conditions: + - conflict + actions: + comment: + message: Hey @{{author}}! This PR has merge conflicts. Please fix them before continuing review. \ No newline at end of file From 23ad6068cbeb4c67bbaa1014f0a487f4875df8a8 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Thu, 31 Mar 2022 12:02:18 -0700 Subject: [PATCH 16/25] l2geth: skip `geth` console flake tests (#2384) This code is not going to change before deprecation of `l2geth` in favor of bedrock. Skip a couple of tests that fail in CI that are not involved at all in consensus. --- .changeset/four-flowers-run.md | 5 +++++ l2geth/cmd/geth/consolecmd_test.go | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 .changeset/four-flowers-run.md diff --git a/.changeset/four-flowers-run.md b/.changeset/four-flowers-run.md new file mode 100644 index 0000000000000..d62262e7f3e1a --- /dev/null +++ b/.changeset/four-flowers-run.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Skip some geth console tests that flake in CI diff --git a/l2geth/cmd/geth/consolecmd_test.go b/l2geth/cmd/geth/consolecmd_test.go index cfc9db52a367b..32067266183cd 100644 --- a/l2geth/cmd/geth/consolecmd_test.go +++ b/l2geth/cmd/geth/consolecmd_test.go @@ -71,6 +71,7 @@ at block: 0 ({{niltime}}) // Tests that a console can be attached to a running node via various means. func TestIPCAttachWelcome(t *testing.T) { + t.Skip() // Configure the instance for IPC attachement coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182" var ipc string @@ -98,6 +99,7 @@ func TestIPCAttachWelcome(t *testing.T) { } func TestHTTPAttachWelcome(t *testing.T) { + t.Skip() coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182" port := strconv.Itoa(trulyRandInt(1024, 65536)) // Yeah, sometimes this will fail, sorry :P geth := runGeth(t, From a01a2eb15db33a8e6cf515c9eb863c368aa1c6a9 Mon Sep 17 00:00:00 2001 From: Matthew Slipper Date: Thu, 31 Mar 2022 13:16:17 -0600 Subject: [PATCH 17/25] l2geth: Skip another flaky test --- .changeset/cuddly-geese-allow.md | 5 +++++ .github/labeler.yml | 2 +- l2geth/cmd/geth/consolecmd_test.go | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/cuddly-geese-allow.md diff --git a/.changeset/cuddly-geese-allow.md b/.changeset/cuddly-geese-allow.md new file mode 100644 index 0000000000000..8bf16c938b0f6 --- /dev/null +++ b/.changeset/cuddly-geese-allow.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/l2geth': patch +--- + +Skip TestWSAttachWelcome diff --git a/.github/labeler.yml b/.github/labeler.yml index 29d28cad26a1e..b233e9b91ce72 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -40,4 +40,4 @@ C-Protocol-Critical: - any: - 'packages/data-transport-layer/**/*.ts' - 'packages/contracts/**/*.sol' - - 'pakages/l2geth/**/*.go' \ No newline at end of file + - 'l2geth/**/*.go' \ No newline at end of file diff --git a/l2geth/cmd/geth/consolecmd_test.go b/l2geth/cmd/geth/consolecmd_test.go index 32067266183cd..c6b934803268e 100644 --- a/l2geth/cmd/geth/consolecmd_test.go +++ b/l2geth/cmd/geth/consolecmd_test.go @@ -116,6 +116,7 @@ func TestHTTPAttachWelcome(t *testing.T) { } func TestWSAttachWelcome(t *testing.T) { + t.Skip() coinbase := "0x8605cdbbdb6d264aa742e77020dcbc58fcdce182" port := strconv.Itoa(trulyRandInt(1024, 65536)) // Yeah, sometimes this will fail, sorry :P From 51192b22d85b2fab79960489bf2eb6bcf93b1813 Mon Sep 17 00:00:00 2001 From: Matthew Slipper Date: Thu, 31 Mar 2022 13:14:02 -0600 Subject: [PATCH 18/25] ci: Merge using merge queue --- .github/mergify.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/mergify.yml b/.github/mergify.yml index 542551106bf65..d61ff0f98cf00 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -1,3 +1,7 @@ +queue_rules: + - name: default + conditions: [] + pull_request_rules: - name: Automatic merge on approval conditions: @@ -17,7 +21,8 @@ pull_request_rules: - "approved-reviews-by=tynes" - "approved-reviews-by=smartcontracts" actions: - merge: + queue: + name: default method: squash - name: Handle security critical PRs conditions: @@ -59,4 +64,11 @@ pull_request_rules: - conflict actions: comment: - message: Hey @{{author}}! This PR has merge conflicts. Please fix them before continuing review. \ No newline at end of file + message: Hey @{{author}}! This PR has merge conflicts. Please fix them before continuing review. + - name: Notify author when added to merge queue + conditions: + - "check-success=Queue: Embarked on merge train" + actions: + comment: + message: | + This PR has been added to the merge train, and will be merged soon. \ No newline at end of file From 7a17900377335fac9dff95e2ef56fec347592c7a Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Thu, 31 Mar 2022 16:08:36 -0400 Subject: [PATCH 19/25] feat(cmn): add JsonRpcProvider validator (#2379) Adds a new JsonRpcProvider validator which specifically parses the input type into a JsonRpcProvider instead of a generic provider. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- .changeset/tender-scissors-report.md | 5 +++++ packages/common-ts/src/base-service/validators.ts | 15 +++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 .changeset/tender-scissors-report.md diff --git a/.changeset/tender-scissors-report.md b/.changeset/tender-scissors-report.md new file mode 100644 index 0000000000000..a41fa85f16948 --- /dev/null +++ b/.changeset/tender-scissors-report.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/common-ts': patch +--- + +Adds the jsonRpcProvider validator as an input validator diff --git a/packages/common-ts/src/base-service/validators.ts b/packages/common-ts/src/base-service/validators.ts index a09a08371092d..fc36a96f33e80 100644 --- a/packages/common-ts/src/base-service/validators.ts +++ b/packages/common-ts/src/base-service/validators.ts @@ -18,6 +18,19 @@ const provider = makeValidator((input) => { return new ethers.providers.JsonRpcProvider(parsed) }) +const jsonRpcProvider = makeValidator( + (input) => { + const parsed = url()._parse(input) + return new ethers.providers.JsonRpcProvider(parsed) + } +) + +const staticJsonRpcProvider = + makeValidator((input) => { + const parsed = url()._parse(input) + return new ethers.providers.StaticJsonRpcProvider(parsed) + }) + const wallet = makeValidator((input) => { if (!ethers.utils.isHexString(input)) { throw new Error(`expected wallet to be a hex string`) @@ -37,4 +50,6 @@ export const validators = { json, wallet, provider, + jsonRpcProvider, + staticJsonRpcProvider, } From e36b085ca64c0dcbb06ad93dc373c8a86a9f10a2 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Thu, 31 Mar 2022 16:25:40 -0400 Subject: [PATCH 20/25] feat(cmn): hard stop on multiple exit signals (#2378) Adds a new feature to BaseServiceV2 to have a service exit immediately when 3 exit signals are received. Useful when the main loop would take a long time to exit but you want the service to exit immediately. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- .changeset/fair-cows-think.md | 5 +++++ .../src/base-service/base-service-v2.ts | 21 ++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 .changeset/fair-cows-think.md diff --git a/.changeset/fair-cows-think.md b/.changeset/fair-cows-think.md new file mode 100644 index 0000000000000..2bf3b6198cf41 --- /dev/null +++ b/.changeset/fair-cows-think.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/common-ts': patch +--- + +Adds hard stop to BaseServiceV2 when multiple exit signals are received diff --git a/packages/common-ts/src/base-service/base-service-v2.ts b/packages/common-ts/src/base-service/base-service-v2.ts index 1041196a3fd21..764989b03ce17 100644 --- a/packages/common-ts/src/base-service/base-service-v2.ts +++ b/packages/common-ts/src/base-service/base-service-v2.ts @@ -247,11 +247,26 @@ export abstract class BaseServiceV2< this.logger = new Logger({ name: params.name }) // Gracefully handle stop signals. + const maxSignalCount = 3 + let currSignalCount = 0 const stop = async (signal: string) => { - this.logger.info(`stopping service with signal`, { signal }) - await this.stop() - process.exit(0) + // Allow exiting fast if more signals are received. + currSignalCount++ + if (currSignalCount === 1) { + this.logger.info(`stopping service with signal`, { signal }) + await this.stop() + process.exit(0) + } else if (currSignalCount >= maxSignalCount) { + this.logger.info(`performing hard stop`) + process.exit(0) + } else { + this.logger.info( + `send ${maxSignalCount - currSignalCount} more signal(s) to hard stop` + ) + } } + + // Handle stop signals. process.on('SIGTERM', stop) process.on('SIGINT', stop) } From 5bf390b45d6dbda633da5f395e475f225d133111 Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Thu, 31 Mar 2022 13:41:27 -0700 Subject: [PATCH 21/25] ops: fix chainid to work with ethers ledger (#2380) Previously the chainid was too large for the ledger package to work. This is due to ethers using an old version of the ledger package. There is an unresolved open issue here: https://github.com/ethers-io/ethers.js/issues/1365 This updates the chainid to 17 to get around this issue. This chain id is used by ThaiChain 2.0 ThaiFi which has very little activity. https://exp.thaifi.com/ It also lints the docker compose file to use `'` consistently Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- .changeset/moody-drinks-lie.md | 5 +++++ integration-tests/test/shared/utils.ts | 2 +- ops/docker-compose.yml | 15 +++++++-------- ops/envs/geth.env | 4 ++-- packages/contracts/deploy-config/local.ts | 2 +- 5 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 .changeset/moody-drinks-lie.md diff --git a/.changeset/moody-drinks-lie.md b/.changeset/moody-drinks-lie.md new file mode 100644 index 0000000000000..715b37d2a804c --- /dev/null +++ b/.changeset/moody-drinks-lie.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/integration-tests': patch +--- + +Update chainid diff --git a/integration-tests/test/shared/utils.ts b/integration-tests/test/shared/utils.ts index c7fe77acf7fda..771be3b83f7fb 100644 --- a/integration-tests/test/shared/utils.ts +++ b/integration-tests/test/shared/utils.ts @@ -38,7 +38,7 @@ const procEnv = cleanEnv(process.env, { L1_URL: str({ default: 'http://localhost:9545' }), L1_POLLING_INTERVAL: num({ default: 10 }), - L2_CHAINID: num({ default: 987 }), + L2_CHAINID: num({ default: 17 }), L2_GAS_PRICE: gasPriceValidator({ default: 'onchain', }), diff --git a/ops/docker-compose.yml b/ops/docker-compose.yml index 060a16920c7a0..d4ce98d1c189d 100644 --- a/ops/docker-compose.yml +++ b/ops/docker-compose.yml @@ -3,12 +3,11 @@ version: '3.4' x-system-addr-env: &system-addr-env # private key: a6aecc98b63bafb0de3b29ae9964b14acb4086057808be29f90150214ebd4a0f # OK to publish this since it will only ever be used in itests - SYSTEM_ADDRESS_0_DEPLOYER: "0xa961b0d6dce82db098cf70a42a14add3ee3db2d5" + SYSTEM_ADDRESS_0_DEPLOYER: '0xa961b0d6dce82db098cf70a42a14add3ee3db2d5' # private key: 3b8d2345102cce2443acb240db6e87c8edd4bb3f821b17fab8ea2c9da08ea132 # OK to publish this since it will only ever be used in itests - SYSTEM_ADDRESS_1_DEPLOYER: "0xdfc82d475833a50de90c642770f34a9db7deb725" - + SYSTEM_ADDRESS_1_DEPLOYER: '0xdfc82d475833a50de90c642770f34a9db7deb725' services: # this is a helper service used because there's no official hardhat image @@ -64,7 +63,7 @@ services: DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT: http://l1_chain:8545 DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT: http://l2geth:8545 DATA_TRANSPORT_LAYER__SYNC_FROM_L2: 'true' - DATA_TRANSPORT_LAYER__L2_CHAIN_ID: 987 + DATA_TRANSPORT_LAYER__L2_CHAIN_ID: 17 ports: - ${DTL_PORT:-7878}:7878 @@ -211,11 +210,11 @@ services: NO_NETWORK: 1 BATCH_SUBMITTER_SEQUENCER_BATCH_TYPE: ${BATCH_SUBMITTER_SEQUENCER_BATCH_TYPE:-zlib} - RUN_SYSTEM_ADDRESS_TESTS: "true" + RUN_SYSTEM_ADDRESS_TESTS: 'true' # must match l2geth environment, see above for why it's safe to publish these - SYSTEM_ADDRESS_0_DEPLOYER_KEY: "a6aecc98b63bafb0de3b29ae9964b14acb4086057808be29f90150214ebd4a0f" - SYSTEM_ADDRESS_1_DEPLOYER_KEY: "3b8d2345102cce2443acb240db6e87c8edd4bb3f821b17fab8ea2c9da08ea132" + SYSTEM_ADDRESS_0_DEPLOYER_KEY: 'a6aecc98b63bafb0de3b29ae9964b14acb4086057808be29f90150214ebd4a0f' + SYSTEM_ADDRESS_1_DEPLOYER_KEY: '3b8d2345102cce2443acb240db6e87c8edd4bb3f821b17fab8ea2c9da08ea132' gas_oracle: deploy: @@ -228,7 +227,7 @@ services: GAS_PRICE_ORACLE_ETHEREUM_HTTP_URL: http://l1_chain:8545 GAS_PRICE_ORACLE_LAYER_TWO_HTTP_URL: http://l2geth:8545 # Default hardhat account 5 - GAS_PRICE_ORACLE_PRIVATE_KEY: "0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba" + GAS_PRICE_ORACLE_PRIVATE_KEY: '0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba' batch_submitter: depends_on: diff --git a/ops/envs/geth.env b/ops/envs/geth.env index 75d32152cf3ad..35708fcebda6f 100644 --- a/ops/envs/geth.env +++ b/ops/envs/geth.env @@ -20,12 +20,12 @@ WS_PORT=8546 WS_API=eth,net,rollup,web3 WS_ORIGINS=* -CHAIN_ID=987 +CHAIN_ID=17 DATADIR=/root/.ethereum GASPRICE=0 GCMODE=archive IPC_DISABLE=true -NETWORK_ID=987 +NETWORK_ID=17 NO_USB=true NO_DISCOVER=true TARGET_GAS_LIMIT=15000000 diff --git a/packages/contracts/deploy-config/local.ts b/packages/contracts/deploy-config/local.ts index 0e8207d4981ec..6c1527921b153 100644 --- a/packages/contracts/deploy-config/local.ts +++ b/packages/contracts/deploy-config/local.ts @@ -4,7 +4,7 @@ const config: DeployConfig = { network: 'local', l1BlockTimeSeconds: 15, l2BlockGasLimit: 15_000_000, - l2ChainId: 987, + l2ChainId: 17, ctcL2GasDiscountDivisor: 32, ctcEnqueueGasCost: 60_000, sccFaultProofWindowSeconds: 0, From b36e62542708c8d9aa17d0af517ee25d7c4b6af0 Mon Sep 17 00:00:00 2001 From: Matthew Slipper Date: Thu, 31 Mar 2022 15:37:48 -0600 Subject: [PATCH 22/25] ci: Use correct condition name (#2387) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- .github/mergify.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/mergify.yml b/.github/mergify.yml index d61ff0f98cf00..6c4faeeec0c6f 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -24,6 +24,12 @@ pull_request_rules: queue: name: default method: squash + comment: + message: | + This PR has been added to the merge queue, and will be merged soon. + label: + add: + - on-merge-train - name: Handle security critical PRs conditions: - "label=SR-Risk" @@ -67,8 +73,8 @@ pull_request_rules: message: Hey @{{author}}! This PR has merge conflicts. Please fix them before continuing review. - name: Notify author when added to merge queue conditions: - - "check-success=Queue: Embarked on merge train" + - "check-pending=Queue: Embarked in merge train" actions: comment: message: | - This PR has been added to the merge train, and will be merged soon. \ No newline at end of file + This PR is next in line to be merged, and will be merged as soon as checks pass. \ No newline at end of file From 917058e9a710f10f7d6b4015b79e0857f63f5215 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Thu, 31 Mar 2022 18:59:10 -0400 Subject: [PATCH 23/25] feat(ci): check deploy markdown correctness (#2373) * feat(ci): check deploy markdown correctness Adds a step to the contract tests to confirm that the contract deployment docs are up to date. Will only fail if a deployment has been modified but yarn autogen:markdown was not run properly. * maint(ct): update deployments markdown Updates the deployments markdown files. Should've been updated after we deployed the Teleportr contracts to Kovan but we didn't have the CI workflow in place to detect that this didn't happen. --- .circleci/config.yml | 4 ++++ packages/contracts/deployments/kovan/README.md | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index d4e800ffdb9aa..78b69570d6af6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -268,6 +268,10 @@ jobs: name: Lint command: yarn lint:check working_directory: packages/contracts + - run: + name: Check deployment docs + command: yarn autogen:markdown && git diff --exit-code + working_directory: packages/contracts - run: name: Slither command: yarn test:slither diff --git a/packages/contracts/deployments/kovan/README.md b/packages/contracts/deployments/kovan/README.md index 574c43b13bea0..8c2586c37a229 100644 --- a/packages/contracts/deployments/kovan/README.md +++ b/packages/contracts/deployments/kovan/README.md @@ -95,6 +95,16 @@ StateCommitmentChain + + +TeleportrDeposit + + + +0x4821975ca220601c153d02353300d6ad34adc362 + + + ## Layer 2 Contracts From 05894239accad9c42104740774ad63c12564efba Mon Sep 17 00:00:00 2001 From: Mark Tyneway Date: Thu, 31 Mar 2022 16:37:46 -0700 Subject: [PATCH 24/25] data-transport-layer: add new metrics (#2391) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- .changeset/new-jokes-walk.md | 5 +++++ .../src/services/l2-ingestion/service.ts | 13 ++++++++++++- .../src/services/main/service.ts | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .changeset/new-jokes-walk.md diff --git a/.changeset/new-jokes-walk.md b/.changeset/new-jokes-walk.md new file mode 100644 index 0000000000000..d48dcbfad5849 --- /dev/null +++ b/.changeset/new-jokes-walk.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/data-transport-layer': patch +--- + +Add new metrics to the data-transport-layer diff --git a/packages/data-transport-layer/src/services/l2-ingestion/service.ts b/packages/data-transport-layer/src/services/l2-ingestion/service.ts index 8119e3fca6d2d..6303a2d28208b 100644 --- a/packages/data-transport-layer/src/services/l2-ingestion/service.ts +++ b/packages/data-transport-layer/src/services/l2-ingestion/service.ts @@ -6,7 +6,7 @@ import { BigNumber } from 'ethers' import { LevelUp } from 'levelup' import axios from 'axios' import bfj from 'bfj' -import { Gauge } from 'prom-client' +import { Gauge, Histogram } from 'prom-client' /* Imports: Internal */ import { handleSequencerBlock } from './handlers/transaction' @@ -16,6 +16,7 @@ import { L1DataTransportServiceOptions } from '../main/service' interface L2IngestionMetrics { highestSyncedL2Block: Gauge + fetchBlocksRequestTime: Histogram } const registerMetrics = ({ @@ -27,6 +28,12 @@ const registerMetrics = ({ help: 'Highest Synced L2 Block Number', registers: [registry], }), + fetchBlocksRequestTime: new client.Histogram({ + name: 'data_transport_layer_fetch_blocks_time', + help: 'Amount of time fetching remote L2 blocks takes', + buckets: [0.1, 5, 15, 50, 100, 500], + registers: [registry], + }), }) export interface L2IngestionServiceOptions @@ -240,6 +247,8 @@ export class L2IngestionService extends BaseService { ) } + const end = this.l2IngestionMetrics.fetchBlocksRequestTime.startTimer() + const resp = await axios.post( this.state.l2RpcProvider.connection.url, req, @@ -249,6 +258,8 @@ export class L2IngestionService extends BaseService { yieldRate: 4096, // this yields abit more often than the default of 16384 }) + end() + result = respJson.result if (result === null) { retry++ diff --git a/packages/data-transport-layer/src/services/main/service.ts b/packages/data-transport-layer/src/services/main/service.ts index 9e70dcbd8cfa7..b397a623a246e 100644 --- a/packages/data-transport-layer/src/services/main/service.ts +++ b/packages/data-transport-layer/src/services/main/service.ts @@ -89,6 +89,10 @@ export class L1DataTransportService extends BaseService Date: Thu, 31 Mar 2022 21:37:50 -0400 Subject: [PATCH 25/25] fix(dtl): kovan DTL halting issue (#2393) * fix(dtl): kovan DTL halting issue * fix(dtl): add consistency check for L2 sync * dtl: add retry logic on startup * dtl: fix startup Co-authored-by: Mark Tyneway --- .changeset/brown-dots-whisper.md | 5 ++ .../src/db/transport-db.ts | 15 ++++++ .../services/l2-ingestion/handlers/errors.ts | 7 +++ .../l2-ingestion/handlers/transaction.ts | 21 ++++++-- .../src/services/l2-ingestion/service.ts | 51 +++++++++++++++++++ 5 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 .changeset/brown-dots-whisper.md create mode 100644 packages/data-transport-layer/src/services/l2-ingestion/handlers/errors.ts diff --git a/.changeset/brown-dots-whisper.md b/.changeset/brown-dots-whisper.md new file mode 100644 index 0000000000000..c0b1269c7b7c9 --- /dev/null +++ b/.changeset/brown-dots-whisper.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/data-transport-layer': patch +--- + +Patch for Kovan DTL halting issue diff --git a/packages/data-transport-layer/src/db/transport-db.ts b/packages/data-transport-layer/src/db/transport-db.ts index 0e713d4b0ec90..d594d12fa8a14 100644 --- a/packages/data-transport-layer/src/db/transport-db.ts +++ b/packages/data-transport-layer/src/db/transport-db.ts @@ -27,6 +27,7 @@ const TRANSPORT_DB_KEYS = { STARTING_L1_BLOCK: `l1:starting`, HIGHEST_L2_BLOCK: `l2:highest`, HIGHEST_SYNCED_BLOCK: `synced:highest`, + CONSISTENCY_CHECK: `consistency:checked`, } interface Indexed { @@ -202,6 +203,20 @@ export class TransportDB { return this.db.get(TRANSPORT_DB_KEYS.HIGHEST_L2_BLOCK, 0) } + public async getConsistencyCheckFlag(): Promise { + return this.db.get(TRANSPORT_DB_KEYS.CONSISTENCY_CHECK, 0) + } + + public async putConsistencyCheckFlag(flag: boolean): Promise { + return this.db.put([ + { + key: TRANSPORT_DB_KEYS.CONSISTENCY_CHECK, + index: 0, + value: flag, + }, + ]) + } + public async putHighestL2BlockNumber( block: number | BigNumber ): Promise { diff --git a/packages/data-transport-layer/src/services/l2-ingestion/handlers/errors.ts b/packages/data-transport-layer/src/services/l2-ingestion/handlers/errors.ts new file mode 100644 index 0000000000000..4a07d9f75326f --- /dev/null +++ b/packages/data-transport-layer/src/services/l2-ingestion/handlers/errors.ts @@ -0,0 +1,7 @@ +export type EventName = 'SequencerTransaction' + +export class MissingElementError extends Error { + constructor(public name: EventName) { + super(`missing event: ${name}`) + } +} diff --git a/packages/data-transport-layer/src/services/l2-ingestion/handlers/transaction.ts b/packages/data-transport-layer/src/services/l2-ingestion/handlers/transaction.ts index 7a7c9b2a934f5..517274ea8fe55 100644 --- a/packages/data-transport-layer/src/services/l2-ingestion/handlers/transaction.ts +++ b/packages/data-transport-layer/src/services/l2-ingestion/handlers/transaction.ts @@ -11,6 +11,7 @@ import { TransactionEntry, } from '../../../types' import { parseSignatureVParam } from '../../../utils' +import { MissingElementError } from './errors' export const handleSequencerBlock = { parseBlock: async ( @@ -22,9 +23,12 @@ export const handleSequencerBlock = { }> => { const transaction = block.transactions[0] const transactionIndex = - transaction.index === null || transaction.index === undefined - ? BigNumber.from(transaction.blockNumber).toNumber() - 1 - : BigNumber.from(transaction.index).toNumber() + BigNumber.from(transaction.blockNumber).toNumber() - 1 + + // We make the assumption that you don't need to sync the genesis block + if (transactionIndex < 0) { + throw new Error('should not happen, attempted to sync genesis block') + } let transactionEntry: Partial = { // Legacy support. @@ -111,6 +115,17 @@ export const handleSequencerBlock = { }, db: TransportDB ): Promise => { + if (entry.transactionEntry.index > 0) { + const prevTransactionEntry = await db.getUnconfirmedTransactionByIndex( + entry.transactionEntry.index - 1 + ) + + // We should *always* have a previous transaction here. + if (prevTransactionEntry === null) { + throw new MissingElementError('SequencerTransaction') + } + } + // Having separate indices for confirmed/unconfirmed means we never have to worry about // accidentally overwriting a confirmed transaction with an unconfirmed one. Unconfirmed // transactions are purely extra information. diff --git a/packages/data-transport-layer/src/services/l2-ingestion/service.ts b/packages/data-transport-layer/src/services/l2-ingestion/service.ts index 6303a2d28208b..ab9969248241c 100644 --- a/packages/data-transport-layer/src/services/l2-ingestion/service.ts +++ b/packages/data-transport-layer/src/services/l2-ingestion/service.ts @@ -107,7 +107,58 @@ export class L2IngestionService extends BaseService { : this.options.l2RpcProvider } + protected async ensure(): Promise { + let retries = 0 + while (true) { + try { + await this.state.l2RpcProvider.getNetwork() + break + } catch (e) { + retries++ + this.logger.info(`Cannot connect to L2, retrying ${retries}/20`) + if (retries >= 20) { + this.logger.info('Cannot connect to L2, shutting down') + await this.stop() + process.exit() + } + await sleep(1000 * retries) + } + } + } + + protected async checkConsistency(): Promise { + const network = await this.state.l2RpcProvider.getNetwork() + const shouldDoCheck = !(await this.state.db.getConsistencyCheckFlag()) + if (shouldDoCheck && network.chainId === 69) { + this.logger.info('performing consistency check') + const highestBlock = + await this.state.db.getHighestSyncedUnconfirmedBlock() + for (let i = 0; i < highestBlock; i++) { + const block = await this.state.db.getUnconfirmedTransactionByIndex(i) + if (block === null) { + this.logger.info('resetting to null block', { + index: i, + }) + await this.state.db.setHighestSyncedUnconfirmedBlock(i) + break + } + + // Log some progress so people know what's goin on. + if (i % 10000 === 0) { + this.logger.info(`consistency check progress`, { + index: i, + }) + } + } + this.logger.info('consistency check complete') + await this.state.db.putConsistencyCheckFlag(true) + } + } + protected async _start(): Promise { + await this.ensure() + await this.checkConsistency() + while (this.running) { try { const highestSyncedL2BlockNumber =