From 9c58502b81c42eab083ccf1367c536742333ed06 Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Sun, 7 Jul 2024 00:06:51 +0800 Subject: [PATCH 1/3] remove event-watcher --- .github/workflows/docker.yml | 45 --- bridge-history-api/cmd/api/app/app.go | 2 +- bridge-history-api/cmd/fetcher/app/app.go | 2 +- build/dockerfiles/event_watcher.Dockerfile | 29 -- .../event_watcher.Dockerfile.dockerignore | 5 - common/utils/simulation.go | 9 - rollup/Makefile | 8 +- rollup/README.md | 2 - rollup/abi/bridge_abi.go | 173 +---------- rollup/abi/bridge_abi_test.go | 36 --- rollup/cmd/event_watcher/app/app.go | 97 ------ rollup/cmd/event_watcher/main.go | 7 - rollup/cmd/gas_oracle/app/app.go | 2 +- rollup/cmd/mock_app.go | 5 +- rollup/conf/config.json | 2 - rollup/internal/config/l1.go | 5 - rollup/internal/controller/watcher/common.go | 2 - .../internal/controller/watcher/l1_watcher.go | 193 +----------- .../controller/watcher/l1_watcher_metrics.go | 29 +- .../controller/watcher/l1_watcher_test.go | 290 +----------------- .../internal/controller/watcher/l2_watcher.go | 4 - .../controller/watcher/watcher_test.go | 5 - rollup/internal/utils/utils.go | 58 ---- rollup/internal/utils/utils_test.go | 49 --- rollup/tests/bridge_test.go | 1 - rollup/tests/gas_oracle_test.go | 4 +- rollup/tests/process_start_test.go | 10 +- rollup/tests/rollup_test.go | 32 -- 28 files changed, 13 insertions(+), 1093 deletions(-) delete mode 100644 build/dockerfiles/event_watcher.Dockerfile delete mode 100644 build/dockerfiles/event_watcher.Dockerfile.dockerignore delete mode 100644 rollup/cmd/event_watcher/app/app.go delete mode 100644 rollup/cmd/event_watcher/main.go delete mode 100644 rollup/internal/utils/utils_test.go diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 83a412bfd6..9db5add1df 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -9,51 +9,6 @@ env: AWS_REGION: us-west-2 jobs: - event_watcher: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Configure AWS credentials - uses: aws-actions/configure-aws-credentials@v4 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ env.AWS_REGION }} - - name: Login to Amazon ECR - id: login-ecr - uses: aws-actions/amazon-ecr-login@v2 - - name: check repo and create it if not exist - env: - REPOSITORY: event-watcher - run: | - aws --region ${{ env.AWS_REGION }} ecr describe-repositories --repository-names ${{ env.REPOSITORY }} && : || aws --region ${{ env.AWS_REGION }} ecr create-repository --repository-name ${{ env.REPOSITORY }} - - name: Build and push - uses: docker/build-push-action@v3 - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - REPOSITORY: event-watcher - IMAGE_TAG: ${{ github.ref_name }} - with: - context: . - file: ./build/dockerfiles/event_watcher.Dockerfile - platforms: linux/amd64,linux/arm64 - push: true - tags: | - ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }} - ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.REPOSITORY }}:latest - ${{ env.ECR_REGISTRY }}/${{ env.REPOSITORY }}:${{ env.IMAGE_TAG }} - ${{ env.ECR_REGISTRY }}/${{ env.REPOSITORY }}:latest - gas_oracle: runs-on: ubuntu-latest steps: diff --git a/bridge-history-api/cmd/api/app/app.go b/bridge-history-api/cmd/api/app/app.go index 5316ed42dd..12c07d732a 100644 --- a/bridge-history-api/cmd/api/app/app.go +++ b/bridge-history-api/cmd/api/app/app.go @@ -96,7 +96,7 @@ func action(ctx *cli.Context) error { return nil } -// Run event watcher cmd instance. +// Run bridge-history-backend api cmd instance. func Run() { if err := app.Run(os.Args); err != nil { _, _ = fmt.Fprintln(os.Stderr, err) diff --git a/bridge-history-api/cmd/fetcher/app/app.go b/bridge-history-api/cmd/fetcher/app/app.go index fad766ada4..d055c119eb 100644 --- a/bridge-history-api/cmd/fetcher/app/app.go +++ b/bridge-history-api/cmd/fetcher/app/app.go @@ -84,7 +84,7 @@ func action(ctx *cli.Context) error { return nil } -// Run event watcher cmd instance. +// Run bridge-history-backend fetcher cmd instance. func Run() { if err := app.Run(os.Args); err != nil { _, _ = fmt.Fprintln(os.Stderr, err) diff --git a/build/dockerfiles/event_watcher.Dockerfile b/build/dockerfiles/event_watcher.Dockerfile deleted file mode 100644 index b26427ce62..0000000000 --- a/build/dockerfiles/event_watcher.Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -# Download Go dependencies -FROM scrolltech/go-rust-builder:go-1.21-rust-nightly-2023-12-03 as base - -WORKDIR /src -COPY go.work* ./ -COPY ./rollup/go.* ./rollup/ -COPY ./common/go.* ./common/ -COPY ./coordinator/go.* ./coordinator/ -COPY ./database/go.* ./database/ -COPY ./prover/go.* ./prover/ -COPY ./tests/integration-test/go.* ./tests/integration-test/ -COPY ./bridge-history-api/go.* ./bridge-history-api/ -RUN go mod download -x - -# Build event_watcher -FROM base as builder - -RUN --mount=target=. \ - --mount=type=cache,target=/root/.cache/go-build \ - cd /src/rollup/cmd/event_watcher/ && CGO_LDFLAGS="-ldl" go build -v -p 4 -o /bin/event_watcher - -# Pull event_watcher into a second stage deploy alpine container -FROM ubuntu:20.04 - -ENV CGO_LDFLAGS="-ldl" - -COPY --from=builder /bin/event_watcher /bin/ -WORKDIR /app -ENTRYPOINT ["event_watcher"] \ No newline at end of file diff --git a/build/dockerfiles/event_watcher.Dockerfile.dockerignore b/build/dockerfiles/event_watcher.Dockerfile.dockerignore deleted file mode 100644 index 8734d3f9b6..0000000000 --- a/build/dockerfiles/event_watcher.Dockerfile.dockerignore +++ /dev/null @@ -1,5 +0,0 @@ -assets/ -docs/ -l2geth/ -rpc-gateway/ -*target/* \ No newline at end of file diff --git a/common/utils/simulation.go b/common/utils/simulation.go index bff7ff4acc..9116b69943 100644 --- a/common/utils/simulation.go +++ b/common/utils/simulation.go @@ -12,12 +12,8 @@ import ( type MockAppName string var ( - // EventWatcherApp the name of mock event-watcher app. - EventWatcherApp MockAppName = "event-watcher-test" // GasOracleApp the name of mock gas-oracle app. GasOracleApp MockAppName = "gas-oracle-test" - // MessageRelayerApp the name of mock message-relayer app. - MessageRelayerApp MockAppName = "message-relayer-test" // RollupRelayerApp the name of mock rollup-relayer app. RollupRelayerApp MockAppName = "rollup-relayer-test" @@ -28,11 +24,6 @@ var ( CoordinatorAPIApp MockAppName = "coordinator-api-test" // CoordinatorCronApp the name of mock coordinator cron app. CoordinatorCronApp MockAppName = "coordinator-cron-test" - - // ChunkProverApp the name of mock chunk prover app. - ChunkProverApp MockAppName = "chunkProver-test" - // BatchProverApp the name of mock batch prover app. - BatchProverApp MockAppName = "batchProver-test" ) // RegisterSimulation register initializer function for integration-test. diff --git a/rollup/Makefile b/rollup/Makefile index 05e5397e7a..53ecfd1b76 100644 --- a/rollup/Makefile +++ b/rollup/Makefile @@ -1,4 +1,4 @@ -.PHONY: mock_abi libzstd rollup_bins event_watcher gas_oracle rollup_relayer test lint clean docker +.PHONY: mock_abi libzstd rollup_bins gas_oracle rollup_relayer test lint clean docker IMAGE_VERSION=latest REPO_ROOT_DIR=./.. @@ -9,13 +9,9 @@ mock_abi: cd .. && go run github.com/scroll-tech/go-ethereum/cmd/abigen --bin=./build/bin/MockBridge.bin --abi=./build/bin/MockBridge.abi --pkg=mock_bridge --out=./rollup/mock_bridge/MockBridge.go rollup_bins: ## Builds the Rollup bins. - go build -o $(PWD)/build/bin/event_watcher ./cmd/event_watcher/ go build -o $(PWD)/build/bin/gas_oracle ./cmd/gas_oracle/ go build -o $(PWD)/build/bin/rollup_relayer ./cmd/rollup_relayer/ -event_watcher: ## Builds the event_watcher bin - go build -o $(PWD)/build/bin/event_watcher ./cmd/event_watcher/ - gas_oracle: ## Builds the gas_oracle bin go build -o $(PWD)/build/bin/gas_oracle ./cmd/gas_oracle/ @@ -33,10 +29,8 @@ clean: ## Empty out the bin folder docker_push: docker push scrolltech/gas-oracle:${IMAGE_VERSION} - docker push scrolltech/event-watcher:${IMAGE_VERSION} docker push scrolltech/rollup-relayer:${IMAGE_VERSION} docker: DOCKER_BUILDKIT=1 docker build -t scrolltech/gas-oracle:${IMAGE_VERSION} ${REPO_ROOT_DIR}/ -f ${REPO_ROOT_DIR}/build/dockerfiles/gas_oracle.Dockerfile - DOCKER_BUILDKIT=1 docker build -t scrolltech/event-watcher:${IMAGE_VERSION} ${REPO_ROOT_DIR}/ -f ${REPO_ROOT_DIR}/build/dockerfiles/event_watcher.Dockerfile DOCKER_BUILDKIT=1 docker build -t scrolltech/rollup-relayer:${IMAGE_VERSION} ${REPO_ROOT_DIR}/ -f ${REPO_ROOT_DIR}/build/dockerfiles/rollup_relayer.Dockerfile diff --git a/rollup/README.md b/rollup/README.md index ba6b6806fc..6b53fb065e 100644 --- a/rollup/README.md +++ b/rollup/README.md @@ -1,7 +1,6 @@ # Rollup This directory contains the three essential rollup services for the Scroll chain: -- Event Watcher (event_watcher): watches the events emitted from the L1 and L2 contracts and updates the event database. - Gas Oracle (gas_oracle): monitors the L1 and L2 gas price and sends transactions to update the gas price oracle contracts on L1 and L2. - Rollup Relayer (rollup_relayer): consists of three components: chunk and batch proposer and a relayer. - The chunk and batch proposer proposes new chunks and batches that sends Commit Transactions for data availability and Finalize Transactions for proof verification and state finalization. @@ -31,7 +30,6 @@ make rollup_bins (Note: make sure you use different private keys for different senders in config.json.) ```bash -./build/bin/event_watcher --config ./conf/config.json ./build/bin/gas_oracle --config ./conf/config.json ./build/bin/rollup_relayer --config ./conf/config.json ``` diff --git a/rollup/abi/bridge_abi.go b/rollup/abi/bridge_abi.go index d273be7188..20e5831d53 100644 --- a/rollup/abi/bridge_abi.go +++ b/rollup/abi/bridge_abi.go @@ -1,209 +1,38 @@ package bridgeabi import ( - "math/big" - "github.com/scroll-tech/go-ethereum/accounts/abi" "github.com/scroll-tech/go-ethereum/accounts/abi/bind" - "github.com/scroll-tech/go-ethereum/common" ) var ( // ScrollChainABI holds information about ScrollChain's context and available invokable methods. ScrollChainABI *abi.ABI - // L1MessageQueueABI holds information about L1MessageQueue contract's context and available invokable methods. - L1MessageQueueABI *abi.ABI // L2GasPriceOracleABI holds information about L2GasPriceOracle's context and available invokable methods. L2GasPriceOracleABI *abi.ABI - - // L2ScrollMessengerABI holds information about L2ScrollMessenger's context and available invokable methods. - L2ScrollMessengerABI *abi.ABI // L1GasPriceOracleABI holds information about L1GasPriceOracle's context and available invokable methods. L1GasPriceOracleABI *abi.ABI - // L2MessageQueueABI holds information about L2MessageQueue contract's context and available invokable methods. - L2MessageQueueABI *abi.ABI - - // L1CommitBatchEventSignature = keccak256("CommitBatch(uint256,bytes32)") - L1CommitBatchEventSignature common.Hash - // L1FinalizeBatchEventSignature = keccak256("FinalizeBatch(uint256,bytes32,bytes32,bytes32)") - L1FinalizeBatchEventSignature common.Hash - // L1QueueTransactionEventSignature = keccak256("QueueTransaction(address,address,uint256,uint64,uint256,bytes)") - L1QueueTransactionEventSignature common.Hash - - // L2SentMessageEventSignature = keccak256("SentMessage(address,address,uint256,uint256,uint256,bytes,uint256,uint256)") - L2SentMessageEventSignature common.Hash - // L2RelayedMessageEventSignature = keccak256("RelayedMessage(bytes32)") - L2RelayedMessageEventSignature common.Hash - // L2FailedRelayedMessageEventSignature = keccak256("FailedRelayedMessage(bytes32)") - L2FailedRelayedMessageEventSignature common.Hash - - // L2AppendMessageEventSignature = keccak256("AppendMessage(uint256,bytes32)") - L2AppendMessageEventSignature common.Hash ) func init() { ScrollChainABI, _ = ScrollChainMetaData.GetAbi() - L1MessageQueueABI, _ = L1MessageQueueMetaData.GetAbi() L2GasPriceOracleABI, _ = L2GasPriceOracleMetaData.GetAbi() - - L2ScrollMessengerABI, _ = L2ScrollMessengerMetaData.GetAbi() - L2MessageQueueABI, _ = L2MessageQueueMetaData.GetAbi() L1GasPriceOracleABI, _ = L1GasPriceOracleMetaData.GetAbi() - - L1CommitBatchEventSignature = ScrollChainABI.Events["CommitBatch"].ID - L1FinalizeBatchEventSignature = ScrollChainABI.Events["FinalizeBatch"].ID - - L1QueueTransactionEventSignature = L1MessageQueueABI.Events["QueueTransaction"].ID - - L2SentMessageEventSignature = L2ScrollMessengerABI.Events["SentMessage"].ID - L2RelayedMessageEventSignature = L2ScrollMessengerABI.Events["RelayedMessage"].ID - L2FailedRelayedMessageEventSignature = L2ScrollMessengerABI.Events["FailedRelayedMessage"].ID - - L2AppendMessageEventSignature = L2MessageQueueABI.Events["AppendMessage"].ID } -// Generated manually from abigen and only necessary events and mutable calls are kept. +// Generated manually from abigen. // ScrollChainMetaData contains all meta data concerning the ScrollChain contract. var ScrollChainMetaData = &bind.MetaData{ ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"batchHash\",\"type\":\"bytes32\"}],\"name\":\"CommitBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"batchHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"stateRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"withdrawRoot\",\"type\":\"bytes32\"}],\"name\":\"FinalizeBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"batchHash\",\"type\":\"bytes32\"}],\"name\":\"RevertBatch\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldMaxNumTxInChunk\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newMaxNumTxInChunk\",\"type\":\"uint256\"}],\"name\":\"UpdateMaxNumTxInChunk\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"UpdateProver\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"status\",\"type\":\"bool\"}],\"name\":\"UpdateSequencer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"},{\"internalType\":\"bytes\",\"name\":\"parentBatchHeader\",\"type\":\"bytes\"},{\"internalType\":\"bytes[]\",\"name\":\"chunks\",\"type\":\"bytes[]\"},{\"internalType\":\"bytes\",\"name\":\"skippedL1MessageBitmap\",\"type\":\"bytes\"}],\"name\":\"commitBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"committedBatches\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"batchHeader\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"prevStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"postStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"withdrawRoot\",\"type\":\"bytes32\"}],\"name\":\"finalizeBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"batchHeader\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"prevStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"postStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"withdrawRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"blobDataProof\",\"type\":\"bytes\"}],\"name\":\"finalizeBatch4844\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"batchHeader\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"prevStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"postStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"withdrawRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"aggrProof\",\"type\":\"bytes\"}],\"name\":\"finalizeBatchWithProof\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"batchHeader\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"prevStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"postStateRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"withdrawRoot\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"blobDataProof\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"aggrProof\",\"type\":\"bytes\"}],\"name\":\"finalizeBatchWithProof4844\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"finalizedStateRoots\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_batchHeader\",\"type\":\"bytes\"},{\"internalType\":\"bytes32\",\"name\":\"_stateRoot\",\"type\":\"bytes32\"}],\"name\":\"importGenesisBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"isBatchFinalized\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastFinalizedBatchIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"batchHeader\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"}],\"name\":\"revertBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"}],\"name\":\"withdrawRoots\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", } -// L1ScrollMessengerMetaData contains all meta data concerning the L1ScrollMessenger contract. -var L1ScrollMessengerMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"}],\"name\":\"FailedRelayedMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"}],\"name\":\"RelayedMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"messageNonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"SentMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_oldFeeVault\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newFeeVault\",\"type\":\"address\"}],\"name\":\"UpdateFeeVault\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"counterpart\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeVault\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_counterpart\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_feeVault\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_rollup\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_messageQueue\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"isL1MessageRelayed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"isL1MessageSent\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"isL2MessageExecuted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messageQueue\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"batchIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"merkleProof\",\"type\":\"bytes\"}],\"internalType\":\"struct IL1ScrollMessenger.L2MessageProof\",\"name\":\"_proof\",\"type\":\"tuple\"}],\"name\":\"relayMessageWithProof\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_queueIndex\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"internalType\":\"uint32\",\"name\":\"_newGasLimit\",\"type\":\"uint32\"},{\"internalType\":\"address\",\"name\":\"_refundAddress\",\"type\":\"address\"}],\"name\":\"replayMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"rollup\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_refundAddress\",\"type\":\"address\"}],\"name\":\"sendMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"}],\"name\":\"sendMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_status\",\"type\":\"bool\"}],\"name\":\"setPause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newFeeVault\",\"type\":\"address\"}],\"name\":\"updateFeeVault\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"xDomainMessageSender\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]\n", -} - -// L1MessageQueueMetaData contains all meta data concerning the L1MessageQueue contract. -var L1MessageQueueMetaData = &bind.MetaData{ - ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"startIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"count\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"skippedBitmap\",\"type\":\"uint256\"}],\"name\":\"DequeueTransaction\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint64\",\"name\":\"queueIndex\",\"type\":\"uint64\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"QueueTransaction\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_oldGateway\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newGateway\",\"type\":\"address\"}],\"name\":\"UpdateEnforcedTxGateway\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_oldGasOracle\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newGasOracle\",\"type\":\"address\"}],\"name\":\"UpdateGasOracle\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_oldMaxGasLimit\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_newMaxGasLimit\",\"type\":\"uint256\"}],\"name\":\"UpdateMaxGasLimit\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"appendCrossDomainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"appendEnforcedTransaction\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_calldata\",\"type\":\"bytes\"}],\"name\":\"calculateIntrinsicGasFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_queueIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"computeTransactionHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"enforcedTxGateway\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"}],\"name\":\"estimateCrossDomainMessageFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gasOracle\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_queueIndex\",\"type\":\"uint256\"}],\"name\":\"getCrossDomainMessage\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_messenger\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_scrollChain\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_enforcedTxGateway\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_gasOracle\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_maxGasLimit\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxGasLimit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"messageQueue\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messenger\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextCrossDomainMessageIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pendingQueueIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_startIndex\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_skippedBitmap\",\"type\":\"uint256\"}],\"name\":\"popCrossDomainMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"scrollChain\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newGateway\",\"type\":\"address\"}],\"name\":\"updateEnforcedTxGateway\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newGasOracle\",\"type\":\"address\"}],\"name\":\"updateGasOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_newMaxGasLimit\",\"type\":\"uint256\"}],\"name\":\"updateMaxGasLimit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", -} - // L2GasPriceOracleMetaData contains all meta data concerning the L2GasPriceOracle contract. var L2GasPriceOracleMetaData = &bind.MetaData{ ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"txGas\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"txGasContractCreation\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"zeroGas\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"nonZeroGas\",\"type\":\"uint256\"}],\"name\":\"IntrinsicParamsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"l2BaseFee\",\"type\":\"uint256\"}],\"name\":\"L2BaseFeeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_oldWhitelist\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newWhitelist\",\"type\":\"address\"}],\"name\":\"UpdateWhitelist\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"}],\"name\":\"calculateIntrinsicGasFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"}],\"name\":\"estimateCrossDomainMessageFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_txGas\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"_txGasContractCreation\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"_zeroGas\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"_nonZeroGas\",\"type\":\"uint64\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"intrinsicParams\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"txGas\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"txGasContractCreation\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"zeroGas\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"nonZeroGas\",\"type\":\"uint64\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l2BaseFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint64\",\"name\":\"_txGas\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"_txGasContractCreation\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"_zeroGas\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"_nonZeroGas\",\"type\":\"uint64\"}],\"name\":\"setIntrinsicParams\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_l2BaseFee\",\"type\":\"uint256\"}],\"name\":\"setL2BaseFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newWhitelist\",\"type\":\"address\"}],\"name\":\"updateWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"whitelist\",\"outputs\":[{\"internalType\":\"contract IWhitelist\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]\n", } -// L2ScrollMessengerMetaData contains all meta data concerning the L2ScrollMessenger contract. -var L2ScrollMessengerMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_blockContainer\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_gasOracle\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_messageQueue\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"}],\"name\":\"FailedRelayedMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"}],\"name\":\"RelayedMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"messageNonce\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"gasLimit\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"SentMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_oldFeeVault\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newFeeVault\",\"type\":\"address\"}],\"name\":\"UpdateFeeVault\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxFailedExecutionTimes\",\"type\":\"uint256\"}],\"name\":\"UpdateMaxFailedExecutionTimes\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"blockContainer\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"counterpart\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeVault\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"gasOracle\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_counterpart\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_feeVault\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"isL1MessageExecuted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"isL2MessageSent\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"l1MessageFailedTimes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxFailedExecutionTimes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messageQueue\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"}],\"name\":\"relayMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_nonce\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"stateRootProof\",\"type\":\"bytes\"}],\"internalType\":\"struct IL2ScrollMessenger.L1MessageProof\",\"name\":\"_proof\",\"type\":\"tuple\"}],\"name\":\"retryMessageWithProof\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"sendMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_value\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_gasLimit\",\"type\":\"uint256\"}],\"name\":\"sendMessage\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_status\",\"type\":\"bool\"}],\"name\":\"setPause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newFeeVault\",\"type\":\"address\"}],\"name\":\"updateFeeVault\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxFailedExecutionTimes\",\"type\":\"uint256\"}],\"name\":\"updateMaxFailedExecutionTimes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_blockHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_msgHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"_proof\",\"type\":\"bytes\"}],\"name\":\"verifyMessageExecutionStatus\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_blockHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_msgHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"_proof\",\"type\":\"bytes\"}],\"name\":\"verifyMessageInclusionStatus\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"xDomainMessageSender\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}]\n", -} - -// L1BlockContainerMetaData contains all meta data concerning the L1BlockContainer contract. -var L1BlockContainerMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"blockHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"blockHeight\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"blockTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"baseFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"stateRoot\",\"type\":\"bytes32\"}],\"name\":\"ImportBlock\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_oldOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_oldWhitelist\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_newWhitelist\",\"type\":\"address\"}],\"name\":\"UpdateWhitelist\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_blockHash\",\"type\":\"bytes32\"}],\"name\":\"getBlockTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_blockHash\",\"type\":\"bytes32\"}],\"name\":\"getStateRoot\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_blockHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"_blockHeaderRLP\",\"type\":\"bytes\"},{\"internalType\":\"bool\",\"name\":\"_updateGasPriceOracle\",\"type\":\"bool\"}],\"name\":\"importBlockHeader\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_startBlockHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint64\",\"name\":\"_startBlockHeight\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"_startBlockTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint128\",\"name\":\"_startBlockBaseFee\",\"type\":\"uint128\"},{\"internalType\":\"bytes32\",\"name\":\"_startStateRoot\",\"type\":\"bytes32\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestBaseFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestBlockHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestBlockNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"latestBlockTimestamp\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"metadata\",\"outputs\":[{\"internalType\":\"uint64\",\"name\":\"height\",\"type\":\"uint64\"},{\"internalType\":\"uint64\",\"name\":\"timestamp\",\"type\":\"uint64\"},{\"internalType\":\"uint128\",\"name\":\"baseFee\",\"type\":\"uint128\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"stateRoot\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newWhitelist\",\"type\":\"address\"}],\"name\":\"updateWhitelist\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"whitelist\",\"outputs\":[{\"internalType\":\"contract IWhitelist\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]\n", -} - -// L2MessageQueueMetaData contains all meta data concerning the L2MessageQueue contract. -var L2MessageQueueMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"}],\"name\":\"AppendMessage\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_oldOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_messageHash\",\"type\":\"bytes32\"}],\"name\":\"appendMessage\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"branches\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messageRoot\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"messenger\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nextMessageIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_messenger\",\"type\":\"address\"}],\"name\":\"updateMessenger\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]\n", -} - // L1GasPriceOracleMetaData contains all meta data concerning the L1GasPriceOracle contract. var L1GasPriceOracleMetaData = &bind.MetaData{ ABI: "[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"scalar\",\"type\":\"uint256\"}],\"name\":\"BlobScalarUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"scalar\",\"type\":\"uint256\"}],\"name\":\"CommitScalarUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"l1BaseFee\",\"type\":\"uint256\"}],\"name\":\"L1BaseFeeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"l1BlobBaseFee\",\"type\":\"uint256\"}],\"name\":\"L1BlobBaseFeeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"overhead\",\"type\":\"uint256\"}],\"name\":\"OverheadUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"scalar\",\"type\":\"uint256\"}],\"name\":\"ScalarUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"blobScalar\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"commitScalar\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"getL1Fee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"getL1GasUsed\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1BaseFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"l1BlobBaseFee\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"overhead\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"scalar\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_l1BaseFee\",\"type\":\"uint256\"}],\"name\":\"setL1BaseFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_l1BaseFee\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_l1BlobBaseFee\",\"type\":\"uint256\"}],\"name\":\"setL1BaseFeeAndBlobBaseFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } - -// IL1ScrollMessengerL2MessageProof is an auto generated low-level Go binding around an user-defined struct. -type IL1ScrollMessengerL2MessageProof struct { - BatchIndex *big.Int - MerkleProof []byte -} - -// IScrollChainBatch is an auto generated low-level Go binding around an user-defined struct. -type IScrollChainBatch struct { - Blocks []IScrollChainBlockContext - PrevStateRoot common.Hash - NewStateRoot common.Hash - WithdrawTrieRoot common.Hash - BatchIndex uint64 - ParentBatchHash common.Hash - L2Transactions []byte -} - -// IScrollChainBlockContext is an auto generated low-level Go binding around an user-defined struct. -type IScrollChainBlockContext struct { - BlockHash common.Hash - ParentHash common.Hash - BlockNumber uint64 - Timestamp uint64 - BaseFee *big.Int - GasLimit uint64 - NumTransactions uint16 - NumL1Messages uint16 -} - -// L1CommitBatchEvent represents a CommitBatch event raised by the ScrollChain contract. -type L1CommitBatchEvent struct { - BatchIndex *big.Int - BatchHash common.Hash -} - -// L1FinalizeBatchEvent represents a FinalizeBatch event raised by the ScrollChain contract. -type L1FinalizeBatchEvent struct { - BatchIndex *big.Int - BatchHash common.Hash - StateRoot common.Hash - WithdrawRoot common.Hash -} - -// L1RevertBatchEvent represents a RevertBatch event raised by the ScrollChain contract. -type L1RevertBatchEvent struct { - BatchHash common.Hash -} - -// L1QueueTransactionEvent represents a QueueTransaction event raised by the L1MessageQueue contract. -type L1QueueTransactionEvent struct { - Sender common.Address - Target common.Address - Value *big.Int - QueueIndex uint64 - GasLimit *big.Int - Data []byte -} - -// L1SentMessageEvent represents a SentMessage event raised by the L1ScrollMessenger contract. -type L1SentMessageEvent struct { - Sender common.Address - Target common.Address - Value *big.Int - MessageNonce *big.Int - GasLimit *big.Int - Message []byte -} - -// L1FailedRelayedMessageEvent represents a FailedRelayedMessage event raised by the L1ScrollMessenger contract. -type L1FailedRelayedMessageEvent struct { - MessageHash common.Hash -} - -// L1RelayedMessageEvent represents a RelayedMessage event raised by the L1ScrollMessenger contract. -type L1RelayedMessageEvent struct { - MessageHash common.Hash -} - -// L2AppendMessageEvent represents a AppendMessage event raised by the L2MessageQueue contract. -type L2AppendMessageEvent struct { - Index *big.Int - MessageHash common.Hash -} - -// L2SentMessageEvent represents a SentMessage event raised by the L2ScrollMessenger contract. -type L2SentMessageEvent struct { - Sender common.Address - Target common.Address - Value *big.Int - MessageNonce *big.Int - GasLimit *big.Int - Message []byte -} - -// L2FailedRelayedMessageEvent represents a FailedRelayedMessage event raised by the L2ScrollMessenger contract. -type L2FailedRelayedMessageEvent struct { - MessageHash common.Hash -} - -// L2RelayedMessageEvent represents a RelayedMessage event raised by the L2ScrollMessenger contract. -type L2RelayedMessageEvent struct { - MessageHash common.Hash -} diff --git a/rollup/abi/bridge_abi_test.go b/rollup/abi/bridge_abi_test.go index b3ecb3cfea..70ab6564ba 100644 --- a/rollup/abi/bridge_abi_test.go +++ b/rollup/abi/bridge_abi_test.go @@ -8,32 +8,6 @@ import ( "github.com/stretchr/testify/assert" ) -func TestEventSignature(t *testing.T) { - assert := assert.New(t) - - assert.Equal(L1CommitBatchEventSignature, common.HexToHash("2c32d4ae151744d0bf0b9464a3e897a1d17ed2f1af71f7c9a75f12ce0d28238f")) - assert.Equal(L1FinalizeBatchEventSignature, common.HexToHash("26ba82f907317eedc97d0cbef23de76a43dd6edb563bdb6e9407645b950a7a2d")) - - assert.Equal(L2SentMessageEventSignature, common.HexToHash("104371f3b442861a2a7b82a070afbbaab748bb13757bf47769e170e37809ec1e")) - assert.Equal(L2RelayedMessageEventSignature, common.HexToHash("4641df4a962071e12719d8c8c8e5ac7fc4d97b927346a3d7a335b1f7517e133c")) - assert.Equal(L2FailedRelayedMessageEventSignature, common.HexToHash("99d0e048484baa1b1540b1367cb128acd7ab2946d1ed91ec10e3c85e4bf51b8f")) - - assert.Equal(L2AppendMessageEventSignature, common.HexToHash("faa617c2d8ce12c62637dbce76efcc18dae60574aa95709bdcedce7e76071693")) -} - -func TestPackRelayL2MessageWithProof(t *testing.T) { - assert := assert.New(t) - l1MessengerABI, err := L1ScrollMessengerMetaData.GetAbi() - assert.NoError(err) - - proof := IL1ScrollMessengerL2MessageProof{ - BatchIndex: big.NewInt(0), - MerkleProof: []byte{}, - } - _, err = l1MessengerABI.Pack("relayMessageWithProof", common.Address{}, common.Address{}, big.NewInt(0), big.NewInt(0), []byte{}, proof) - assert.NoError(err) -} - func TestPackCommitBatch(t *testing.T) { assert := assert.New(t) @@ -78,16 +52,6 @@ func TestPackImportGenesisBatch(t *testing.T) { assert.NoError(err) } -func TestPackRelayL1Message(t *testing.T) { - assert := assert.New(t) - - l2MessengerABI, err := L2ScrollMessengerMetaData.GetAbi() - assert.NoError(err) - - _, err = l2MessengerABI.Pack("relayMessage", common.Address{}, common.Address{}, big.NewInt(0), big.NewInt(0), []byte{}) - assert.NoError(err) -} - func TestPackSetL1BaseFee(t *testing.T) { assert := assert.New(t) diff --git a/rollup/cmd/event_watcher/app/app.go b/rollup/cmd/event_watcher/app/app.go deleted file mode 100644 index bf060b6cb3..0000000000 --- a/rollup/cmd/event_watcher/app/app.go +++ /dev/null @@ -1,97 +0,0 @@ -package app - -import ( - "context" - "fmt" - "os" - "os/signal" - "time" - - "github.com/prometheus/client_golang/prometheus" - "github.com/scroll-tech/go-ethereum/ethclient" - "github.com/scroll-tech/go-ethereum/log" - "github.com/urfave/cli/v2" - - "scroll-tech/common/database" - "scroll-tech/common/observability" - "scroll-tech/common/utils" - "scroll-tech/common/version" - - "scroll-tech/rollup/internal/config" - "scroll-tech/rollup/internal/controller/watcher" -) - -var app *cli.App - -func init() { - // Set up event-watcher app info. - app = cli.NewApp() - app.Action = action - app.Name = "event-watcher" - app.Usage = "The Scroll Event Watcher" - app.Version = version.Version - app.Flags = append(app.Flags, utils.CommonFlags...) - app.Commands = []*cli.Command{} - app.Before = func(ctx *cli.Context) error { - return utils.LogSetup(ctx) - } - // Register `event-watcher-test` app for integration-test. - utils.RegisterSimulation(app, utils.EventWatcherApp) -} - -func action(ctx *cli.Context) error { - // Load config file. - cfgFile := ctx.String(utils.ConfigFileFlag.Name) - cfg, err := config.NewConfig(cfgFile) - if err != nil { - log.Crit("failed to load config file", "config file", cfgFile, "error", err) - } - - subCtx, cancel := context.WithCancel(ctx.Context) - // Init db connection - db, err := database.InitDB(cfg.DBConfig) - if err != nil { - log.Crit("failed to init db connection", "err", err) - } - defer func() { - cancel() - if err = database.CloseDB(db); err != nil { - log.Crit("failed to close db connection", "error", err) - } - }() - - registry := prometheus.DefaultRegisterer - observability.Server(ctx, db) - l1client, err := ethclient.Dial(cfg.L1Config.Endpoint) - if err != nil { - log.Crit("failed to connect l1 geth", "config file", cfgFile, "error", err) - } - - l1watcher := watcher.NewL1WatcherClient(ctx.Context, l1client, cfg.L1Config.StartHeight, cfg.L1Config.Confirmations, - cfg.L1Config.L1MessageQueueAddress, cfg.L1Config.ScrollChainContractAddress, db, registry) - - go utils.Loop(subCtx, 10*time.Second, func() { - if loopErr := l1watcher.FetchContractEvent(); loopErr != nil { - log.Error("Failed to fetch bridge contract", "err", loopErr) - } - }) - - log.Info("Start event-watcher successfully", "version", version.Version) - - // Catch CTRL-C to ensure a graceful shutdown. - interrupt := make(chan os.Signal, 1) - signal.Notify(interrupt, os.Interrupt) - - // Wait until the interrupt signal is received from an OS signal. - <-interrupt - - return nil -} - -// Run event watcher cmd instance. -func Run() { - if err := app.Run(os.Args); err != nil { - _, _ = fmt.Fprintln(os.Stderr, err) - os.Exit(1) - } -} diff --git a/rollup/cmd/event_watcher/main.go b/rollup/cmd/event_watcher/main.go deleted file mode 100644 index 098c6421b2..0000000000 --- a/rollup/cmd/event_watcher/main.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "scroll-tech/rollup/cmd/event_watcher/app" - -func main() { - app.Run() -} diff --git a/rollup/cmd/gas_oracle/app/app.go b/rollup/cmd/gas_oracle/app/app.go index 51deda5013..81182bd429 100644 --- a/rollup/cmd/gas_oracle/app/app.go +++ b/rollup/cmd/gas_oracle/app/app.go @@ -84,7 +84,7 @@ func action(ctx *cli.Context) error { log.Crit("failed to read genesis", "genesis file", genesisPath, "error", err) } - l1watcher := watcher.NewL1WatcherClient(ctx.Context, l1client, cfg.L1Config.StartHeight, cfg.L1Config.Confirmations, cfg.L1Config.L1MessageQueueAddress, cfg.L1Config.ScrollChainContractAddress, db, registry) + l1watcher := watcher.NewL1WatcherClient(ctx.Context, l1client, cfg.L1Config.StartHeight, cfg.L1Config.Confirmations, db, registry) l1relayer, err := relayer.NewLayer1Relayer(ctx.Context, db, cfg.L1Config.RelayerConfig, genesis.Config, relayer.ServiceTypeL1GasOracle, registry) if err != nil { diff --git a/rollup/cmd/mock_app.go b/rollup/cmd/mock_app.go index a3919ace04..3489a539f6 100644 --- a/rollup/cmd/mock_app.go +++ b/rollup/cmd/mock_app.go @@ -45,10 +45,7 @@ func NewRollupApp(testApps *testcontainers.TestcontainerApps, file string) *Mock // RunApp run rollup-test child process by multi parameters. func (b *MockApp) RunApp(t *testing.T, name utils.MockAppName, args ...string) { - if !(name == utils.EventWatcherApp || - name == utils.GasOracleApp || - name == utils.MessageRelayerApp || - name == utils.RollupRelayerApp) { + if !(name == utils.GasOracleApp || name == utils.RollupRelayerApp) { t.Errorf(fmt.Sprintf("Don't support the mock app, name: %s", name)) return } diff --git a/rollup/conf/config.json b/rollup/conf/config.json index 7f2a996600..2a8cdea96d 100644 --- a/rollup/conf/config.json +++ b/rollup/conf/config.json @@ -2,8 +2,6 @@ "l1_config": { "confirmations": "0x6", "endpoint": "https://rpc.ankr.com/eth", - "l1_message_queue_address": "0x0000000000000000000000000000000000000000", - "scroll_chain_address": "0x0000000000000000000000000000000000000000", "start_height": 0, "relayer_config": { "gas_price_oracle_address": "0x0000000000000000000000000000000000000000", diff --git a/rollup/internal/config/l1.go b/rollup/internal/config/l1.go index 54b5dae168..584d635de3 100644 --- a/rollup/internal/config/l1.go +++ b/rollup/internal/config/l1.go @@ -1,7 +1,6 @@ package config import ( - "github.com/scroll-tech/go-ethereum/common" "github.com/scroll-tech/go-ethereum/rpc" ) @@ -13,10 +12,6 @@ type L1Config struct { Endpoint string `json:"endpoint"` // The start height to sync event from layer 1 StartHeight uint64 `json:"start_height"` - // The L1MessageQueue contract address deployed on layer 1 chain. - L1MessageQueueAddress common.Address `json:"l1_message_queue_address"` - // The ScrollChain contract address deployed on layer 1 chain. - ScrollChainContractAddress common.Address `json:"scroll_chain_address"` // The relayer config RelayerConfig *RelayerConfig `json:"relayer_config"` } diff --git a/rollup/internal/controller/watcher/common.go b/rollup/internal/controller/watcher/common.go index 555375326d..b2c19e0a89 100644 --- a/rollup/internal/controller/watcher/common.go +++ b/rollup/internal/controller/watcher/common.go @@ -1,5 +1,3 @@ package watcher -const contractEventsBlocksFetchLimit = int64(10) - const maxBlobSize = uint64(131072) diff --git a/rollup/internal/controller/watcher/l1_watcher.go b/rollup/internal/controller/watcher/l1_watcher.go index 201a84ce8b..d658831ef3 100644 --- a/rollup/internal/controller/watcher/l1_watcher.go +++ b/rollup/internal/controller/watcher/l1_watcher.go @@ -6,12 +6,8 @@ import ( "math/big" "github.com/prometheus/client_golang/prometheus" - geth "github.com/scroll-tech/go-ethereum" - "github.com/scroll-tech/go-ethereum/accounts/abi" - "github.com/scroll-tech/go-ethereum/common" "github.com/scroll-tech/go-ethereum/consensus/misc" gethTypes "github.com/scroll-tech/go-ethereum/core/types" - "github.com/scroll-tech/go-ethereum/crypto" "github.com/scroll-tech/go-ethereum/ethclient" "github.com/scroll-tech/go-ethereum/log" "github.com/scroll-tech/go-ethereum/rpc" @@ -19,17 +15,9 @@ import ( "scroll-tech/common/types" - bridgeAbi "scroll-tech/rollup/abi" "scroll-tech/rollup/internal/orm" - "scroll-tech/rollup/internal/utils" ) -type rollupEvent struct { - batchHash common.Hash - txHash common.Hash - status types.RollupStatus -} - // L1WatcherClient will listen for smart contract events from Eth L1. type L1WatcherClient struct { ctx context.Context @@ -41,12 +29,6 @@ type L1WatcherClient struct { // The number of new blocks to wait for a block to be confirmed confirmations rpc.BlockNumber - messageQueueAddress common.Address - messageQueueABI *abi.ABI - - scrollChainAddress common.Address - scrollChainABI *abi.ABI - // The height of the block that the watcher has retrieved event logs processedMsgHeight uint64 // The height of the block that the watcher has retrieved header rlp @@ -56,7 +38,7 @@ type L1WatcherClient struct { } // NewL1WatcherClient returns a new instance of L1WatcherClient. -func NewL1WatcherClient(ctx context.Context, client *ethclient.Client, startHeight uint64, confirmations rpc.BlockNumber, messageQueueAddress, scrollChainAddress common.Address, db *gorm.DB, reg prometheus.Registerer) *L1WatcherClient { +func NewL1WatcherClient(ctx context.Context, client *ethclient.Client, startHeight uint64, confirmations rpc.BlockNumber, db *gorm.DB, reg prometheus.Registerer) *L1WatcherClient { l1MessageOrm := orm.NewL1Message(db) savedHeight, err := l1MessageOrm.GetLayer1LatestWatchedHeight() if err != nil { @@ -85,12 +67,6 @@ func NewL1WatcherClient(ctx context.Context, client *ethclient.Client, startHeig batchOrm: orm.NewBatch(db), confirmations: confirmations, - messageQueueAddress: messageQueueAddress, - messageQueueABI: bridgeAbi.L1MessageQueueABI, - - scrollChainAddress: scrollChainAddress, - scrollChainABI: bridgeAbi.ScrollChainABI, - processedMsgHeight: uint64(savedHeight), processedBlockHeight: savedL1BlockHeight, metrics: initL1WatcherMetrics(reg), @@ -160,170 +136,3 @@ func (w *L1WatcherClient) FetchBlockHeader(blockHeight uint64) error { w.metrics.l1WatcherFetchBlockHeaderProcessedBlockHeight.Set(float64(w.processedBlockHeight)) return nil } - -// FetchContractEvent pull latest event logs from given contract address and save in DB -func (w *L1WatcherClient) FetchContractEvent() error { - defer func() { - log.Info("l1 watcher fetchContractEvent", "w.processedMsgHeight", w.processedMsgHeight) - }() - blockHeight, err := utils.GetLatestConfirmedBlockNumber(w.ctx, w.client, w.confirmations) - if err != nil { - log.Error("failed to get block number", "err", err) - return err - } - - fromBlock := int64(w.processedMsgHeight) + 1 - toBlock := int64(blockHeight) - - for from := fromBlock; from <= toBlock; from += contractEventsBlocksFetchLimit { - w.metrics.l1WatcherFetchContractEventTotal.Inc() - to := from + contractEventsBlocksFetchLimit - 1 - - if to > toBlock { - to = toBlock - } - - // warning: uint int conversion... - query := geth.FilterQuery{ - FromBlock: big.NewInt(from), // inclusive - ToBlock: big.NewInt(to), // inclusive - Addresses: []common.Address{ - w.scrollChainAddress, - w.messageQueueAddress, - }, - Topics: make([][]common.Hash, 1), - } - query.Topics[0] = make([]common.Hash, 3) - query.Topics[0][0] = bridgeAbi.L1QueueTransactionEventSignature - query.Topics[0][1] = bridgeAbi.L1CommitBatchEventSignature - query.Topics[0][2] = bridgeAbi.L1FinalizeBatchEventSignature - - logs, err := w.client.FilterLogs(w.ctx, query) - if err != nil { - log.Warn("Failed to get event logs", "err", err) - return err - } - if len(logs) == 0 { - w.processedMsgHeight = uint64(to) - w.metrics.l1WatcherFetchContractEventProcessedBlockHeight.Set(float64(to)) - continue - } - - log.Info("Received new L1 events", "fromBlock", from, "toBlock", to, "cnt", len(logs)) - - sentMessageEvents, rollupEvents, err := w.parseBridgeEventLogs(logs) - if err != nil { - log.Error("Failed to parse emitted events log", "err", err) - return err - } - sentMessageCount := int64(len(sentMessageEvents)) - rollupEventCount := int64(len(rollupEvents)) - w.metrics.l1WatcherFetchContractEventSentEventsTotal.Add(float64(sentMessageCount)) - w.metrics.l1WatcherFetchContractEventRollupEventsTotal.Add(float64(rollupEventCount)) - log.Info("L1 events types", "SentMessageCount", sentMessageCount, "RollupEventCount", rollupEventCount) - - // use rollup event to update rollup results db status - var batchHashes []string - for _, event := range rollupEvents { - batchHashes = append(batchHashes, event.batchHash.String()) - } - statuses, err := w.batchOrm.GetRollupStatusByHashList(w.ctx, batchHashes) - if err != nil { - log.Error("Failed to GetRollupStatusByHashList", "err", err) - return err - } - if len(statuses) != len(batchHashes) { - log.Error("RollupStatus.Length mismatch with batchHashes.Length", "RollupStatus.Length", len(statuses), "batchHashes.Length", len(batchHashes)) - return nil - } - - for index, event := range rollupEvents { - batchHash := event.batchHash.String() - status := statuses[index] - // only update when db status is before event status - if event.status > status { - if event.status == types.RollupFinalized { - err = w.batchOrm.UpdateFinalizeTxHashAndRollupStatus(w.ctx, batchHash, event.txHash.String(), event.status) - } else if event.status == types.RollupCommitted { - err = w.batchOrm.UpdateCommitTxHashAndRollupStatus(w.ctx, batchHash, event.txHash.String(), event.status) - } - if err != nil { - log.Error("Failed to update Rollup/Finalize TxHash and Status", "err", err) - return err - } - } - } - - if err = w.l1MessageOrm.SaveL1Messages(w.ctx, sentMessageEvents); err != nil { - return err - } - - w.processedMsgHeight = uint64(to) - w.metrics.l1WatcherFetchContractEventSuccessTotal.Inc() - w.metrics.l1WatcherFetchContractEventProcessedBlockHeight.Set(float64(w.processedMsgHeight)) - } - - return nil -} - -func (w *L1WatcherClient) parseBridgeEventLogs(logs []gethTypes.Log) ([]*orm.L1Message, []rollupEvent, error) { - // Need use contract abi to parse event Log - // Can only be tested after we have our contracts set up - var l1Messages []*orm.L1Message - var rollupEvents []rollupEvent - for _, vLog := range logs { - switch vLog.Topics[0] { - case bridgeAbi.L1QueueTransactionEventSignature: - event := bridgeAbi.L1QueueTransactionEvent{} - err := utils.UnpackLog(w.messageQueueABI, &event, "QueueTransaction", vLog) - if err != nil { - log.Warn("Failed to unpack layer1 QueueTransaction event", "err", err) - return l1Messages, rollupEvents, err - } - - msgHash := common.BytesToHash(crypto.Keccak256(event.Data)) - - l1Messages = append(l1Messages, &orm.L1Message{ - QueueIndex: event.QueueIndex, - MsgHash: msgHash.String(), - Height: vLog.BlockNumber, - Sender: event.Sender.String(), - Value: event.Value.String(), - Target: event.Target.String(), - Calldata: common.Bytes2Hex(event.Data), - GasLimit: event.GasLimit.Uint64(), - Layer1Hash: vLog.TxHash.Hex(), - }) - case bridgeAbi.L1CommitBatchEventSignature: - event := bridgeAbi.L1CommitBatchEvent{} - err := utils.UnpackLog(w.scrollChainABI, &event, "CommitBatch", vLog) - if err != nil { - log.Warn("Failed to unpack layer1 CommitBatch event", "err", err) - return l1Messages, rollupEvents, err - } - - rollupEvents = append(rollupEvents, rollupEvent{ - batchHash: event.BatchHash, - txHash: vLog.TxHash, - status: types.RollupCommitted, - }) - case bridgeAbi.L1FinalizeBatchEventSignature: - event := bridgeAbi.L1FinalizeBatchEvent{} - err := utils.UnpackLog(w.scrollChainABI, &event, "FinalizeBatch", vLog) - if err != nil { - log.Warn("Failed to unpack layer1 FinalizeBatch event", "err", err) - return l1Messages, rollupEvents, err - } - - rollupEvents = append(rollupEvents, rollupEvent{ - batchHash: event.BatchHash, - txHash: vLog.TxHash, - status: types.RollupFinalized, - }) - default: - log.Error("Unknown event", "topic", vLog.Topics[0], "txHash", vLog.TxHash) - } - } - - return l1Messages, rollupEvents, nil -} diff --git a/rollup/internal/controller/watcher/l1_watcher_metrics.go b/rollup/internal/controller/watcher/l1_watcher_metrics.go index c01c634182..4482e14144 100644 --- a/rollup/internal/controller/watcher/l1_watcher_metrics.go +++ b/rollup/internal/controller/watcher/l1_watcher_metrics.go @@ -8,13 +8,8 @@ import ( ) type l1WatcherMetrics struct { - l1WatcherFetchBlockHeaderTotal prometheus.Counter - l1WatcherFetchBlockHeaderProcessedBlockHeight prometheus.Gauge - l1WatcherFetchContractEventTotal prometheus.Counter - l1WatcherFetchContractEventSuccessTotal prometheus.Counter - l1WatcherFetchContractEventProcessedBlockHeight prometheus.Gauge - l1WatcherFetchContractEventSentEventsTotal prometheus.Counter - l1WatcherFetchContractEventRollupEventsTotal prometheus.Counter + l1WatcherFetchBlockHeaderTotal prometheus.Counter + l1WatcherFetchBlockHeaderProcessedBlockHeight prometheus.Gauge } var ( @@ -33,26 +28,6 @@ func initL1WatcherMetrics(reg prometheus.Registerer) *l1WatcherMetrics { Name: "rollup_l1_watcher_fetch_block_header_processed_block_height", Help: "The current processed block height of l1 watcher fetch block header", }), - l1WatcherFetchContractEventTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{ - Name: "rollup_l1_watcher_fetch_block_contract_event_total", - Help: "The total number of l1 watcher fetch contract event total", - }), - l1WatcherFetchContractEventSuccessTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{ - Name: "rollup_l1_watcher_fetch_block_contract_event_success_total", - Help: "The total number of l1 watcher fetch contract event success total", - }), - l1WatcherFetchContractEventProcessedBlockHeight: promauto.With(reg).NewGauge(prometheus.GaugeOpts{ - Name: "rollup_l1_watcher_fetch_block_contract_event_processed_block_height", - Help: "The current processed block height of l1 watcher fetch contract event", - }), - l1WatcherFetchContractEventSentEventsTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{ - Name: "rollup_l1_watcher_fetch_block_contract_event_sent_event_total", - Help: "The current processed block height of l1 watcher fetch contract sent event", - }), - l1WatcherFetchContractEventRollupEventsTotal: promauto.With(reg).NewCounter(prometheus.CounterOpts{ - Name: "rollup_l1_watcher_fetch_block_contract_event_rollup_event_total", - Help: "The current processed block height of l1 watcher fetch contract rollup event", - }), } }) return l1WatcherMetric diff --git a/rollup/internal/controller/watcher/l1_watcher_test.go b/rollup/internal/controller/watcher/l1_watcher_test.go index c79cce26fc..d0de839689 100644 --- a/rollup/internal/controller/watcher/l1_watcher_test.go +++ b/rollup/internal/controller/watcher/l1_watcher_test.go @@ -8,21 +8,15 @@ import ( "github.com/agiledragon/gomonkey/v2" "github.com/scroll-tech/go-ethereum" - "github.com/scroll-tech/go-ethereum/accounts/abi" - "github.com/scroll-tech/go-ethereum/common" "github.com/scroll-tech/go-ethereum/core/types" "github.com/scroll-tech/go-ethereum/ethclient" - "github.com/scroll-tech/go-ethereum/rpc" "github.com/smartystreets/goconvey/convey" "github.com/stretchr/testify/assert" "gorm.io/gorm" "scroll-tech/common/database" - commonTypes "scroll-tech/common/types" - bridgeAbi "scroll-tech/rollup/abi" "scroll-tech/rollup/internal/orm" - "scroll-tech/rollup/internal/utils" ) func setupL1Watcher(t *testing.T) (*L1WatcherClient, *gorm.DB) { @@ -30,17 +24,10 @@ func setupL1Watcher(t *testing.T) (*L1WatcherClient, *gorm.DB) { client, err := testApps.GetPoSL1Client() assert.NoError(t, err) l1Cfg := cfg.L1Config - watcher := NewL1WatcherClient(context.Background(), client, l1Cfg.StartHeight, l1Cfg.Confirmations, l1Cfg.L1MessageQueueAddress, l1Cfg.RelayerConfig.RollupContractAddress, db, nil) - assert.NoError(t, watcher.FetchContractEvent()) + watcher := NewL1WatcherClient(context.Background(), client, l1Cfg.StartHeight, l1Cfg.Confirmations, db, nil) return watcher, db } -func testFetchContractEvent(t *testing.T) { - watcher, db := setupL1Watcher(t) - defer database.CloseDB(db) - assert.NoError(t, watcher.FetchContractEvent()) -} - func testL1WatcherClientFetchBlockHeader(t *testing.T) { watcher, db := setupL1Watcher(t) defer database.CloseDB(db) @@ -112,278 +99,3 @@ func testL1WatcherClientFetchBlockHeader(t *testing.T) { assert.NoError(t, err) }) } - -func testL1WatcherClientFetchContractEvent(t *testing.T) { - watcher, db := setupL1Watcher(t) - defer database.CloseDB(db) - - watcher.SetConfirmations(rpc.SafeBlockNumber) - convey.Convey("get latest confirmed block number failure", t, func() { - var c *ethclient.Client - patchGuard := gomonkey.ApplyMethodFunc(c, "HeaderByNumber", func(ctx context.Context, height *big.Int) (*types.Header, error) { - return nil, ethereum.NotFound - }) - defer patchGuard.Reset() - err := watcher.FetchContractEvent() - assert.Error(t, err) - }) - - var c *ethclient.Client - patchGuard := gomonkey.ApplyMethodFunc(c, "HeaderByNumber", func(ctx context.Context, height *big.Int) (*types.Header, error) { - if height == nil { - height = big.NewInt(100) - } - t.Log(height) - return &types.Header{ - Number: big.NewInt(100), - BaseFee: big.NewInt(100), - }, nil - }) - defer patchGuard.Reset() - - convey.Convey("filter logs failure", t, func() { - targetErr := errors.New("call filter failure") - patchGuard.ApplyMethodFunc(c, "FilterLogs", func(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error) { - return nil, targetErr - }) - err := watcher.FetchContractEvent() - assert.EqualError(t, err, targetErr.Error()) - }) - - patchGuard.ApplyMethodFunc(c, "FilterLogs", func(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error) { - return []types.Log{ - { - Address: common.HexToAddress("0x0000000000000000000000000000000000000000"), - }, - }, nil - }) - - convey.Convey("parse bridge event logs failure", t, func() { - targetErr := errors.New("parse log failure") - patchGuard.ApplyPrivateMethod(watcher, "parseBridgeEventLogs", func(*L1WatcherClient, []types.Log) ([]*orm.L1Message, []rollupEvent, error) { - return nil, nil, targetErr - }) - err := watcher.FetchContractEvent() - assert.EqualError(t, err, targetErr.Error()) - }) - - patchGuard.ApplyPrivateMethod(watcher, "parseBridgeEventLogs", func(*L1WatcherClient, []types.Log) ([]*orm.L1Message, []rollupEvent, error) { - rollupEvents := []rollupEvent{ - { - batchHash: common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"), - txHash: common.HexToHash("0xad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5"), - status: commonTypes.RollupFinalized, - }, - { - batchHash: common.HexToHash("0xad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5"), - txHash: common.HexToHash("0xb4c11951957c6f8f642c4af61cd6b24640fec6dc7fc607ee8206a99e92410d30"), - status: commonTypes.RollupCommitted, - }, - } - return nil, rollupEvents, nil - }) - - var batchOrm *orm.Batch - convey.Convey("db get rollup status by hash list failure", t, func() { - targetErr := errors.New("get db failure") - patchGuard.ApplyMethodFunc(batchOrm, "GetRollupStatusByHashList", func(context.Context, []string) ([]commonTypes.RollupStatus, error) { - return nil, targetErr - }) - err := watcher.FetchContractEvent() - assert.Equal(t, err.Error(), targetErr.Error()) - }) - - convey.Convey("rollup status mismatch batch hashes length", t, func() { - patchGuard.ApplyMethodFunc(batchOrm, "GetRollupStatusByHashList", func(context.Context, []string) ([]commonTypes.RollupStatus, error) { - s := []commonTypes.RollupStatus{ - commonTypes.RollupFinalized, - } - return s, nil - }) - err := watcher.FetchContractEvent() - assert.NoError(t, err) - }) - - patchGuard.ApplyMethodFunc(batchOrm, "GetRollupStatusByHashList", func(context.Context, []string) ([]commonTypes.RollupStatus, error) { - s := []commonTypes.RollupStatus{ - commonTypes.RollupPending, - commonTypes.RollupCommitting, - } - return s, nil - }) - - convey.Convey("db update RollupFinalized status failure", t, func() { - targetErr := errors.New("UpdateFinalizeTxHashAndRollupStatus RollupFinalized failure") - patchGuard.ApplyMethodFunc(batchOrm, "UpdateFinalizeTxHashAndRollupStatus", func(context.Context, string, string, commonTypes.RollupStatus) error { - return targetErr - }) - err := watcher.FetchContractEvent() - assert.Equal(t, targetErr.Error(), err.Error()) - }) - - patchGuard.ApplyMethodFunc(batchOrm, "UpdateFinalizeTxHashAndRollupStatus", func(context.Context, string, string, commonTypes.RollupStatus) error { - return nil - }) - - convey.Convey("db update RollupCommitted status failure", t, func() { - targetErr := errors.New("UpdateCommitTxHashAndRollupStatus RollupCommitted failure") - patchGuard.ApplyMethodFunc(batchOrm, "UpdateCommitTxHashAndRollupStatus", func(context.Context, string, string, commonTypes.RollupStatus) error { - return targetErr - }) - err := watcher.FetchContractEvent() - assert.Equal(t, targetErr.Error(), err.Error()) - }) - - patchGuard.ApplyMethodFunc(batchOrm, "UpdateCommitTxHashAndRollupStatus", func(context.Context, string, string, commonTypes.RollupStatus) error { - return nil - }) - - var l1MessageOrm *orm.L1Message - convey.Convey("db save l1 message failure", t, func() { - targetErr := errors.New("SaveL1Messages failure") - patchGuard.ApplyMethodFunc(l1MessageOrm, "SaveL1Messages", func(context.Context, []*orm.L1Message) error { - return targetErr - }) - err := watcher.FetchContractEvent() - assert.Equal(t, targetErr.Error(), err.Error()) - }) - - patchGuard.ApplyMethodFunc(l1MessageOrm, "SaveL1Messages", func(context.Context, []*orm.L1Message) error { - return nil - }) - - convey.Convey("FetchContractEvent success", t, func() { - err := watcher.FetchContractEvent() - assert.NoError(t, err) - }) -} - -func testParseBridgeEventLogsL1QueueTransactionEventSignature(t *testing.T) { - watcher, db := setupL1Watcher(t) - defer database.CloseDB(db) - - logs := []types.Log{ - { - Topics: []common.Hash{bridgeAbi.L1QueueTransactionEventSignature}, - BlockNumber: 100, - TxHash: common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"), - }, - } - - convey.Convey("unpack QueueTransaction log failure", t, func() { - targetErr := errors.New("UnpackLog QueueTransaction failure") - patchGuard := gomonkey.ApplyFunc(utils.UnpackLog, func(c *abi.ABI, out interface{}, event string, log types.Log) error { - return targetErr - }) - defer patchGuard.Reset() - - l2Messages, rollupEvents, err := watcher.parseBridgeEventLogs(logs) - assert.EqualError(t, err, targetErr.Error()) - assert.Empty(t, l2Messages) - assert.Empty(t, rollupEvents) - }) - - convey.Convey("L1QueueTransactionEventSignature success", t, func() { - patchGuard := gomonkey.ApplyFunc(utils.UnpackLog, func(c *abi.ABI, out interface{}, event string, log types.Log) error { - tmpOut := out.(*bridgeAbi.L1QueueTransactionEvent) - tmpOut.QueueIndex = 100 - tmpOut.Data = []byte("test data") - tmpOut.Sender = common.HexToAddress("0xb4c11951957c6f8f642c4af61cd6b24640fec6dc7fc607ee8206a99e92410d30") - tmpOut.Value = big.NewInt(1000) - tmpOut.Target = common.HexToAddress("0xad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5") - tmpOut.GasLimit = big.NewInt(10) - return nil - }) - defer patchGuard.Reset() - - l2Messages, rollupEvents, err := watcher.parseBridgeEventLogs(logs) - assert.NoError(t, err) - assert.Empty(t, rollupEvents) - assert.Len(t, l2Messages, 1) - assert.Equal(t, l2Messages[0].Value, big.NewInt(1000).String()) - }) -} - -func testParseBridgeEventLogsL1CommitBatchEventSignature(t *testing.T) { - watcher, db := setupL1Watcher(t) - defer database.CloseDB(db) - logs := []types.Log{ - { - Topics: []common.Hash{bridgeAbi.L1CommitBatchEventSignature}, - BlockNumber: 100, - TxHash: common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"), - }, - } - - convey.Convey("unpack CommitBatch log failure", t, func() { - targetErr := errors.New("UnpackLog CommitBatch failure") - patchGuard := gomonkey.ApplyFunc(utils.UnpackLog, func(c *abi.ABI, out interface{}, event string, log types.Log) error { - return targetErr - }) - defer patchGuard.Reset() - - l2Messages, rollupEvents, err := watcher.parseBridgeEventLogs(logs) - assert.EqualError(t, err, targetErr.Error()) - assert.Empty(t, l2Messages) - assert.Empty(t, rollupEvents) - }) - - convey.Convey("L1CommitBatchEventSignature success", t, func() { - msgHash := common.HexToHash("0xad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5") - patchGuard := gomonkey.ApplyFunc(utils.UnpackLog, func(c *abi.ABI, out interface{}, event string, log types.Log) error { - tmpOut := out.(*bridgeAbi.L1CommitBatchEvent) - tmpOut.BatchHash = msgHash - return nil - }) - defer patchGuard.Reset() - - l2Messages, rollupEvents, err := watcher.parseBridgeEventLogs(logs) - assert.NoError(t, err) - assert.Empty(t, l2Messages) - assert.Len(t, rollupEvents, 1) - assert.Equal(t, rollupEvents[0].batchHash, msgHash) - assert.Equal(t, rollupEvents[0].status, commonTypes.RollupCommitted) - }) -} - -func testParseBridgeEventLogsL1FinalizeBatchEventSignature(t *testing.T) { - watcher, db := setupL1Watcher(t) - defer database.CloseDB(db) - logs := []types.Log{ - { - Topics: []common.Hash{bridgeAbi.L1FinalizeBatchEventSignature}, - BlockNumber: 100, - TxHash: common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"), - }, - } - - convey.Convey("unpack FinalizeBatch log failure", t, func() { - targetErr := errors.New("UnpackLog FinalizeBatch failure") - patchGuard := gomonkey.ApplyFunc(utils.UnpackLog, func(c *abi.ABI, out interface{}, event string, log types.Log) error { - return targetErr - }) - defer patchGuard.Reset() - - l2Messages, rollupEvents, err := watcher.parseBridgeEventLogs(logs) - assert.EqualError(t, err, targetErr.Error()) - assert.Empty(t, l2Messages) - assert.Empty(t, rollupEvents) - }) - - convey.Convey("L1FinalizeBatchEventSignature success", t, func() { - msgHash := common.HexToHash("0xad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5") - patchGuard := gomonkey.ApplyFunc(utils.UnpackLog, func(c *abi.ABI, out interface{}, event string, log types.Log) error { - tmpOut := out.(*bridgeAbi.L1FinalizeBatchEvent) - tmpOut.BatchHash = msgHash - return nil - }) - defer patchGuard.Reset() - - l2Messages, rollupEvents, err := watcher.parseBridgeEventLogs(logs) - assert.NoError(t, err) - assert.Empty(t, l2Messages) - assert.Len(t, rollupEvents, 1) - assert.Equal(t, rollupEvents[0].batchHash, msgHash) - assert.Equal(t, rollupEvents[0].status, commonTypes.RollupFinalized) - }) -} diff --git a/rollup/internal/controller/watcher/l2_watcher.go b/rollup/internal/controller/watcher/l2_watcher.go index d9024fc9de..3555b667e1 100644 --- a/rollup/internal/controller/watcher/l2_watcher.go +++ b/rollup/internal/controller/watcher/l2_watcher.go @@ -8,7 +8,6 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/scroll-tech/da-codec/encoding" "github.com/scroll-tech/da-codec/encoding/codecv0" - "github.com/scroll-tech/go-ethereum/accounts/abi" "github.com/scroll-tech/go-ethereum/common" "github.com/scroll-tech/go-ethereum/common/hexutil" gethTypes "github.com/scroll-tech/go-ethereum/core/types" @@ -18,7 +17,6 @@ import ( "github.com/scroll-tech/go-ethereum/rpc" "gorm.io/gorm" - bridgeAbi "scroll-tech/rollup/abi" "scroll-tech/rollup/internal/orm" ) @@ -34,7 +32,6 @@ type L2WatcherClient struct { confirmations rpc.BlockNumber messageQueueAddress common.Address - messageQueueABI *abi.ABI withdrawTrieRootSlot common.Hash metrics *l2WatcherMetrics @@ -51,7 +48,6 @@ func NewL2WatcherClient(ctx context.Context, client *ethclient.Client, confirmat confirmations: confirmations, messageQueueAddress: messageQueueAddress, - messageQueueABI: bridgeAbi.L2MessageQueueABI, withdrawTrieRootSlot: withdrawTrieRootSlot, metrics: initL2WatcherMetrics(reg), diff --git a/rollup/internal/controller/watcher/watcher_test.go b/rollup/internal/controller/watcher/watcher_test.go index 0047a8ca45..9413623996 100644 --- a/rollup/internal/controller/watcher/watcher_test.go +++ b/rollup/internal/controller/watcher/watcher_test.go @@ -94,12 +94,7 @@ func TestFunction(t *testing.T) { } // Run l1 watcher test cases. - t.Run("TestStartWatcher", testFetchContractEvent) t.Run("TestL1WatcherClientFetchBlockHeader", testL1WatcherClientFetchBlockHeader) - t.Run("TestL1WatcherClientFetchContractEvent", testL1WatcherClientFetchContractEvent) - t.Run("TestParseBridgeEventLogsL1QueueTransactionEventSignature", testParseBridgeEventLogsL1QueueTransactionEventSignature) - t.Run("TestParseBridgeEventLogsL1CommitBatchEventSignature", testParseBridgeEventLogsL1CommitBatchEventSignature) - t.Run("TestParseBridgeEventLogsL1FinalizeBatchEventSignature", testParseBridgeEventLogsL1FinalizeBatchEventSignature) // Run l2 watcher test cases. t.Run("TestFetchRunningMissingBlocks", testFetchRunningMissingBlocks) diff --git a/rollup/internal/utils/utils.go b/rollup/internal/utils/utils.go index 40d1aacf04..9fdeef04b1 100644 --- a/rollup/internal/utils/utils.go +++ b/rollup/internal/utils/utils.go @@ -2,73 +2,15 @@ package utils import ( "fmt" - "math/big" "time" "github.com/scroll-tech/da-codec/encoding" "github.com/scroll-tech/da-codec/encoding/codecv0" "github.com/scroll-tech/da-codec/encoding/codecv1" "github.com/scroll-tech/da-codec/encoding/codecv2" - "github.com/scroll-tech/go-ethereum/accounts/abi" "github.com/scroll-tech/go-ethereum/common" - "github.com/scroll-tech/go-ethereum/core/types" - "github.com/scroll-tech/go-ethereum/crypto" - - bridgeAbi "scroll-tech/rollup/abi" ) -// Keccak2 compute the keccack256 of two concatenations of bytes32 -func Keccak2(a common.Hash, b common.Hash) common.Hash { - return common.BytesToHash(crypto.Keccak256(append(a.Bytes()[:], b.Bytes()[:]...))) -} - -// ComputeMessageHash compute the message hash -func ComputeMessageHash( - sender common.Address, - target common.Address, - value *big.Int, - messageNonce *big.Int, - message []byte, -) common.Hash { - data, _ := bridgeAbi.L2ScrollMessengerABI.Pack("relayMessage", sender, target, value, messageNonce, message) - return common.BytesToHash(crypto.Keccak256(data)) -} - -// BufferToUint256Le convert bytes array to uint256 array assuming little-endian -func BufferToUint256Le(buffer []byte) []*big.Int { - buffer256 := make([]*big.Int, len(buffer)/32) - for i := 0; i < len(buffer)/32; i++ { - v := big.NewInt(0) - shft := big.NewInt(1) - for j := 0; j < 32; j++ { - v = new(big.Int).Add(v, new(big.Int).Mul(shft, big.NewInt(int64(buffer[i*32+j])))) - shft = new(big.Int).Mul(shft, big.NewInt(256)) - } - buffer256[i] = v - } - return buffer256 -} - -// UnpackLog unpacks a retrieved log into the provided output structure. -// @todo: add unit test. -func UnpackLog(c *abi.ABI, out interface{}, event string, log types.Log) error { - if log.Topics[0] != c.Events[event].ID { - return fmt.Errorf("event signature mismatch") - } - if len(log.Data) > 0 { - if err := c.UnpackIntoInterface(out, event, log.Data); err != nil { - return err - } - } - var indexed abi.Arguments - for _, arg := range c.Events[event].Inputs { - if arg.Indexed { - indexed = append(indexed, arg) - } - } - return abi.ParseTopics(out, indexed, log.Topics[1:]) -} - // ChunkMetrics indicates the metrics for proposing a chunk. type ChunkMetrics struct { // common metrics diff --git a/rollup/internal/utils/utils_test.go b/rollup/internal/utils/utils_test.go deleted file mode 100644 index b24958fac6..0000000000 --- a/rollup/internal/utils/utils_test.go +++ /dev/null @@ -1,49 +0,0 @@ -package utils - -import ( - "math/big" - "testing" - - "github.com/scroll-tech/go-ethereum/common" - "github.com/stretchr/testify/assert" -) - -func TestKeccak2(t *testing.T) { - hash := Keccak2(common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000"), common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000000")) - if hash != common.HexToHash("0xad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5") { - t.Fatalf("Invalid keccak, want %s, got %s", "0xad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5", hash.Hex()) - } - - hash = Keccak2(common.HexToHash("0xad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5"), common.HexToHash("0xad3228b676f7d3cd4284a5443f17f1962b36e491b30a40b2405849e597ba5fb5")) - if hash != common.HexToHash("0xb4c11951957c6f8f642c4af61cd6b24640fec6dc7fc607ee8206a99e92410d30") { - t.Fatalf("Invalid keccak, want %s, got %s", "0xb4c11951957c6f8f642c4af61cd6b24640fec6dc7fc607ee8206a99e92410d30", hash.Hex()) - } - - hash = Keccak2(common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000001"), common.HexToHash("0x0000000000000000000000000000000000000000000000000000000000000002")) - if hash != common.HexToHash("0xe90b7bceb6e7df5418fb78d8ee546e97c83a08bbccc01a0644d599ccd2a7c2e0") { - t.Fatalf("Invalid keccak, want %s, got %s", "0xe90b7bceb6e7df5418fb78d8ee546e97c83a08bbccc01a0644d599ccd2a7c2e0", hash.Hex()) - } -} - -func TestComputeMessageHash(t *testing.T) { - hash := ComputeMessageHash( - common.HexToAddress("0x1C5A77d9FA7eF466951B2F01F724BCa3A5820b63"), - common.HexToAddress("0x4592D8f8D7B001e72Cb26A73e4Fa1806a51aC79d"), - big.NewInt(0), - big.NewInt(1), - []byte("testbridgecontract"), - ) - assert.Equal(t, "0xda253c04595a49017bb54b1b46088c69752b5ad2f0c47971ac76b8b25abec202", hash.String()) -} - -func TestBufferToUint256Le(t *testing.T) { - input := []byte{ - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - } - expectedOutput := []*big.Int{big.NewInt(1)} - result := BufferToUint256Le(input) - assert.Equal(t, expectedOutput, result) -} diff --git a/rollup/tests/bridge_test.go b/rollup/tests/bridge_test.go index a2eb8005c5..e6fc7b11a8 100644 --- a/rollup/tests/bridge_test.go +++ b/rollup/tests/bridge_test.go @@ -187,7 +187,6 @@ func prepareContracts(t *testing.T) { }, 30*time.Second, time.Second) l1Config, l2Config := rollupApp.Config.L1Config, rollupApp.Config.L2Config - l1Config.ScrollChainContractAddress = mockL1ContractAddress l2Config.RelayerConfig.RollupContractAddress = mockL1ContractAddress l2Config.RelayerConfig.GasPriceOracleContractAddress = mockL1ContractAddress diff --git a/rollup/tests/gas_oracle_test.go b/rollup/tests/gas_oracle_test.go index 80f3652f37..93bc94bb01 100644 --- a/rollup/tests/gas_oracle_test.go +++ b/rollup/tests/gas_oracle_test.go @@ -36,7 +36,7 @@ func testImportL1GasPrice(t *testing.T) { // Create L1Watcher startHeight, err := l1Client.BlockNumber(context.Background()) assert.NoError(t, err) - l1Watcher := watcher.NewL1WatcherClient(context.Background(), l1Client, startHeight-1, 0, l1Cfg.L1MessageQueueAddress, l1Cfg.ScrollChainContractAddress, db, nil) + l1Watcher := watcher.NewL1WatcherClient(context.Background(), l1Client, startHeight-1, 0, db, nil) // fetch new blocks number, err := l1Client.BlockNumber(context.Background()) @@ -81,7 +81,7 @@ func testImportL1GasPriceAfterCurie(t *testing.T) { // Create L1Watcher startHeight, err := l1Client.BlockNumber(context.Background()) assert.NoError(t, err) - l1Watcher := watcher.NewL1WatcherClient(context.Background(), l1Client, startHeight-1, 0, l1Cfg.L1MessageQueueAddress, l1Cfg.ScrollChainContractAddress, db, nil) + l1Watcher := watcher.NewL1WatcherClient(context.Background(), l1Client, startHeight-1, 0, db, nil) // fetch new blocks number, err := l1Client.BlockNumber(context.Background()) diff --git a/rollup/tests/process_start_test.go b/rollup/tests/process_start_test.go index d70e88fe28..0b77656824 100644 --- a/rollup/tests/process_start_test.go +++ b/rollup/tests/process_start_test.go @@ -6,7 +6,6 @@ import ( "strconv" "testing" - _ "scroll-tech/rollup/cmd/event_watcher/app" _ "scroll-tech/rollup/cmd/gas_oracle/app" _ "scroll-tech/rollup/cmd/rollup_relayer/app" @@ -19,8 +18,6 @@ import ( func testProcessStart(t *testing.T) { db := setupDB(t) defer database.CloseDB(db) - - rollupApp.RunApp(t, cutils.EventWatcherApp) rollupApp.RunApp(t, cutils.GasOracleApp, "--genesis", "../conf/genesis.json") rollupApp.RunApp(t, cutils.RollupRelayerApp, "--genesis", "../conf/genesis.json") @@ -33,12 +30,7 @@ func testProcessStartEnableMetrics(t *testing.T) { port, err := rand.Int(rand.Reader, big.NewInt(10000)) assert.NoError(t, err) - svrPort := strconv.FormatInt(port.Int64()+10000, 10) - rollupApp.RunApp(t, cutils.EventWatcherApp, "--metrics", "--metrics.addr", "localhost", "--metrics.port", svrPort) - - port, err = rand.Int(rand.Reader, big.NewInt(10000)) - assert.NoError(t, err) - svrPort = strconv.FormatInt(port.Int64()+20000, 10) + svrPort := strconv.FormatInt(port.Int64()+20000, 10) rollupApp.RunApp(t, cutils.GasOracleApp, "--metrics", "--metrics.addr", "localhost", "--metrics.port", svrPort, "--genesis", "../conf/genesis.json") port, err = rand.Int(rand.Reader, big.NewInt(10000)) diff --git a/rollup/tests/rollup_test.go b/rollup/tests/rollup_test.go index 05e9390580..80fa56a9fa 100644 --- a/rollup/tests/rollup_test.go +++ b/rollup/tests/rollup_test.go @@ -64,10 +64,6 @@ func testCommitBatchAndFinalizeBatch(t *testing.T) { assert.NoError(t, err) defer l2Relayer.StopSenders() - // Create L1Watcher - l1Cfg := rollupApp.Config.L1Config - l1Watcher := watcher.NewL1WatcherClient(context.Background(), l1Client, 0, l1Cfg.Confirmations, l1Cfg.L1MessageQueueAddress, l1Cfg.ScrollChainContractAddress, db, nil) - // add some blocks to db var blocks []*encoding.Block for i := int64(0); i < 10; i++ { @@ -125,8 +121,6 @@ func testCommitBatchAndFinalizeBatch(t *testing.T) { // fetch rollup events assert.Eventually(t, func() bool { - err = l1Watcher.FetchContractEvent() - assert.NoError(t, err) var statuses []types.RollupStatus statuses, err = batchOrm.GetRollupStatusByHashList(context.Background(), []string{batch.Hash}) return err == nil && len(statuses) == 1 && types.RollupCommitted == statuses[0] @@ -161,8 +155,6 @@ func testCommitBatchAndFinalizeBatch(t *testing.T) { // fetch rollup events assert.Eventually(t, func() bool { - err = l1Watcher.FetchContractEvent() - assert.NoError(t, err) var statuses []types.RollupStatus statuses, err = batchOrm.GetRollupStatusByHashList(context.Background(), []string{batch.Hash}) return err == nil && len(statuses) == 1 && types.RollupFinalized == statuses[0] @@ -197,10 +189,6 @@ func testCommitBatchAndFinalizeBatch4844(t *testing.T) { l2Relayer, err := relayer.NewLayer2Relayer(context.Background(), l2Client, db, l2Cfg.RelayerConfig, chainConfig, true, relayer.ServiceTypeL2RollupRelayer, nil) assert.NoError(t, err) - // Create L1Watcher - l1Cfg := rollupApp.Config.L1Config - l1Watcher := watcher.NewL1WatcherClient(context.Background(), l1Client, 0, l1Cfg.Confirmations, l1Cfg.L1MessageQueueAddress, l1Cfg.ScrollChainContractAddress, db, nil) - // add some blocks to db var blocks []*encoding.Block for i := int64(0); i < 10; i++ { @@ -260,8 +248,6 @@ func testCommitBatchAndFinalizeBatch4844(t *testing.T) { // fetch rollup events assert.Eventually(t, func() bool { - err = l1Watcher.FetchContractEvent() - assert.NoError(t, err) var statuses []types.RollupStatus statuses, err = batchOrm.GetRollupStatusByHashList(context.Background(), []string{batch.Hash}) return err == nil && len(statuses) == 1 && types.RollupCommitted == statuses[0] @@ -296,8 +282,6 @@ func testCommitBatchAndFinalizeBatch4844(t *testing.T) { // fetch rollup events assert.Eventually(t, func() bool { - err = l1Watcher.FetchContractEvent() - assert.NoError(t, err) var statuses []types.RollupStatus statuses, err = batchOrm.GetRollupStatusByHashList(context.Background(), []string{batch.Hash}) return err == nil && len(statuses) == 1 && types.RollupFinalized == statuses[0] @@ -336,10 +320,6 @@ func testCommitBatchAndFinalizeBatchBeforeAndAfter4844(t *testing.T) { l2Relayer, err := relayer.NewLayer2Relayer(context.Background(), l2Client, db, l2Cfg.RelayerConfig, chainConfig, true, relayer.ServiceTypeL2RollupRelayer, nil) assert.NoError(t, err) - // Create L1Watcher - l1Cfg := rollupApp.Config.L1Config - l1Watcher := watcher.NewL1WatcherClient(context.Background(), l1Client, 0, l1Cfg.Confirmations, l1Cfg.L1MessageQueueAddress, l1Cfg.ScrollChainContractAddress, db, nil) - // add some blocks to db var blocks []*encoding.Block for i := int64(0); i < 10; i++ { @@ -393,8 +373,6 @@ func testCommitBatchAndFinalizeBatchBeforeAndAfter4844(t *testing.T) { // fetch rollup events assert.Eventually(t, func() bool { - err = l1Watcher.FetchContractEvent() - assert.NoError(t, err) var statuses []types.RollupStatus statuses, err = batchOrm.GetRollupStatusByHashList(context.Background(), []string{batch.Hash}) return err == nil && len(statuses) == 1 && types.RollupCommitted == statuses[0] @@ -429,8 +407,6 @@ func testCommitBatchAndFinalizeBatchBeforeAndAfter4844(t *testing.T) { // fetch rollup events assert.Eventually(t, func() bool { - err = l1Watcher.FetchContractEvent() - assert.NoError(t, err) var statuses []types.RollupStatus statuses, err = batchOrm.GetRollupStatusByHashList(context.Background(), []string{batch.Hash}) return err == nil && len(statuses) == 1 && types.RollupFinalized == statuses[0] @@ -465,10 +441,6 @@ func testCommitBatchAndFinalizeBatchBeforeAndAfterCompression(t *testing.T) { assert.NoError(t, err) defer l2Relayer.StopSenders() - // Create L1Watcher - l1Cfg := rollupApp.Config.L1Config - l1Watcher := watcher.NewL1WatcherClient(context.Background(), l1Client, 0, l1Cfg.Confirmations, l1Cfg.L1MessageQueueAddress, l1Cfg.ScrollChainContractAddress, db, nil) - // add some blocks to db var blocks []*encoding.Block for i := int64(0); i < 10; i++ { @@ -522,8 +494,6 @@ func testCommitBatchAndFinalizeBatchBeforeAndAfterCompression(t *testing.T) { // fetch rollup events assert.Eventually(t, func() bool { - err = l1Watcher.FetchContractEvent() - assert.NoError(t, err) var statuses []types.RollupStatus statuses, err = batchOrm.GetRollupStatusByHashList(context.Background(), []string{batch.Hash}) return err == nil && len(statuses) == 1 && types.RollupCommitted == statuses[0] @@ -558,8 +528,6 @@ func testCommitBatchAndFinalizeBatchBeforeAndAfterCompression(t *testing.T) { // fetch rollup events assert.Eventually(t, func() bool { - err = l1Watcher.FetchContractEvent() - assert.NoError(t, err) var statuses []types.RollupStatus statuses, err = batchOrm.GetRollupStatusByHashList(context.Background(), []string{batch.Hash}) return err == nil && len(statuses) == 1 && types.RollupFinalized == statuses[0] From c47d5ce48df0e3655114c590f8015f6025379b5d Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Sun, 7 Jul 2024 00:19:35 +0800 Subject: [PATCH 2/3] update comments --- rollup/internal/controller/relayer/l1_relayer.go | 7 ++----- rollup/internal/controller/relayer/l2_relayer.go | 4 +++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/rollup/internal/controller/relayer/l1_relayer.go b/rollup/internal/controller/relayer/l1_relayer.go index 921ccec4f2..df28475c46 100644 --- a/rollup/internal/controller/relayer/l1_relayer.go +++ b/rollup/internal/controller/relayer/l1_relayer.go @@ -21,12 +21,9 @@ import ( "scroll-tech/rollup/internal/orm" ) -// Layer1Relayer is responsible for -// 1. fetch pending L1Message from db -// 2. relay pending message to layer 2 node +// Layer1Relayer is responsible for updating L1 gas price oracle contract on L2. // -// Actions are triggered by new head from layer 1 geth node. -// @todo It's better to be triggered by watcher. +// Actions are triggered by L1 watcher. type Layer1Relayer struct { ctx context.Context diff --git a/rollup/internal/controller/relayer/l2_relayer.go b/rollup/internal/controller/relayer/l2_relayer.go index d49f136d67..eacb11f8aa 100644 --- a/rollup/internal/controller/relayer/l2_relayer.go +++ b/rollup/internal/controller/relayer/l2_relayer.go @@ -34,7 +34,9 @@ import ( rutils "scroll-tech/rollup/internal/utils" ) -// Layer2Relayer is responsible for committing and finalizing L2 blocks on L1. +// Layer2Relayer is responsible for: +// i. committing and finalizing L2 blocks on L1. +// ii. updating L2 gas price oracle contract on L1. type Layer2Relayer struct { ctx context.Context From b6d5286fec33efed9dd1bcab7747ad77ce550540 Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Sun, 7 Jul 2024 00:27:44 +0800 Subject: [PATCH 3/3] remove unused variables --- rollup/cmd/gas_oracle/app/app.go | 2 +- rollup/conf/config.json | 1 - rollup/internal/config/l1.go | 6 -- .../internal/controller/watcher/l1_watcher.go | 50 ++---------- .../controller/watcher/l1_watcher_test.go | 2 +- rollup/internal/orm/l1_message.go | 76 ------------------- rollup/tests/bridge_test.go | 1 - rollup/tests/gas_oracle_test.go | 4 +- 8 files changed, 12 insertions(+), 130 deletions(-) delete mode 100644 rollup/internal/orm/l1_message.go diff --git a/rollup/cmd/gas_oracle/app/app.go b/rollup/cmd/gas_oracle/app/app.go index 81182bd429..5ad23819e9 100644 --- a/rollup/cmd/gas_oracle/app/app.go +++ b/rollup/cmd/gas_oracle/app/app.go @@ -84,7 +84,7 @@ func action(ctx *cli.Context) error { log.Crit("failed to read genesis", "genesis file", genesisPath, "error", err) } - l1watcher := watcher.NewL1WatcherClient(ctx.Context, l1client, cfg.L1Config.StartHeight, cfg.L1Config.Confirmations, db, registry) + l1watcher := watcher.NewL1WatcherClient(ctx.Context, l1client, cfg.L1Config.StartHeight, db, registry) l1relayer, err := relayer.NewLayer1Relayer(ctx.Context, db, cfg.L1Config.RelayerConfig, genesis.Config, relayer.ServiceTypeL1GasOracle, registry) if err != nil { diff --git a/rollup/conf/config.json b/rollup/conf/config.json index 2a8cdea96d..8f14a34498 100644 --- a/rollup/conf/config.json +++ b/rollup/conf/config.json @@ -1,6 +1,5 @@ { "l1_config": { - "confirmations": "0x6", "endpoint": "https://rpc.ankr.com/eth", "start_height": 0, "relayer_config": { diff --git a/rollup/internal/config/l1.go b/rollup/internal/config/l1.go index 584d635de3..7213725672 100644 --- a/rollup/internal/config/l1.go +++ b/rollup/internal/config/l1.go @@ -1,13 +1,7 @@ package config -import ( - "github.com/scroll-tech/go-ethereum/rpc" -) - // L1Config loads l1eth configuration items. type L1Config struct { - // Confirmations block height confirmations number. - Confirmations rpc.BlockNumber `json:"confirmations"` // l1 eth node url. Endpoint string `json:"endpoint"` // The start height to sync event from layer 1 diff --git a/rollup/internal/controller/watcher/l1_watcher.go b/rollup/internal/controller/watcher/l1_watcher.go index d658831ef3..1b67089a3a 100644 --- a/rollup/internal/controller/watcher/l1_watcher.go +++ b/rollup/internal/controller/watcher/l1_watcher.go @@ -10,7 +10,6 @@ import ( gethTypes "github.com/scroll-tech/go-ethereum/core/types" "github.com/scroll-tech/go-ethereum/ethclient" "github.com/scroll-tech/go-ethereum/log" - "github.com/scroll-tech/go-ethereum/rpc" "gorm.io/gorm" "scroll-tech/common/types" @@ -20,17 +19,10 @@ import ( // L1WatcherClient will listen for smart contract events from Eth L1. type L1WatcherClient struct { - ctx context.Context - client *ethclient.Client - l1MessageOrm *orm.L1Message - l1BlockOrm *orm.L1Block - batchOrm *orm.Batch + ctx context.Context + client *ethclient.Client + l1BlockOrm *orm.L1Block - // The number of new blocks to wait for a block to be confirmed - confirmations rpc.BlockNumber - - // The height of the block that the watcher has retrieved event logs - processedMsgHeight uint64 // The height of the block that the watcher has retrieved header rlp processedBlockHeight uint64 @@ -38,17 +30,7 @@ type L1WatcherClient struct { } // NewL1WatcherClient returns a new instance of L1WatcherClient. -func NewL1WatcherClient(ctx context.Context, client *ethclient.Client, startHeight uint64, confirmations rpc.BlockNumber, db *gorm.DB, reg prometheus.Registerer) *L1WatcherClient { - l1MessageOrm := orm.NewL1Message(db) - savedHeight, err := l1MessageOrm.GetLayer1LatestWatchedHeight() - if err != nil { - log.Warn("Failed to fetch height from db", "err", err) - savedHeight = 0 - } - if savedHeight < int64(startHeight) { - savedHeight = int64(startHeight) - } - +func NewL1WatcherClient(ctx context.Context, client *ethclient.Client, startHeight uint64, db *gorm.DB, reg prometheus.Registerer) *L1WatcherClient { l1BlockOrm := orm.NewL1Block(db) savedL1BlockHeight, err := l1BlockOrm.GetLatestL1BlockHeight(ctx) if err != nil { @@ -60,14 +42,10 @@ func NewL1WatcherClient(ctx context.Context, client *ethclient.Client, startHeig } return &L1WatcherClient{ - ctx: ctx, - client: client, - l1MessageOrm: l1MessageOrm, - l1BlockOrm: l1BlockOrm, - batchOrm: orm.NewBatch(db), - confirmations: confirmations, - - processedMsgHeight: uint64(savedHeight), + ctx: ctx, + client: client, + l1BlockOrm: l1BlockOrm, + processedBlockHeight: savedL1BlockHeight, metrics: initL1WatcherMetrics(reg), } @@ -79,18 +57,6 @@ func (w *L1WatcherClient) ProcessedBlockHeight() uint64 { return w.processedBlockHeight } -// Confirmations get confirmations -// Currently only use for unit test -func (w *L1WatcherClient) Confirmations() rpc.BlockNumber { - return w.confirmations -} - -// SetConfirmations set the confirmations for L1WatcherClient -// Currently only use for unit test -func (w *L1WatcherClient) SetConfirmations(confirmations rpc.BlockNumber) { - w.confirmations = confirmations -} - // FetchBlockHeader pull latest L1 blocks and save in DB func (w *L1WatcherClient) FetchBlockHeader(blockHeight uint64) error { w.metrics.l1WatcherFetchBlockHeaderTotal.Inc() diff --git a/rollup/internal/controller/watcher/l1_watcher_test.go b/rollup/internal/controller/watcher/l1_watcher_test.go index d0de839689..3183b4e346 100644 --- a/rollup/internal/controller/watcher/l1_watcher_test.go +++ b/rollup/internal/controller/watcher/l1_watcher_test.go @@ -24,7 +24,7 @@ func setupL1Watcher(t *testing.T) (*L1WatcherClient, *gorm.DB) { client, err := testApps.GetPoSL1Client() assert.NoError(t, err) l1Cfg := cfg.L1Config - watcher := NewL1WatcherClient(context.Background(), client, l1Cfg.StartHeight, l1Cfg.Confirmations, db, nil) + watcher := NewL1WatcherClient(context.Background(), client, l1Cfg.StartHeight, db, nil) return watcher, db } diff --git a/rollup/internal/orm/l1_message.go b/rollup/internal/orm/l1_message.go deleted file mode 100644 index ea30f20d40..0000000000 --- a/rollup/internal/orm/l1_message.go +++ /dev/null @@ -1,76 +0,0 @@ -package orm - -import ( - "context" - "database/sql" - "time" - - "github.com/scroll-tech/go-ethereum/log" - "gorm.io/gorm" -) - -// L1Message is structure of stored layer1 bridge message -type L1Message struct { - db *gorm.DB `gorm:"column:-"` - - QueueIndex uint64 `json:"queue_index" gorm:"column:queue_index"` - MsgHash string `json:"msg_hash" gorm:"column:msg_hash"` - Height uint64 `json:"height" gorm:"column:height"` - GasLimit uint64 `json:"gas_limit" gorm:"column:gas_limit"` - Sender string `json:"sender" gorm:"column:sender"` - Target string `json:"target" gorm:"column:target"` - Value string `json:"value" gorm:"column:value"` - Calldata string `json:"calldata" gorm:"column:calldata"` - Layer1Hash string `json:"layer1_hash" gorm:"column:layer1_hash"` - Layer2Hash string `json:"layer2_hash" gorm:"column:layer2_hash;default:NULL"` - Status int `json:"status" gorm:"column:status;default:1"` - - // metadata - CreatedAt time.Time `json:"created_at" gorm:"column:created_at"` - UpdatedAt time.Time `json:"updated_at" gorm:"column:updated_at"` - DeletedAt gorm.DeletedAt `json:"deleted_at" gorm:"column:deleted_at;default:NULL"` -} - -// NewL1Message create an L1MessageOrm instance -func NewL1Message(db *gorm.DB) *L1Message { - return &L1Message{db: db} -} - -// TableName define the L1Message table name -func (*L1Message) TableName() string { - return "l1_message" -} - -// GetLayer1LatestWatchedHeight returns latest height stored in the table -func (m *L1Message) GetLayer1LatestWatchedHeight() (int64, error) { - // @note It's not correct, since we may don't have message in some blocks. - // But it will only be called at start, some redundancy is acceptable. - var maxHeight sql.NullInt64 - result := m.db.Model(&L1Message{}).Select("MAX(height)").Scan(&maxHeight) - if result.Error != nil { - return -1, result.Error - } - if maxHeight.Valid { - return maxHeight.Int64, nil - } - return -1, nil -} - -// SaveL1Messages batch save a list of layer1 messages -func (m *L1Message) SaveL1Messages(ctx context.Context, messages []*L1Message) error { - if len(messages) == 0 { - return nil - } - - err := m.db.WithContext(ctx).Create(&messages).Error - if err != nil { - queueIndices := make([]uint64, 0, len(messages)) - heights := make([]uint64, 0, len(messages)) - for _, msg := range messages { - queueIndices = append(queueIndices, msg.QueueIndex) - heights = append(heights, msg.Height) - } - log.Error("failed to insert l1Messages", "queueIndices", queueIndices, "heights", heights, "err", err) - } - return err -} diff --git a/rollup/tests/bridge_test.go b/rollup/tests/bridge_test.go index e6fc7b11a8..e4abb920fc 100644 --- a/rollup/tests/bridge_test.go +++ b/rollup/tests/bridge_test.go @@ -101,7 +101,6 @@ func setupEnv(t *testing.T) { assert.NoError(t, err) l1Cfg, l2Cfg := rollupApp.Config.L1Config, rollupApp.Config.L2Config - l1Cfg.Confirmations = 0 l1Cfg.RelayerConfig.SenderConfig.Confirmations = 0 l2Cfg.Confirmations = 0 l2Cfg.RelayerConfig.SenderConfig.Confirmations = 0 diff --git a/rollup/tests/gas_oracle_test.go b/rollup/tests/gas_oracle_test.go index 93bc94bb01..58e2362b3b 100644 --- a/rollup/tests/gas_oracle_test.go +++ b/rollup/tests/gas_oracle_test.go @@ -36,7 +36,7 @@ func testImportL1GasPrice(t *testing.T) { // Create L1Watcher startHeight, err := l1Client.BlockNumber(context.Background()) assert.NoError(t, err) - l1Watcher := watcher.NewL1WatcherClient(context.Background(), l1Client, startHeight-1, 0, db, nil) + l1Watcher := watcher.NewL1WatcherClient(context.Background(), l1Client, startHeight-1, db, nil) // fetch new blocks number, err := l1Client.BlockNumber(context.Background()) @@ -81,7 +81,7 @@ func testImportL1GasPriceAfterCurie(t *testing.T) { // Create L1Watcher startHeight, err := l1Client.BlockNumber(context.Background()) assert.NoError(t, err) - l1Watcher := watcher.NewL1WatcherClient(context.Background(), l1Client, startHeight-1, 0, db, nil) + l1Watcher := watcher.NewL1WatcherClient(context.Background(), l1Client, startHeight-1, db, nil) // fetch new blocks number, err := l1Client.BlockNumber(context.Background())