Skip to content

Commit

Permalink
Merge branch 'zkevm/v0.7.3' into zhangkai/merge-v0.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
giskook committed Aug 13, 2024
2 parents 3e5f8c4 + a774dc9 commit 2d64f23
Show file tree
Hide file tree
Showing 46 changed files with 1,001 additions and 303 deletions.
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
5 changes: 5 additions & 0 deletions docs/config-file/node-config-doc.html

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions docs/config-file/node-config-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -3643,6 +3643,8 @@ EnableLog=true
| - [Log](#Sequencer_StreamServer_Log ) | No | object | No | - | Log is the log configuration |
| - [UpgradeEtrogBatchNumber](#Sequencer_StreamServer_UpgradeEtrogBatchNumber ) | No | integer | No | - | UpgradeEtrogBatchNumber is the batch number of the upgrade etrog |
| - [WriteTimeout](#Sequencer_StreamServer_WriteTimeout ) | No | string | No | - | Duration |
| - [InactivityTimeout](#Sequencer_StreamServer_InactivityTimeout ) | No | string | No | - | Duration |
| - [InactivityCheckInterval](#Sequencer_StreamServer_InactivityCheckInterval ) | No | string | No | - | Duration |

#### <a name="Sequencer_StreamServer_Port"></a>10.9.1. `Sequencer.StreamServer.Port`

Expand Down Expand Up @@ -3854,6 +3856,58 @@ InitGasPriceMultiple=0
QueryPendingTxsLimit=0
```

#### <a name="Sequencer_StreamServer_InactivityTimeout"></a>10.9.9. `Sequencer.StreamServer.InactivityTimeout`

**Title:** Duration

**Type:** : `string`

**Default:** `"2m0s"`

**Description:** InactivityTimeout is the timeout to kill an inactive datastream client connection

**Examples:**

```json
"1m"
```

```json
"300ms"
```

**Example setting the default value** ("2m0s"):
```
[Sequencer.StreamServer]
InactivityTimeout="2m0s"
```

#### <a name="Sequencer_StreamServer_InactivityCheckInterval"></a>10.9.10. `Sequencer.StreamServer.InactivityCheckInterval`

**Title:** Duration

**Type:** : `string`

**Default:** `"5s"`

**Description:** InactivityCheckInterval is the time interval to check for datastream client connections that have reached the inactivity timeout to kill them

**Examples:**

```json
"1m"
```

```json
"300ms"
```

**Example setting the default value** ("5s"):
```
[Sequencer.StreamServer]
InactivityCheckInterval="5s"
```

## <a name="SequenceSender"></a>11. `[SequenceSender]`

**Type:** : `object`
Expand Down
20 changes: 20 additions & 0 deletions docs/config-file/node-config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,26 @@
"1m",
"300ms"
]
},
"InactivityTimeout": {
"type": "string",
"title": "Duration",
"description": "InactivityTimeout is the timeout to kill an inactive datastream client connection",
"default": "2m0s",
"examples": [
"1m",
"300ms"
]
},
"InactivityCheckInterval": {
"type": "string",
"title": "Duration",
"description": "InactivityCheckInterval is the time interval to check for datastream client connections that have reached the inactivity timeout to kill them",
"default": "5s",
"examples": [
"1m",
"300ms"
]
}
},
"additionalProperties": false,
Expand Down
7 changes: 4 additions & 3 deletions ethtxmanager/ethtxmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,10 @@ func (c *Client) buildResult(ctx context.Context, mTx monitoredTx) (MonitoredTxR
}

result := MonitoredTxResult{
ID: mTx.id,
Status: mTx.status,
Txs: txs,
ID: mTx.id,
Status: mTx.status,
BlockNumber: mTx.blockNumber,
Txs: txs,
}

return result, nil
Expand Down
7 changes: 4 additions & 3 deletions ethtxmanager/monitoredtx.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,10 @@ func (mTx *monitoredTx) blockNumberU64Ptr() *uint64 {

// MonitoredTxResult represents the result of a execution of a monitored tx
type MonitoredTxResult struct {
ID string
Status MonitoredTxStatus
Txs map[common.Hash]TxResult
ID string
Status MonitoredTxStatus
BlockNumber *big.Int
Txs map[common.Hash]TxResult
}

// TxResult represents the result of a execution of a ethereum transaction in the block chain
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/0xPolygonHermez/zkevm-node
go 1.21

require (
github.com/0xPolygonHermez/zkevm-data-streamer v0.2.3-RC4
github.com/0xPolygonHermez/zkevm-data-streamer v0.2.3
github.com/didip/tollbooth/v6 v6.1.2
github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127
github.com/ethereum/go-ethereum v1.13.11
Expand All @@ -23,10 +23,10 @@ require (
github.com/rubenv/sql-migrate v1.6.1
github.com/spf13/afero v1.11.0
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.8.4
github.com/umbracle/ethgo v0.1.4-0.20230712173909-df37dddf16f0
github.com/urfave/cli/v2 v2.26.0
go.uber.org/zap v1.26.0
github.com/stretchr/testify v1.9.0
github.com/umbracle/ethgo v0.1.3
github.com/urfave/cli/v2 v2.27.1
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.18.0
golang.org/x/net v0.20.0
golang.org/x/sync v0.6.0
Expand Down Expand Up @@ -147,7 +147,7 @@ require (
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/status-im/keycard-go v0.2.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
Expand Down
20 changes: 12 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ github.com/0xPolygon/cdk-data-availability v0.0.5 h1://vg1oR/5tw2XfEIorpP+wIxLfN
github.com/0xPolygon/cdk-data-availability v0.0.5/go.mod h1:aGwqHiJhL+mJbdepl3s58wsY18EuViDa9vZCpPuIYGw=
github.com/0xPolygonHermez/zkevm-data-streamer v0.2.3-RC4 h1:+4K+xSzv0ImbK30B/T9FauNTrTFUmWcNKYhIgwsE4C4=
github.com/0xPolygonHermez/zkevm-data-streamer v0.2.3-RC4/go.mod h1:0QkAXcFa92mFJrCbN3UPUJGJYes851yEgYHLONnaosE=
github.com/0xPolygonHermez/zkevm-data-streamer v0.2.3 h1:zJ06KCGLMDOap4slop/QmiMUO+VPsKSS3+944SY06ww=
github.com/0xPolygonHermez/zkevm-data-streamer v0.2.3/go.mod h1:bv7DjATsczN2WvFt26jv34TWv6rfvYM1SqegrgrFwfI=
github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8=
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
Expand Down Expand Up @@ -775,8 +777,9 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
Expand All @@ -787,8 +790,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
Expand All @@ -814,8 +818,8 @@ github.com/umbracle/ethgo v0.1.4-0.20230712173909-df37dddf16f0 h1:wE2g4ydxJk8kdR
github.com/umbracle/ethgo v0.1.4-0.20230712173909-df37dddf16f0/go.mod h1:J+OZNfRCtbaYW3AEc0m47GhwAzlNJjcr9vO86nzOr6E=
github.com/umbracle/fastrlp v0.0.0-20220527094140-59d5dd30e722 h1:10Nbw6cACsnQm7r34zlpJky+IzxVLRk6MKTS2d3Vp0E=
github.com/umbracle/fastrlp v0.0.0-20220527094140-59d5dd30e722/go.mod h1:c8J0h9aULj2i3umrfyestM6jCq0LK0U6ly6bWy96nd4=
github.com/urfave/cli/v2 v2.26.0 h1:3f3AMg3HpThFNT4I++TKOejZO8yU55t3JnnSr4S4QEI=
github.com/urfave/cli/v2 v2.26.0/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho=
github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ=
github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w=
Expand Down Expand Up @@ -875,8 +879,8 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
Expand All @@ -889,8 +893,8 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand Down
23 changes: 14 additions & 9 deletions pool/config_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package pool

import (
"fmt"
"testing"

"github.com/0xPolygonHermez/zkevm-node/state"
"github.com/stretchr/testify/assert"
)

func TestIsWithinConstraints(t *testing.T) {
Expand All @@ -20,9 +22,9 @@ func TestIsWithinConstraints(t *testing.T) {
}

testCases := []struct {
desc string
counters state.ZKCounters
expected bool
desc string
counters state.ZKCounters
errExpected error
}{
{
desc: "All constraints within limits",
Expand All @@ -37,7 +39,7 @@ func TestIsWithinConstraints(t *testing.T) {
Steps: 2000,
Sha256Hashes_V2: 4000,
},
expected: true,
errExpected: nil,
},
{
desc: "All constraints exceed limits",
Expand All @@ -52,14 +54,17 @@ func TestIsWithinConstraints(t *testing.T) {
Steps: 5000,
Sha256Hashes_V2: 6000,
},
expected: false,
errExpected: fmt.Errorf("out of counters at node level (GasUsed, KeccakHashes, PoseidonHashes, PoseidonPaddings, MemAligns, Arithmetics, Binaries, Steps, Sha256Hashes)"),
},
}

for _, tC := range testCases {
t.Run(tC.desc, func(t *testing.T) {
if got := cfg.IsWithinConstraints(tC.counters); got != tC.expected {
t.Errorf("Expected %v, got %v", tC.expected, got)
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
err := cfg.CheckNodeLevelOOC(tc.counters)
if tc.errExpected != nil {
assert.EqualError(t, err, tc.errExpected.Error())
} else {
assert.NoError(t, err)
}
})
}
Expand Down
Loading

0 comments on commit 2d64f23

Please sign in to comment.