diff --git a/docs/config-file/node-config-doc.html b/docs/config-file/node-config-doc.html index 7ba2f65c86..67e8abca6b 100644 --- a/docs/config-file/node-config-doc.html +++ b/docs/config-file/node-config-doc.html @@ -20,7 +20,7 @@
"300ms"
MaxRequestsPerIPAndSecond defines how much requests a single IP can
send within a single second
SequencerNodeURI is used allow Non-Sequencer nodes
to relay transactions to the Sequencer node
MaxCumulativeGasUsed is the max gas allowed per batch
Enabled defines if the WebSocket requests are enabled or disabled
Host defines the network adapter that will be used to serve the WS requests
Port defines the port to serve the endpoints via WS
ReadLimit defines the maximum size of a message read from the client (in bytes)
EnableL2SuggestedGasPricePolling enables polling of the L2 gas price to block tx in the RPC with lower gas price.
BatchRequestsEnabled defines if the Batch requests are enabled or disabled
BatchRequestsLimit defines the limit of requests that can be incorporated into each batch request
L2Coinbase defines which address is going to receive the fees
Must contain a minimum of 20
items
Must contain a maximum of 20
items
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
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
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
EnableHttpLog allows the user to enable or disable the logs related to the HTTP
requests to be captured by the server.
XLayer config
EnablePendingTransactionFilter enables pending transaction filter that can support query L2 pending transaction
URLs nacos server urls for discovery service of rest api, url is separated by ","
NamespaceId nacos namepace id for discovery service of rest api
ApplicationName rest application name in nacos
ExternalListenAddr Set the rest-server external ip and port, when it is launched by Docker
URLs nacos server urls for discovery service of rest api, url is separated by ","
NamespaceId nacos namepace id for discovery service of rest api
ApplicationName rest application name in nacos
ExternalListenAddr Set the rest-server external ip and port, when it is launched by Docker
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
DisableAPIs disable some API
Enabled defines if the rate limit is enabled or disabled
RateLimitApis defines the apis that need to be rate limited
RateLimitBurst defines the maximum burst size of requests
RateLimitDuration defines the time window for the rate limit
SpecialApis defines the apis that need to be rate limited with special rate limit
Api defines the api that need to be rate limited
Count defines the maximum burst size of requests
Duration defines the time window for the rate limit
Enabled defines if the dynamic gas price is enabled or disabled
CongestionTxThreshold defines the tx threshold to measure whether there is congestion
CheckBatches defines the number of recent Batches used to sample gas price
SampleTxNumer defines the number of sampled gas prices in each batch
Percentile defines the sampling weight of all sampled gas prices
MaxPrice defines the dynamic gas price upper limit
MinPrice defines the dynamic gas price lower limit
UpdatePeriod defines the time interval for updating dynamic gas price
"1m"
"300ms"
-
EnableInnerTxCacheDB enables the inner tx cache db
BridgeAddress is the address of the bridge contract
Must contain a minimum of 20
items
Must contain a maximum of 20
items
Enabled defines if the api authentication is enabled
ApiKeys defines the api keys
Name defines the name of the key
Key defines the key
Timeout defines the timeout
SyncInterval is the delay interval between reading new rollup information
"1m"
+
EnableInnerTxCacheDB enables the inner tx cache db
BridgeAddress is the address of the bridge contract
Must contain a minimum of 20
items
Must contain a maximum of 20
items
Enabled defines if the api authentication is enabled
ApiKeys defines the api keys
Name defines the name of the key
Key defines the key
Timeout defines the timeout
SyncInterval is the delay interval between reading new rollup information
"1m"
"300ms"
SyncChunkSize is the number of blocks to sync on each chunk
TrustedSequencerURL is the rpc url to connect and sync the trusted state
SyncBlockProtection specify the state to sync (lastest, finalized or safe)
L1SyncCheckL2BlockHash if is true when a batch is closed is force to check L2Block hash against trustedNode (only apply for permissionless)
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,...)
If enabled then the check l1 Block Hash is active
L1SafeBlockPoint is the point that a block is considered safe enough to be checked
it can be: finalized, safe,pending or latest
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
ForceCheckBeforeStart if is true then the first time the system is started it will force to check all pending blocks
If enabled then the pre-check is active, will check blocks between L1SafeBlock and L1PreSafeBlock
L1PreSafeBlockPoint is the point that a block is considered safe enough to be checked
it can be: finalized, safe,pending or latest
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
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
MaxClients Number of clients used to synchronize with L1
MaxPendingNoProcessedBlocks Size of the buffer used to store rollup information from L1, must be >= to NumberOfEthereumClientsToSync
sugested twice of NumberOfParallelOfEthereumClients
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
"1m"
"300ms"
diff --git a/docs/config-file/node-config-doc.md b/docs/config-file/node-config-doc.md
index 1a09df6bba..607bda00b9 100644
--- a/docs/config-file/node-config-doc.md
+++ b/docs/config-file/node-config-doc.md
@@ -2351,6 +2351,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`
@@ -2388,6 +2389,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 02370b65d1..847d43b296 100644
--- a/docs/config-file/node-config-schema.json
+++ b/docs/config-file/node-config-schema.json
@@ -920,6 +920,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