Skip to content

Commit

Permalink
chore: decommission event-watcher (#1413)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinlyguo authored Jul 8, 2024
1 parent ab9c541 commit 86aed8e
Show file tree
Hide file tree
Showing 31 changed files with 24 additions and 1,223 deletions.
45 changes: 0 additions & 45 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion bridge-history-api/cmd/api/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion bridge-history-api/cmd/fetcher/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
29 changes: 0 additions & 29 deletions build/dockerfiles/event_watcher.Dockerfile

This file was deleted.

5 changes: 0 additions & 5 deletions build/dockerfiles/event_watcher.Dockerfile.dockerignore

This file was deleted.

9 changes: 0 additions & 9 deletions common/utils/simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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.
Expand Down
8 changes: 1 addition & 7 deletions rollup/Makefile
Original file line number Diff line number Diff line change
@@ -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=./..
Expand All @@ -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/

Expand All @@ -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
2 changes: 0 additions & 2 deletions rollup/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Rollup

This directory contains the three essential rollup services for the Scroll chain:
- Event Watcher (<a href="./cmd/event_watcher/">event_watcher</a>): watches the events emitted from the L1 and L2 contracts and updates the event database.
- Gas Oracle (<a href="./cmd/gas_oracle/">gas_oracle</a>): monitors the L1 and L2 gas price and sends transactions to update the gas price oracle contracts on L1 and L2.
- Rollup Relayer (<a href="./cmd/rollup_relayer/">rollup_relayer</a>): 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.
Expand Down Expand Up @@ -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
```
173 changes: 1 addition & 172 deletions rollup/abi/bridge_abi.go

Large diffs are not rendered by default.

36 changes: 0 additions & 36 deletions rollup/abi/bridge_abi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down
97 changes: 0 additions & 97 deletions rollup/cmd/event_watcher/app/app.go

This file was deleted.

7 changes: 0 additions & 7 deletions rollup/cmd/event_watcher/main.go

This file was deleted.

2 changes: 1 addition & 1 deletion rollup/cmd/gas_oracle/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, db, registry)

l1relayer, err := relayer.NewLayer1Relayer(ctx.Context, db, cfg.L1Config.RelayerConfig, genesis.Config, relayer.ServiceTypeL1GasOracle, registry)
if err != nil {
Expand Down
5 changes: 1 addition & 4 deletions rollup/cmd/mock_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 0 additions & 3 deletions rollup/conf/config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,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",
Expand Down
11 changes: 0 additions & 11 deletions rollup/internal/config/l1.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
package config

import (
"github.com/scroll-tech/go-ethereum/common"
"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
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"`
}
Loading

0 comments on commit 86aed8e

Please sign in to comment.