diff --git a/docs/config-file/node-config-doc.html b/docs/config-file/node-config-doc.html index 00015a00a0..5042daf49f 100644 --- a/docs/config-file/node-config-doc.html +++ b/docs/config-file/node-config-doc.html @@ -20,7 +20,7 @@
"300ms"
 

Default: 500Type: number

MaxRequestsPerIPAndSecond defines how much requests a single IP can
send within a single second


Default: ""Type: string

SequencerNodeURI is used allow Non-Sequencer nodes
to relay transactions to the Sequencer node


Default: 0Type: integer

MaxCumulativeGasUsed is the max gas allowed per batch


WebSockets configuration
Default: trueType: boolean

Enabled defines if the WebSocket requests are enabled or disabled


Default: "0.0.0.0"Type: string

Host defines the network adapter that will be used to serve the WS requests


Default: 8546Type: integer

Port defines the port to serve the endpoints via WS


Default: 104857600Type: integer

ReadLimit defines the maximum size of a message read from the client (in bytes)


Default: trueType: boolean

EnableL2SuggestedGasPricePolling enables polling of the L2 gas price to block tx in the RPC with lower gas price.


Default: falseType: boolean

BatchRequestsEnabled defines if the Batch requests are enabled or disabled


Default: 20Type: integer

BatchRequestsLimit defines the limit of requests that can be incorporated into each batch request


Type: array of integer

L2Coinbase defines which address is going to receive the fees

Must contain a minimum of 20 items

Must contain a maximum of 20 items

Each item of this array must be:

Type: integer

Default: 10000Type: integer

MaxLogsCount is a configuration to set the max number of logs that can be returned
in a single call to the state, if zero it means no limit


Default: 10000Type: integer

MaxLogsBlockRange is a configuration to set the max range for block number when querying TXs
logs in a single call to the state, if zero it means no limit


Default: 60000Type: integer

MaxNativeBlockHashBlockRange is a configuration to set the max range for block number when querying
native block hashes in a single call to the state, if zero it means no limit


Default: trueType: boolean

EnableHttpLog allows the user to enable or disable the logs related to the HTTP
requests to be captured by the server.


ZKCountersLimits defines the ZK Counter limits
Default: 0Type: integer

Default: 0Type: integer

Default: 0Type: integer

Default: 0Type: integer

Default: 0Type: integer

Default: 0Type: integer

Default: 0Type: integer

Default: 0Type: integer

Default: falseType: boolean

XLayer config
EnablePendingTransactionFilter enables pending transaction filter that can support query L2 pending transaction


Nacos configuration
Default: ""Type: string

URLs nacos server urls for discovery service of rest api, url is separated by ","


Default: ""Type: string

NamespaceId nacos namepace id for discovery service of rest api


Default: ""Type: string

ApplicationName rest application name in nacos


Default: ""Type: string

ExternalListenAddr Set the rest-server external ip and port, when it is launched by Docker


NacosWs configuration
Default: ""Type: string

URLs nacos server urls for discovery service of rest api, url is separated by ","


Default: ""Type: string

NamespaceId nacos namepace id for discovery service of rest api


Default: ""Type: string

ApplicationName rest application name in nacos


Default: ""Type: string

ExternalListenAddr Set the rest-server external ip and port, when it is launched by Docker


Default: 1Type: number

GasLimitFactor is used to multiply the suggested gas provided by the network
in order to allow a enough gas to be set for all the transactions default value is 1.

ex:
suggested gas limit: 100
GasLimitFactor: 1
gas limit = 100

suggested gas limit: 100
GasLimitFactor: 1.1
gas limit = 110


Default: falseType: boolean

Default: falseType: boolean

Default: []Type: array of string

DisableAPIs disable some API

Each item of this array must be:

Type: string

RateLimit enable rate limit
Default: falseType: boolean

Enabled defines if the rate limit is enabled or disabled


Default: []Type: array of string

RateLimitApis defines the apis that need to be rate limited

