Skip to content

Commit

Permalink
Merge branch 'dev' into proof
Browse files Browse the repository at this point in the history
  • Loading branch information
justinriema authored Aug 30, 2024
2 parents 9c79904 + 837ab57 commit 08b03a2
Show file tree
Hide file tree
Showing 57 changed files with 1,307 additions and 348 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/image-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: image-builder

on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to build'
required: false
tag:
description: 'Tag to build'
required: false

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
id: checkout
with:
ref: ${{ github.event.inputs.branch || github.event.inputs.tag }}

- name: check param
run: |
branch=${{ github.event.inputs.branch }}
tag=${{ github.event.inputs.tag }}
if [ -z "$branch" ] && [ -z "$tag" ]; then
echo "Both branch and tag are empty."
exit 1
elif [ -n "$branch" ] && [ -n "$tag" ]; then
echo "Both branch and tag are provided. Please provide only one."
exit 1
else
echo "Correct! One of branch or tag is provided."
fi
- name: Get current date
id: date
run: echo "DATE=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV

- name: Get commit hash
id: commit
run: echo "HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: Generate image tag
id: tag
run: |
BRANCH_TAG=$(echo "${{ github.event.inputs.branch || github.event.inputs.tag }}" | sed 's/\//_/g')
IMAGE_TAG="${BRANCH_TAG}_${DATE}_${HASH}"
echo "IMAGE_TAG=${IMAGE_TAG}" >> $GITHUB_ENV
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and Push Docker image
run: |
docker build -t "xlayerdev/xlayer-node:${{ env.IMAGE_TAG }}" .
docker push "xlayerdev/xlayer-node:${{ env.IMAGE_TAG }}"
16 changes: 3 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ jobs:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.21

- name: Get packr
run: go install github.com/gobuffalo/packr/v2/packr2@v2.8.3

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
uses: goreleaser/goreleaser-action@v6
with:
version: latest
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_RELEASE }}
Expand All @@ -45,16 +45,6 @@ jobs:
mv cardona/config/environments/cardona/example.env cardona
sed -i -e "s/image: zkevm-node/image: hermeznetwork\/zkevm-node:$GIT_TAG_NAME/g" cardona/docker-compose.yml
zip -r cardona.zip cardona
# TESTNET
mkdir -p testnet/config/environments/testnet
mkdir -p testnet/db/scripts
cp config/environments/testnet/* testnet/config/environments/testnet
cp docker-compose.yml testnet
sed -i 's/\/config\/environments\/${ZKEVM_NETWORK}/\/config\/environments\/testnet/g' testnet/docker-compose.yml
cp db/scripts/init_prover_db.sql testnet/db/scripts
mv testnet/config/environments/testnet/example.env testnet
sed -i -e "s/image: zkevm-node/image: hermeznetwork\/zkevm-node:$GIT_TAG_NAME/g" testnet/docker-compose.yml
zip -r testnet.zip testnet
# MAINNET
mkdir -p mainnet/config/environments/mainnet
mkdir -p mainnet/db/scripts
Expand Down
2 changes: 2 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# .goreleaser.yaml
version: 2

builds:
- main: ./cmd/
goos:
Expand Down
6 changes: 6 additions & 0 deletions aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ func (a *Aggregator) Start(ctx context.Context) error {
return fmt.Errorf("failed to initialize proofs cache %w", err)
}

for !a.isSynced(ctx, nil) {
log.Info("Waiting for synchronizer to sync...")
time.Sleep(a.cfg.RetryTime.Duration)
continue
}

address := fmt.Sprintf("%s:%d", a.cfg.Host, a.cfg.Port)
lis, err := net.Listen("tcp", address)
if err != nil {
Expand Down
8 changes: 8 additions & 0 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@ func Test_Defaults(t *testing.T) {
path: "Sequencer.StreamServer.WriteTimeout",
expectedValue: types.NewDuration(5 * time.Second),
},
{
path: "Sequencer.StreamServer.InactivityTimeout",
expectedValue: types.NewDuration(120 * time.Second),
},
{
path: "Sequencer.StreamServer.InactivityCheckInterval",
expectedValue: types.NewDuration(5 * time.Second),
},
{
path: "Sequencer.StreamServer.Enabled",
expectedValue: false,
Expand Down
2 changes: 2 additions & 0 deletions config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ StateConsistencyCheckInterval = "5s"
Filename = ""
Version = 0
WriteTimeout = "5s"
InactivityTimeout = "120s"
InactivityCheckInterval = "5s"
Enabled = false
[SequenceSender]
Expand Down
2 changes: 2 additions & 0 deletions config/environments/local/local.node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ StateConsistencyCheckInterval = "5s"
Port = 0
Filename = ""
WriteTimeout = "5s"
InactivityTimeout = "120s"
InactivityCheckInterval = "5s"
Enabled = false

[SequenceSender]
Expand Down
Loading

0 comments on commit 08b03a2

Please sign in to comment.