Skip to content

Commit

Permalink
Sequencer Etrog refactor (0xPolygonHermez#2878)
Browse files Browse the repository at this point in the history
* sequencer etrog draft 1

* refactor sequencer etrog implemetation
  • Loading branch information
agnusmor authored Dec 4, 2023
1 parent ed1e943 commit 5576e50
Show file tree
Hide file tree
Showing 35 changed files with 1,643 additions and 944 deletions.
20 changes: 18 additions & 2 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ func Test_Defaults(t *testing.T) {
path: "Sequencer.Finalizer.GERFinalityNumberOfBlocks",
expectedValue: uint64(64),
},
{
path: "Sequencer.Finalizer.ForcedBatchesFinalityNumberOfBlocks",
expectedValue: uint64(64),
},
{
path: "Sequencer.Finalizer.L1InfoRootFinalityNumberOfBlocks",
expectedValue: uint64(64),
},
{
path: "Sequencer.Finalizer.ClosingSignalsManagerWaitForCheckingL1Timeout",
expectedValue: types.NewDuration(10 * time.Second),
Expand All @@ -105,8 +113,12 @@ func Test_Defaults(t *testing.T) {
expectedValue: types.NewDuration(10 * time.Second),
},
{
path: "Sequencer.Finalizer.ForcedBatchesFinalityNumberOfBlocks",
expectedValue: uint64(64),
path: "Sequencer.Finalizer.WaitForCheckingL1InfoTree",
expectedValue: types.NewDuration(10 * time.Second),
},
{
path: "Sequencer.Finalizer.L2BlockTime",
expectedValue: types.NewDuration(3 * time.Second),
},
{
path: "Sequencer.Finalizer.StopSequencerOnBatchNum",
Expand All @@ -116,6 +128,10 @@ func Test_Defaults(t *testing.T) {
path: "Sequencer.Finalizer.TimestampResolution",
expectedValue: types.NewDuration(10 * time.Second),
},
{
path: "Sequencer.Finalizer.L2BlockTime",
expectedValue: types.NewDuration(10 * time.Second),
},
{
path: "Sequencer.DBManager.PoolRetrievalInterval",
expectedValue: types.NewDuration(500 * time.Millisecond),
Expand Down
5 changes: 4 additions & 1 deletion config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,14 @@ MaxTxLifetime = "3h"
SleepDuration = "100ms"
ResourcePercentageToCloseBatch = 10
GERFinalityNumberOfBlocks = 64
ForcedBatchesFinalityNumberOfBlocks = 64
L1InfoRootFinalityNumberOfBlocks = 64
ClosingSignalsManagerWaitForCheckingL1Timeout = "10s"
ClosingSignalsManagerWaitForCheckingGER = "10s"
ClosingSignalsManagerWaitForCheckingForcedBatches = "10s"
ForcedBatchesFinalityNumberOfBlocks = 64
WaitForCheckingL1InfoTree = "10s"
TimestampResolution = "10s"
L2BlockTime = "3s"
StopSequencerOnBatchNum = 0
SequentialReprocessFullBatch = false
[Sequencer.DBManager]
Expand Down
5 changes: 4 additions & 1 deletion config/environments/local/local.node.config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,14 @@ MaxTxLifetime = "3h"
SleepDuration = "100ms"
ResourcePercentageToCloseBatch = 10
GERFinalityNumberOfBlocks = 0
ForcedBatchesFinalityNumberOfBlocks = 64
L1InfoRootFinalityNumberOfBlocks = 64
ClosingSignalsManagerWaitForCheckingL1Timeout = "10s"
ClosingSignalsManagerWaitForCheckingGER = "10s"
ClosingSignalsManagerWaitForCheckingForcedBatches = "10s"
ForcedBatchesFinalityNumberOfBlocks = 64
WaitForCheckingL1InfoTree = "10s"
TimestampResolution = "10s"
L2BlockTime = "3s"
StopSequencerOnBatchNum = 0
[Sequencer.DBManager]
PoolRetrievalInterval = "500ms"
Expand Down
8 changes: 6 additions & 2 deletions docs/config-file/node-config-doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,18 @@
</pre></div> </div><div id=Sequencer_Finalizer_ForcedBatchDeadlineTimeout_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.Finalizer.SleepDuration onclick="anchorLink('Sequencer.Finalizer.SleepDuration')">Sequencer.Finalizer.SleepDuration=</a> </div> <span class="badge badge-success default-value">Default: "100ms"</span><span class="badge badge-dark value-type">Type: string</span><br> <span class=description><p>SleepDuration is the time the finalizer sleeps between each iteration, if there are no transactions to be processed</p> </span> <br> <div class="badge badge-secondary">Examples:</div> <br><div id=Sequencer_Finalizer_SleepDuration_ex1 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;1m&quot;</span>
</pre></div> </div><div id=Sequencer_Finalizer_SleepDuration_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.Finalizer.ResourcePercentageToCloseBatch onclick="anchorLink('Sequencer.Finalizer.ResourcePercentageToCloseBatch')">Sequencer.Finalizer.ResourcePercentageToCloseBatch=</a> </div> <span class="badge badge-success default-value">Default: 10</span><span class="badge badge-dark value-type">Type: integer</span><br> <span class=description><p>ResourcePercentageToCloseBatch is the percentage window of the resource left out for the batch to be closed</p> </span> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.Finalizer.GERFinalityNumberOfBlocks onclick="anchorLink('Sequencer.Finalizer.GERFinalityNumberOfBlocks')">Sequencer.Finalizer.GERFinalityNumberOfBlocks=</a> </div> <span class="badge badge-success default-value">Default: 64</span><span class="badge badge-dark value-type">Type: integer</span><br> <span class=description><p>GERFinalityNumberOfBlocks is number of blocks to consider GER final</p> </span> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.Finalizer.ClosingSignalsManagerWaitForCheckingL1Timeout onclick="anchorLink('Sequencer.Finalizer.ClosingSignalsManagerWaitForCheckingL1Timeout')">Sequencer.Finalizer.ClosingSignalsManagerWaitForCheckingL1Timeout=</a> </div> <span class="badge badge-success default-value">Default: "10s"</span><span class="badge badge-dark value-type">Type: string</span><br> <span class=description><p>ClosingSignalsManagerWaitForCheckingL1Timeout is used by the closing signals manager to wait for its operation</p> </span> <br> <div class="badge badge-secondary">Examples:</div> <br><div id=Sequencer_Finalizer_ClosingSignalsManagerWaitForCheckingL1Timeout_ex1 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;1m&quot;</span>
</pre></div> </div> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.Finalizer.ResourcePercentageToCloseBatch onclick="anchorLink('Sequencer.Finalizer.ResourcePercentageToCloseBatch')">Sequencer.Finalizer.ResourcePercentageToCloseBatch=</a> </div> <span class="badge badge-success default-value">Default: 10</span><span class="badge badge-dark value-type">Type: integer</span><br> <span class=description><p>ResourcePercentageToCloseBatch is the percentage window of the resource left out for the batch to be closed</p> </span> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.Finalizer.GERFinalityNumberOfBlocks onclick="anchorLink('Sequencer.Finalizer.GERFinalityNumberOfBlocks')">Sequencer.Finalizer.GERFinalityNumberOfBlocks=</a> </div> <span class="badge badge-success default-value">Default: 64</span><span class="badge badge-dark value-type">Type: integer</span><br> <span class=description><p>GERFinalityNumberOfBlocks is number of blocks to consider GER final</p> </span> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.Finalizer.ForcedBatchesFinalityNumberOfBlocks onclick="anchorLink('Sequencer.Finalizer.ForcedBatchesFinalityNumberOfBlocks')">Sequencer.Finalizer.ForcedBatchesFinalityNumberOfBlocks=</a> </div> <span class="badge badge-success default-value">Default: 64</span><span class="badge badge-dark value-type">Type: integer</span><br> <span class=description><p>ForcedBatchesFinalityNumberOfBlocks is number of blocks to consider GER final</p> </span> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.Finalizer.L1InfoRootFinalityNumberOfBlocks onclick="anchorLink('Sequencer.Finalizer.L1InfoRootFinalityNumberOfBlocks')">Sequencer.Finalizer.L1InfoRootFinalityNumberOfBlocks=</a> </div> <span class="badge badge-success default-value">Default: 64</span><span class="badge badge-dark value-type">Type: integer</span><br> <span class=description><p>L1InfoRootFinalityNumberOfBlocks is number of blocks to consider L1InfoRoot final</p> </span> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.Finalizer.ClosingSignalsManagerWaitForCheckingL1Timeout onclick="anchorLink('Sequencer.Finalizer.ClosingSignalsManagerWaitForCheckingL1Timeout')">Sequencer.Finalizer.ClosingSignalsManagerWaitForCheckingL1Timeout=</a> </div> <span class="badge badge-success default-value">Default: "10s"</span><span class="badge badge-dark value-type">Type: string</span><br> <span class=description><p>ClosingSignalsManagerWaitForCheckingL1Timeout is used by the closing signals manager to wait for its operation</p> </span> <br> <div class="badge badge-secondary">Examples:</div> <br><div id=Sequencer_Finalizer_ClosingSignalsManagerWaitForCheckingL1Timeout_ex1 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;1m&quot;</span>
</pre></div> </div><div id=Sequencer_Finalizer_ClosingSignalsManagerWaitForCheckingL1Timeout_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.Finalizer.ClosingSignalsManagerWaitForCheckingGER onclick="anchorLink('Sequencer.Finalizer.ClosingSignalsManagerWaitForCheckingGER')">Sequencer.Finalizer.ClosingSignalsManagerWaitForCheckingGER=</a> </div> <span class="badge badge-success default-value">Default: "10s"</span><span class="badge badge-dark value-type">Type: string</span><br> <span class=description><p>ClosingSignalsManagerWaitForCheckingGER is used by the closing signals manager to wait for its operation</p> </span> <br> <div class="badge badge-secondary">Examples:</div> <br><div id=Sequencer_Finalizer_ClosingSignalsManagerWaitForCheckingGER_ex1 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;1m&quot;</span>
</pre></div> </div><div id=Sequencer_Finalizer_ClosingSignalsManagerWaitForCheckingGER_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.Finalizer.ClosingSignalsManagerWaitForCheckingForcedBatches onclick="anchorLink('Sequencer.Finalizer.ClosingSignalsManagerWaitForCheckingForcedBatches')">Sequencer.Finalizer.ClosingSignalsManagerWaitForCheckingForcedBatches=</a> </div> <span class="badge badge-success default-value">Default: "10s"</span><span class="badge badge-dark value-type">Type: string</span><br> <span class=description><p>ClosingSignalsManagerWaitForCheckingL1Timeout is used by the closing signals manager to wait for its operation</p> </span> <br> <div class="badge badge-secondary">Examples:</div> <br><div id=Sequencer_Finalizer_ClosingSignalsManagerWaitForCheckingForcedBatches_ex1 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;1m&quot;</span>
</pre></div> </div><div id=Sequencer_Finalizer_ClosingSignalsManagerWaitForCheckingForcedBatches_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.Finalizer.ForcedBatchesFinalityNumberOfBlocks onclick="anchorLink('Sequencer.Finalizer.ForcedBatchesFinalityNumberOfBlocks')">Sequencer.Finalizer.ForcedBatchesFinalityNumberOfBlocks=</a> </div> <span class="badge badge-success default-value">Default: 64</span><span class="badge badge-dark value-type">Type: integer</span><br> <span class=description><p>ForcedBatchesFinalityNumberOfBlocks is number of blocks to consider GER final</p> </span> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.Finalizer.TimestampResolution onclick="anchorLink('Sequencer.Finalizer.TimestampResolution')">Sequencer.Finalizer.TimestampResolution=</a> </div> <span class="badge badge-success default-value">Default: "10s"</span><span class="badge badge-dark value-type">Type: string</span><br> <span class=description><p>TimestampResolution is the resolution of the timestamp used to close a batch</p> </span> <br> <div class="badge badge-secondary">Examples:</div> <br><div id=Sequencer_Finalizer_TimestampResolution_ex1 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;1m&quot;</span>
</pre></div> </div> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.Finalizer.WaitForCheckingL1InfoRoot onclick="anchorLink('Sequencer.Finalizer.WaitForCheckingL1InfoRoot')">Sequencer.Finalizer.WaitForCheckingL1InfoRoot=</a> </div> <span class="badge badge-success default-value">Default: "0s"</span><span class="badge badge-dark value-type">Type: string</span><br> <span class=description><p>WaitForCheckingL1InfoRoot is the wait time to check if the L1InfoRoot has been updated</p> </span> <br> <div class="badge badge-secondary">Examples:</div> <br><div id=Sequencer_Finalizer_WaitForCheckingL1InfoRoot_ex1 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;1m&quot;</span>
</pre></div> </div><div id=Sequencer_Finalizer_WaitForCheckingL1InfoRoot_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.Finalizer.TimestampResolution onclick="anchorLink('Sequencer.Finalizer.TimestampResolution')">Sequencer.Finalizer.TimestampResolution=</a> </div> <span class="badge badge-success default-value">Default: "10s"</span><span class="badge badge-dark value-type">Type: string</span><br> <span class=description><p>TimestampResolution is the resolution of the timestamp used to close a batch</p> </span> <br> <div class="badge badge-secondary">Examples:</div> <br><div id=Sequencer_Finalizer_TimestampResolution_ex1 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;1m&quot;</span>
</pre></div> </div><div id=Sequencer_Finalizer_TimestampResolution_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.Finalizer.L2BlockTime onclick="anchorLink('Sequencer.Finalizer.L2BlockTime')">Sequencer.Finalizer.L2BlockTime=</a> </div> <span class="badge badge-success default-value">Default: "3s"</span><span class="badge badge-dark value-type">Type: string</span><br> <span class=description><p>L2BlockTime is the resolution of the timestamp used to close a L2 block</p> </span> <br> <div class="badge badge-secondary">Examples:</div> <br><div id=Sequencer_Finalizer_L2BlockTime_ex1 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;1m&quot;</span>
</pre></div> </div><div id=Sequencer_Finalizer_L2BlockTime_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.Finalizer.StopSequencerOnBatchNum onclick="anchorLink('Sequencer.Finalizer.StopSequencerOnBatchNum')">Sequencer.Finalizer.StopSequencerOnBatchNum=</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>StopSequencerOnBatchNum specifies the batch number where the Sequencer will stop to process more transactions and generate new batches. The Sequencer will halt after it closes the batch equal to this number</p> </span> <hr> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.Finalizer.SequentialReprocessFullBatch onclick="anchorLink('Sequencer.Finalizer.SequentialReprocessFullBatch')">Sequencer.Finalizer.SequentialReprocessFullBatch=</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>SequentialReprocessFullBatch indicates if the reprocess of a closed batch (sanity check) must be done in a<br> sequential way (instead than in parallel)</p> </span> <hr> </div> </div> </div> </div> <div class=accordion id=accordionSequencer_DBManager> <div class=card> <div class=card-header id=headingSequencer_DBManager> <h2 class=mb-0> <button class="btn btn-link property-name-button" type=button data-toggle=collapse data-target=#Sequencer_DBManager aria-expanded aria-controls=Sequencer_DBManager onclick="setAnchor('#Sequencer_DBManager')"><span class=property-name> <div class=breadcrumbs>[<a href=#Sequencer onclick="anchorLink('Sequencer')">Sequencer</a> . <a href=#Sequencer_DBManager onclick="anchorLink('Sequencer_DBManager')">DBManager</a>] </div></span></button> </h2> DBManager&#39;s specific config properties </div> <div id=Sequencer_DBManager class="collapse property-definition-div" aria-labelledby=headingSequencer_DBManager data-parent=#accordionSequencer_DBManager> <div class="card-body pl-5"> <div class=breadcrumbs> <!-- None --><!-- None --><!-- None --><a href=#Sequencer.DBManager.PoolRetrievalInterval onclick="anchorLink('Sequencer.DBManager.PoolRetrievalInterval')">Sequencer.DBManager.PoolRetrievalInterval=</a> </div> <span class="badge badge-success default-value">Default: "500ms"</span><span class="badge badge-dark value-type">Type: string</span><br> <br> <div class="badge badge-secondary">Examples:</div> <br><div id=Sequencer_DBManager_PoolRetrievalInterval_ex1 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;1m&quot;</span>
</pre></div> </div><div id=Sequencer_DBManager_PoolRetrievalInterval_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.DBManager.L2ReorgRetrievalInterval onclick="anchorLink('Sequencer.DBManager.L2ReorgRetrievalInterval')">Sequencer.DBManager.L2ReorgRetrievalInterval=</a> </div> <span class="badge badge-success default-value">Default: "5s"</span><span class="badge badge-dark value-type">Type: string</span><br> <br> <div class="badge badge-secondary">Examples:</div> <br><div id=Sequencer_DBManager_L2ReorgRetrievalInterval_ex1 class="jumbotron examples"><div class=highlight><pre><span></span><span class=s2>&quot;1m&quot;</span>
Expand Down
Loading

0 comments on commit 5576e50

Please sign in to comment.