Skip to content

Commit

Permalink
sync: fix getting URL from contract in compatibility mode, and set se…
Browse files Browse the repository at this point in the history
…quential by default (0xPolygonHermez#3191)

* fix getting URL from contract in compatibility mode
* synchronizer configuration  by default use `sequential` mode
  • Loading branch information
joanestebanr authored Feb 2, 2024
1 parent f3dfbf2 commit 6f81efa
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func runSynchronizer(cfg config.Config, etherman *etherman.Client, ethTxManagerS
log.Fatal("error getting trusted sequencer URI. Error: %v", err)
}
}
log.Debug("trustedSequencerURL ", trustedSequencerURL)
log.Info("trustedSequencerURL ", trustedSequencerURL)
}
zkEVMClient := client.NewClient(trustedSequencerURL)

Expand Down
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func Test_Defaults(t *testing.T) {
},
{
path: "Synchronizer.L1SynchronizationMode",
expectedValue: "parallel",
expectedValue: "sequential",
},
{
path: "Synchronizer.L1ParallelSynchronization.MaxClients",
Expand Down
2 changes: 1 addition & 1 deletion config/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ EnableHttpLog = true
SyncInterval = "1s"
SyncChunkSize = 100
TrustedSequencerURL = "" # If it is empty or not specified, then the value is read from the smc
L1SynchronizationMode = "parallel"
L1SynchronizationMode = "sequential"
[Synchronizer.L1ParallelSynchronization]
MaxClients = 10
MaxPendingNoProcessedBlocks = 25
Expand Down
2 changes: 1 addition & 1 deletion docs/config-file/node-config-doc.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/config-file/node-config-doc.md
Original file line number Diff line number Diff line change
Expand Up @@ -1287,16 +1287,16 @@ TrustedSequencerURL=""

**Type:** : `enum (of string)`

**Default:** `"parallel"`
**Default:** `"sequential"`

**Description:** L1SynchronizationMode define how to synchronize with L1:
- parallel: Request data to L1 in parallel, and process sequentially. The advantage is that executor is not blocked waiting for L1 data
- sequential: Request data to L1 and execute

**Example setting the default value** ("parallel"):
**Example setting the default value** ("sequential"):
```
[Synchronizer]
L1SynchronizationMode="parallel"
L1SynchronizationMode="sequential"
```

Must be one of:
Expand Down
2 changes: 1 addition & 1 deletion docs/config-file/node-config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@
"parallel"
],
"description": "L1SynchronizationMode define how to synchronize with L1:\n- parallel: Request data to L1 in parallel, and process sequentially. The advantage is that executor is not blocked waiting for L1 data\n- sequential: Request data to L1 and execute",
"default": "parallel"
"default": "sequential"
},
"L1ParallelSynchronization": {
"properties": {
Expand Down
10 changes: 9 additions & 1 deletion etherman/etherman.go
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,15 @@ func (etherMan *Client) ApprovePol(ctx context.Context, account common.Address,

// GetTrustedSequencerURL Gets the trusted sequencer url from rollup smc
func (etherMan *Client) GetTrustedSequencerURL() (string, error) {
return etherMan.ZkEVM.TrustedSequencerURL(&bind.CallOpts{Pending: false})
url, err := etherMan.ZkEVM.TrustedSequencerURL(&bind.CallOpts{Pending: false})
//TODO: remove this code because is for compatibility with oldZkEVM
if err != nil || url == "" {
// Getting from oldZkEVM Contract
log.Debug("getting trusted sequencer URL from oldZkevm smc")
return etherMan.OldZkEVM.TrustedSequencerURL(&bind.CallOpts{Pending: false})
}
// err is always nil
return url, nil
}

// GetL2ChainID returns L2 Chain ID
Expand Down

0 comments on commit 6f81efa

Please sign in to comment.