Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
agnusmor authored Aug 9, 2024
1 parent aa9342c commit 07c3182
Show file tree
Hide file tree
Showing 15 changed files with 124 additions and 20 deletions.
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 @@ -164,6 +164,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 @@ -113,6 +113,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 @@ -58,6 +58,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> </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 @@ -2503,6 +2503,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 @@ -2666,6 +2668,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="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 @@ -1013,6 +1013,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
10 changes: 5 additions & 5 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-RC5
github.com/didip/tollbooth/v6 v6.1.2
github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127
github.com/ethereum/go-ethereum v1.13.14
Expand All @@ -22,7 +22,7 @@ require (
github.com/prometheus/common v0.53.0
github.com/rubenv/sql-migrate v1.6.1
github.com/spf13/afero v1.11.0
github.com/spf13/viper v1.17.0
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.9.0
github.com/umbracle/ethgo v0.1.3
github.com/urfave/cli/v2 v2.27.2
Expand Down Expand Up @@ -68,7 +68,7 @@ require (
github.com/emirpasic/gods v1.18.1 // indirect
github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
github.com/fjl/memsize v0.0.2 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect
github.com/getsentry/sentry-go v0.18.0 // indirect
Expand Down Expand Up @@ -126,14 +126,14 @@ require (
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/rs/cors v1.7.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/skeema/knownhosts v1.2.2 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
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.2 // indirect
Expand Down
Loading

0 comments on commit 07c3182

Please sign in to comment.