Skip to content

Commit

Permalink
Merge pull request #243 from okx/zhangkai/merge-v0.7.3
Browse files Browse the repository at this point in the history
Sync from zkevm v0.7.3
  • Loading branch information
KamiD authored Aug 16, 2024
2 parents 3e5f8c4 + 3f5badb commit 9d5563d
Show file tree
Hide file tree
Showing 46 changed files with 999 additions and 304 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/[email protected]

- 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
4 changes: 4 additions & 0 deletions docs/config-file/node-config-doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@
</pre></div> </div><div id=Sequencer_Finalizer_Metrics_Interval_ex2 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;300ms&quot;</span>
</pre></div> </div> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><!-- None --><a href=#Sequencer.Finalizer.Metrics.EnableLog onclick="anchorLink('Sequencer.Finalizer.Metrics.EnableLog')">Sequencer.Finalizer.Metrics.EnableLog=</a> </div> <span class="badge badge-success default-value">Default: true</span><span class="badge badge-dark value-type">Type: boolean</span><br> <span class=description><p>EnableLog is a flag to enable/disable metrics logs</p> </span> <hr> </div> </div> </div> </div> </div> </div> </div> </div> <div class=accordion id=accordionSequencer_StreamServer> <div class=card> <div class=card-header id=headingSequencer_StreamServer> <h2 class=mb-0> <button class="btn btn-link property-name-button" type=button data-toggle=collapse data-target=#Sequencer_StreamServer aria-expanded aria-controls=Sequencer_StreamServer onclick="setAnchor('#Sequencer_StreamServer')"><span class=property-name> <div class=breadcrumbs>[<a href=#Sequencer onclick="anchorLink('Sequencer')">Sequencer</a> . <a href=#Sequencer_StreamServer onclick="anchorLink('Sequencer_StreamServer')">StreamServer</a>] </div></span></button> </h2> StreamServerCfg is the config for the stream server </div> <div id=Sequencer_StreamServer class="collapse property-definition-div" aria-labelledby=headingSequencer_StreamServer data-parent=#accordionSequencer_StreamServer> <div class="card-body pl-5"> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.StreamServer.Port onclick="anchorLink('Sequencer.StreamServer.Port')">Sequencer.StreamServer.Port=</a> </div> <span class="badge badge-success default-value">Default: 0</span><span class="badge badge-dark value-type">Type: integer</span><br> <span class=description><p>Port to listen on</p> </span> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.StreamServer.Filename onclick="anchorLink('Sequencer.StreamServer.Filename')">Sequencer.StreamServer.Filename=</a> </div> <span class="badge badge-success default-value">Default: ""</span><span class="badge badge-dark value-type">Type: string</span><br> <span class=description><p>Filename of the binary data file</p> </span> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.StreamServer.Version onclick="anchorLink('Sequencer.StreamServer.Version')">Sequencer.StreamServer.Version=</a> </div> <span class="badge badge-success default-value">Default: 0</span><span class="badge badge-dark value-type">Type: integer</span><br> <span class=description><p>Version of the binary data file</p> </span> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.StreamServer.ChainID onclick="anchorLink('Sequencer.StreamServer.ChainID')">Sequencer.StreamServer.ChainID=</a> </div> <span class="badge badge-success default-value">Default: 0</span><span class="badge badge-dark value-type">Type: integer</span><br> <span class=description><p>ChainID is the chain ID</p> </span> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.StreamServer.Enabled onclick="anchorLink('Sequencer.StreamServer.Enabled')">Sequencer.StreamServer.Enabled=</a> </div> <span class="badge badge-success default-value">Default: false</span><span class="badge badge-dark value-type">Type: boolean</span><br> <span class=description><p>Enabled is a flag to enable/disable the data streamer</p> </span> <hr> <div class=accordion id=accordionSequencer_StreamServer_Log> <div class=card> <div class=card-header id=headingSequencer_StreamServer_Log> <h2 class=mb-0> <button class="btn btn-link property-name-button" type=button data-toggle=collapse data-target=#Sequencer_StreamServer_Log aria-expanded aria-controls=Sequencer_StreamServer_Log onclick="setAnchor('#Sequencer_StreamServer_Log')"><span class=property-name> <div class=breadcrumbs>[<a href=#Sequencer onclick="anchorLink('Sequencer')">Sequencer</a> . <a href=#Sequencer_StreamServer onclick="anchorLink('Sequencer_StreamServer')">StreamServer</a> . <a href=#Sequencer_StreamServer_Log onclick="anchorLink('Sequencer_StreamServer_Log')">Log</a>] </div></span></button> </h2> Log is the log configuration </div> <div id=Sequencer_StreamServer_Log class="collapse property-definition-div" aria-labelledby=headingSequencer_StreamServer_Log data-parent=#accordionSequencer_StreamServer_Log> <div class="card-body pl-5"> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><!-- None --><a href=#Sequencer.StreamServer.Log.Environment onclick="anchorLink('Sequencer.StreamServer.Log.Environment')">Sequencer.StreamServer.Log.Environment=</a> </div> <span class="badge badge-success default-value">Default: ""</span><span class="badge badge-dark value-type">Type: enum (of string)</span><br> <div class=enum-value id=Sequencer_StreamServer_Log_Environment_enum> <h4>Must be one of:</h4> <ul class=list-group><li class="list-group-item enum-item">"production"</li><li class="list-group-item enum-item">"development"</li></ul> </div> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><!-- None --><a href=#Sequencer.StreamServer.Log.Level onclick="anchorLink('Sequencer.StreamServer.Log.Level')">Sequencer.StreamServer.Log.Level=</a> </div> <span class="badge badge-success default-value">Default: ""</span><span class="badge badge-dark value-type">Type: enum (of string)</span><br> <div class=enum-value id=Sequencer_StreamServer_Log_Level_enum> <h4>Must be one of:</h4> <ul class=list-group><li class="list-group-item enum-item">"debug"</li><li class="list-group-item enum-item">"info"</li><li class="list-group-item enum-item">"warn"</li><li class="list-group-item enum-item">"error"</li><li class="list-group-item enum-item">"dpanic"</li><li class="list-group-item enum-item">"panic"</li><li class="list-group-item enum-item">"fatal"</li></ul> </div> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><!-- None --><a href=#Sequencer.StreamServer.Log.Outputs onclick="anchorLink('Sequencer.StreamServer.Log.Outputs')">Sequencer.StreamServer.Log.Outputs=</a> </div><span class="badge badge-dark value-type">Type: array of string</span><br> <h4>Each item of this array must be:</h4> <div class=card> <div class="card-body items-definition" id=Sequencer_StreamServer_Log_Outputs_items> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><!-- None --><!-- None --><a href="#Sequencer.StreamServer.Log.Outputs.Outputs items" onclick="anchorLink('Sequencer.StreamServer.Log.Outputs.Outputs items')">Sequencer.StreamServer.Log.Outputs.Outputs items=</a> </div><span class="badge badge-dark value-type">Type: string</span><br> </div> </div> <hr> </div> </div> </div> </div> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.StreamServer.UpgradeEtrogBatchNumber onclick="anchorLink('Sequencer.StreamServer.UpgradeEtrogBatchNumber')">Sequencer.StreamServer.UpgradeEtrogBatchNumber=</a> </div> <span class="badge badge-success default-value">Default: 0</span><span class="badge badge-dark value-type">Type: integer</span><br> <span class=description><p>UpgradeEtrogBatchNumber is the batch number of the upgrade etrog</p> </span> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.StreamServer.WriteTimeout onclick="anchorLink('Sequencer.StreamServer.WriteTimeout')">Sequencer.StreamServer.WriteTimeout=</a> </div> <span class="badge badge-success default-value">Default: "5s"</span><span class="badge badge-dark value-type">Type: string</span><br> <span class=description><p>WriteTimeout is the TCP write timeout when sending data to a datastream client</p> </span> <br> <div class="badge badge-secondary">Examples:</div> <br><div id=Sequencer_StreamServer_WriteTimeout_ex1 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;1m&quot;</span>
</pre></div> </div><div id=Sequencer_StreamServer_WriteTimeout_ex2 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;300ms&quot;</span>
</pre></div> </div> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.StreamServer.InactivityTimeout onclick="anchorLink('Sequencer.StreamServer.InactivityTimeout')">Sequencer.StreamServer.InactivityTimeout=</a> </div> <span class="badge badge-success default-value">Default: "2m0s"</span><span class="badge badge-dark value-type">Type: string</span><br> <span class=description><p>InactivityTimeout is the timeout to kill an inactive datastream client connection</p> </span> <br> <div class="badge badge-secondary">Examples:</div> <br><div id=Sequencer_StreamServer_InactivityTimeout_ex1 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;1m&quot;</span>
</pre></div> </div><div id=Sequencer_StreamServer_InactivityTimeout_ex2 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;300ms&quot;</span>
</pre></div> </div> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.StreamServer.InactivityCheckInterval onclick="anchorLink('Sequencer.StreamServer.InactivityCheckInterval')">Sequencer.StreamServer.InactivityCheckInterval=</a> </div> <span class="badge badge-success default-value">Default: "5s"</span><span class="badge badge-dark value-type">Type: string</span><br> <span class=description><p>InactivityCheckInterval is the time interval to check for datastream client connections that have reached the inactivity timeout to kill them</p> </span> <br> <div class="badge badge-secondary">Examples:</div> <br><div id=Sequencer_StreamServer_InactivityCheckInterval_ex1 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;1m&quot;</span>
</pre></div> </div><div id=Sequencer_StreamServer_InactivityCheckInterval_ex2 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;300ms&quot;</span>
</pre></div> </div> <hr> </div> </div> </div> </div> <div class=breadcrumbs> <!-- None --><!-- None --><a href=#Sequencer.PackBatchSpacialList onclick="anchorLink('Sequencer.PackBatchSpacialList')">Sequencer.PackBatchSpacialList=</a> </div><span class="badge badge-dark value-type">Type: array of string</span><br> <span class=description><p>XLayer config<br> PackBatchSpacialList is the list of addresses that will have a special gas price</p> </span> <h4>Each item of this array must be:</h4> <div class=card> <div class="card-body items-definition" id=Sequencer_PackBatchSpacialList_items> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href="#Sequencer.PackBatchSpacialList.PackBatchSpacialList items" onclick="anchorLink('Sequencer.PackBatchSpacialList.PackBatchSpacialList items')">Sequencer.PackBatchSpacialList.PackBatchSpacialList items=</a> </div><span class="badge badge-dark value-type">Type: string</span><br> </div> </div> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><a href=#Sequencer.GasPriceMultiple onclick="anchorLink('Sequencer.GasPriceMultiple')">Sequencer.GasPriceMultiple=</a> </div> <span class="badge badge-success default-value">Default: 0</span><span class="badge badge-dark value-type">Type: number</span><br> <span class=description><p>GasPriceMultiple is the multiple of the gas price</p> </span> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><a href=#Sequencer.InitGasPriceMultiple onclick="anchorLink('Sequencer.InitGasPriceMultiple')">Sequencer.InitGasPriceMultiple=</a> </div> <span class="badge badge-success default-value">Default: 0</span><span class="badge badge-dark value-type">Type: number</span><br> <span class=description><p>InitGasPriceMultiple is the multiple of the gas price for init free gas tx</p> </span> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><a href=#Sequencer.QueryPendingTxsLimit onclick="anchorLink('Sequencer.QueryPendingTxsLimit')">Sequencer.QueryPendingTxsLimit=</a> </div> <span class="badge badge-success default-value">Default: 0</span><span class="badge badge-dark value-type">Type: integer</span><br> <span class=description><p>QueryPendingTxsLimit is used to limit amount txs from the db</p> </span> <hr> </div> </div> </div> </div> <div class=accordion id=accordionSequenceSender> <div class=card> <div class=card-header id=headingSequenceSender> <h2 class=mb-0> <button class="btn btn-link property-name-button" type=button data-toggle=collapse data-target=#SequenceSender aria-expanded aria-controls=SequenceSender onclick="setAnchor('#SequenceSender')"><span class=property-name> <div class=breadcrumbs>[<a href=#SequenceSender onclick="anchorLink('SequenceSender')">SequenceSender</a>] </div></span></button> </h2> Configuration of the sequence sender service </div> <div id=SequenceSender class="collapse property-definition-div" aria-labelledby=headingSequenceSender data-parent=#accordionSequenceSender> <div class="card-body pl-5"> <div class=breadcrumbs> <!-- None --><!-- None --><a href=#SequenceSender.WaitPeriodSendSequence onclick="anchorLink('SequenceSender.WaitPeriodSendSequence')">SequenceSender.WaitPeriodSendSequence=</a> </div> <span class="badge badge-success default-value">Default: "5s"</span><span class="badge badge-dark value-type">Type: string</span><br> <span class=description><p>WaitPeriodSendSequence is the time the sequencer waits until<br> trying to send a sequence to L1</p> </span> <br> <div class="badge badge-secondary">Examples:</div> <br><div id=SequenceSender_WaitPeriodSendSequence_ex1 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;1m&quot;</span>
</pre></div> </div><div id=SequenceSender_WaitPeriodSendSequence_ex2 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;300ms&quot;</span>
</pre></div> </div> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><a href=#SequenceSender.LastBatchVirtualizationTimeMaxWaitPeriod onclick="anchorLink('SequenceSender.LastBatchVirtualizationTimeMaxWaitPeriod')">SequenceSender.LastBatchVirtualizationTimeMaxWaitPeriod=</a> </div> <span class="badge badge-success default-value">Default: "5s"</span><span class="badge badge-dark value-type">Type: string</span><br> <span class=description><p>LastBatchVirtualizationTimeMaxWaitPeriod is time since sequences should be sent</p> </span> <br> <div class="badge badge-secondary">Examples:</div> <br><div id=SequenceSender_LastBatchVirtualizationTimeMaxWaitPeriod_ex1 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;1m&quot;</span>
Expand Down
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 @@ -3806,6 +3808,58 @@ UpgradeEtrogBatchNumber=0
WriteTimeout="5s"
```

#### <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="Sequencer_PackBatchSpacialList"></a>10.10. `Sequencer.PackBatchSpacialList`

**Type:** : `array of string`
Expand Down
Loading

0 comments on commit 9d5563d

Please sign in to comment.