Each item of this array must be:


Default: 100Type: integer

RateLimitBurst defines the maximum burst size of requests


Default: 1Type: integer

RateLimitDuration defines the time window for the rate limit


Default: []Type: array of object

SpecialApis defines the apis that need to be rate limited with special rate limit

Each item of this array must be:

Type: string

Api defines the api that need to be rate limited


Type: integer

Count defines the maximum burst size of requests


Type: integer

Duration defines the time window for the rate limit



DynamicGP defines the config of dynamic gas price
Default: falseType: boolean

Enabled defines if the dynamic gas price is enabled or disabled


Default: 100Type: integer

CongestionTxThreshold defines the tx threshold to measure whether there is congestion


Default: 5Type: integer

CheckBatches defines the number of recent Batches used to sample gas price


Default: 3Type: integer

SampleTxNumer defines the number of sampled gas prices in each batch


Default: 70Type: integer

Percentile defines the sampling weight of all sampled gas prices


Default: 20000000000Type: integer

MaxPrice defines the dynamic gas price upper limit


Default: 2000000000Type: integer

MinPrice defines the dynamic gas price lower limit


Default: "10s"Type: string

UpdatePeriod defines the time interval for updating dynamic gas price


Examples:

"1m"
 
"300ms"
-

Default: falseType: boolean

EnableInnerTxCacheDB enables the inner tx cache db


Type: array of integer

BridgeAddress is the address of the bridge contract

Must contain a minimum of 20 items

Must contain a maximum of 20 items

Each item of this array must be:

Type: integer

ApiAuthentication defines the authentication configuration for the API
Default: falseType: boolean

Enabled defines if the api authentication is enabled


Default: []Type: array of object

ApiKeys defines the api keys

Each item of this array must be:

Type: string

Name defines the name of the key


Type: string

Key defines the key


Type: string

Timeout defines the timeout



ApiRelay defines the relay configuration for the API
Default: falseType: boolean

Default: ""Type: string

Default: []Type: array of string

Each item of this array must be:


Configuration of service `Syncrhonizer`. For this service is also really important the value of `IsTrustedSequencer` because depending of this values is going to ask to a trusted node for trusted transactions or not
Default: "1s"Type: string

SyncInterval is the delay interval between reading new rollup information


Examples:

"1m"
+

Default: falseType: boolean

EnableInnerTxCacheDB enables the inner tx cache db


Type: array of integer

BridgeAddress is the address of the bridge contract

Must contain a minimum of 20 items

Must contain a maximum of 20 items

Each item of this array must be:

Type: integer

ApiAuthentication defines the authentication configuration for the API
Default: falseType: boolean

Enabled defines if the api authentication is enabled


Default: []Type: array of object

ApiKeys defines the api keys

Each item of this array must be:

Type: string

Name defines the name of the key


Type: string

Key defines the key


Type: string

Timeout defines the timeout



ApiRelay defines the relay configuration for the API
Default: falseType: boolean

Default: ""Type: string

Default: []Type: array of string

Each item of this array must be:


Default: falseType: boolean

Configuration of service `Syncrhonizer`. For this service is also really important the value of `IsTrustedSequencer` because depending of this values is going to ask to a trusted node for trusted transactions or not
Default: "1s"Type: string

SyncInterval is the delay interval between reading new rollup information


Examples:

"1m"
 
"300ms"
 

Default: 100Type: integer

SyncChunkSize is the number of blocks to sync on each chunk


Default: ""Type: string

TrustedSequencerURL is the rpc url to connect and sync the trusted state


Default: "safe"Type: string

SyncBlockProtection specify the state to sync (lastest, finalized or safe)


Default: trueType: boolean

L1SyncCheckL2BlockHash if is true when a batch is closed is force to check L2Block hash against trustedNode (only apply for permissionless)


Default: 600Type: integer

L1SyncCheckL2BlockNumberhModulus is the modulus used to choose the l2block to check
a modules 5, for instance, means check all l2block multiples of 5 (10,15,20,...)


Default: trueType: boolean

Enable if is true then the check l1 Block Hash is active


Default: "finalized"Type: enum (of string)

L1SafeBlockPoint is the point that a block is considered safe enough to be checked
it can be: finalized, safe,pending or latest

Must be one of:

  • "finalized"
  • "safe"
  • "latest"

Default: 0Type: integer

L1SafeBlockOffset is the offset to add to L1SafeBlockPoint as a safe point
it can be positive or negative
Example: L1SafeBlockPoint= finalized, L1SafeBlockOffset= -10, then the safe block ten blocks before the finalized block


Default: trueType: boolean

ForceCheckBeforeStart if is true then the first time the system is started it will force to check all pending blocks


Default: trueType: boolean

PreCheckEnable if is true then the pre-check is active, will check blocks between L1SafeBlock and L1PreSafeBlock


Default: "safe"Type: enum (of string)

L1PreSafeBlockPoint is the point that a block is considered safe enough to be checked
it can be: finalized, safe,pending or latest

Must be one of:

  • "finalized"
  • "safe"
  • "latest"

Default: 0Type: integer

L1PreSafeBlockOffset is the offset to add to L1PreSafeBlockPoint as a safe point
it can be positive or negative
Example: L1PreSafeBlockPoint= finalized, L1PreSafeBlockOffset= -10, then the safe block ten blocks before the finalized block


Default: "sequential"Type: enum (of string)

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

Must be one of:

  • "sequential"
  • "parallel"

L1ParallelSynchronization Configuration for parallel mode (if L1SynchronizationMode equal to 'parallel')
Default: 10Type: integer

MaxClients Number of clients used to synchronize with L1


Default: 25Type: integer

MaxPendingNoProcessedBlocks Size of the buffer used to store rollup information from L1, must be >= to NumberOfEthereumClientsToSync
sugested twice of NumberOfParallelOfEthereumClients


Default: "5s"Type: string

RequestLastBlockPeriod is the time to wait to request the
last block to L1 to known if we need to retrieve more data.
This value only apply when the system is synchronized


Examples:

"1m"
 
"300ms"
diff --git a/docs/config-file/node-config-doc.md b/docs/config-file/node-config-doc.md
index c2fae0654c..15495e7d32 100644
--- a/docs/config-file/node-config-doc.md
+++ b/docs/config-file/node-config-doc.md
@@ -2335,6 +2335,7 @@ ApiKeys=[]
 | - [Enabled](#RPC_ApiRelay_Enabled ) | No      | boolean         | No         | -          | -                 |
 | - [DestURI](#RPC_ApiRelay_DestURI ) | No      | string          | No         | -          | -                 |
 | - [RPCs](#RPC_ApiRelay_RPCs )       | No      | array of string | No         | -          | -                 |
+| - [Rerun](#RPC_ApiRelay_Rerun )     | No      | boolean         | No         | -          | -                 |
 
 #### 8.30.1. `RPC.ApiRelay.Enabled`
 
@@ -2372,6 +2373,18 @@ DestURI=""
 RPCs=[]
 ```
 
+#### 8.30.4. `RPC.ApiRelay.Rerun`
+
+**Type:** : `boolean`
+
+**Default:** `false`
+
+**Example setting the default value** (false):
+```
+[RPC.ApiRelay]
+Rerun=false
+```
+
 ## 9. `[Synchronizer]`
 
 **Type:** : `object`
diff --git a/docs/config-file/node-config-schema.json b/docs/config-file/node-config-schema.json
index 1029b0ed18..6fc24faf18 100644
--- a/docs/config-file/node-config-schema.json
+++ b/docs/config-file/node-config-schema.json
@@ -915,6 +915,10 @@
 							},
 							"type": "array",
 							"default": []
+						},
+						"Rerun": {
+							"type": "boolean",
+							"default": false
 						}
 					},
 					"additionalProperties": false,
diff --git a/jsonrpc/api_relay_xlayer.go b/jsonrpc/api_relay_xlayer.go
index 0035c968de..b2d3d78e05 100644
--- a/jsonrpc/api_relay_xlayer.go
+++ b/jsonrpc/api_relay_xlayer.go
@@ -12,6 +12,7 @@ type ApiRelayConfig struct {
 	Enabled bool     `mapstructure:"Enabled"`
 	DestURI string   `mapstructure:"DestURI"`
 	RPCs    []string `mapstructure:"RPCs"`
+	Rerun   bool     `mapstructure:"Rerun"`
 }
 
 func shouldRelay(localCfg ApiRelayConfig, name string) bool {
@@ -27,6 +28,15 @@ func shouldRelay(localCfg ApiRelayConfig, name string) bool {
 	return enable && contained
 }
 
+func shouldRerun(localCfg ApiRelayConfig) bool {
+	if getApolloConfig().Enable() {
+		getApolloConfig().RLock()
+		defer getApolloConfig().RUnlock()
+		return getApolloConfig().ApiRelay.Rerun
+	}
+	return localCfg.Rerun
+}
+
 func getRelayDestURI(localDestURI string) string {
 	ret := localDestURI
 	if getApolloConfig().Enable() {
@@ -42,7 +52,7 @@ func getRelayDestURI(localDestURI string) string {
 func tryRelay(localCfg ApiRelayConfig, request types.Request) (types.Response, bool) {
 	if shouldRelay(localCfg, request.Method) && pass(&request) {
 		destURI := getRelayDestURI(localCfg.DestURI)
-		res, err := client.JSONRPCRelay(destURI, request)
+		res, err := client.JSONRPCRelay(destURI, request, shouldRerun(localCfg))
 		if err != nil {
 			log.Errorf("failed to relay %v to %s: %v", request.Method, destURI, err)
 			metrics.RequestRelayFailCount(request.Method)
diff --git a/jsonrpc/apollo_xlayer.go b/jsonrpc/apollo_xlayer.go
index b98590c6d4..bcbd7ab9c8 100644
--- a/jsonrpc/apollo_xlayer.go
+++ b/jsonrpc/apollo_xlayer.go
@@ -55,6 +55,7 @@ func (c *ApolloConfig) setApiRelayCfg(apiRelayCfg ApiRelayConfig) {
 	c.ApiRelay.Enabled = apiRelayCfg.Enabled
 	c.ApiRelay.DestURI = apiRelayCfg.DestURI
 	c.ApiRelay.RPCs = make([]string, len(apiRelayCfg.RPCs))
+	c.ApiRelay.Rerun = apiRelayCfg.Rerun
 	copy(c.ApiRelay.RPCs, apiRelayCfg.RPCs)
 }
 
diff --git a/jsonrpc/client/client_xlayer.go b/jsonrpc/client/client_xlayer.go
index 98bd89e535..dc2200e1e6 100644
--- a/jsonrpc/client/client_xlayer.go
+++ b/jsonrpc/client/client_xlayer.go
@@ -12,7 +12,7 @@ import (
 // JSONRPCRelay executes a 2.0 JSON RPC HTTP Post Request to the provided URL with
 // types.Request, which is compatible with the Ethereum
 // JSON RPC Server.
-func JSONRPCRelay(url string, request types.Request) (types.Response, error) {
+func JSONRPCRelay(url string, request types.Request, rerun bool) (types.Response, error) {
 	httpRes, err := sendJSONRPC_HTTPRequest(url, request)
 	if err != nil {
 		return types.Response{}, err
@@ -33,7 +33,7 @@ func JSONRPCRelay(url string, request types.Request) (types.Response, error) {
 	if err != nil {
 		return types.Response{}, err
 	}
-	if res.Error != nil {
+	if res.Error != nil && rerun {
 		return types.Response{}, fmt.Errorf("response error: %v - %v", res.Error.Code, res.Error.Message)
 	}
 	return res, nil