Skip to content

Commit 7004243

Browse files
committed
rpc proxy flag
1 parent 10b17f3 commit 7004243

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

multinode/node.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ type node[
105105
ws *url.URL
106106
http *url.URL
107107

108-
rpc RPC
108+
rpc RPC
109+
isRPCProxy bool
109110

110111
stateMu sync.RWMutex // protects state* fields
111112
state nodeState
@@ -136,6 +137,7 @@ func NewNode[
136137
nodeOrder int32,
137138
rpc RPC,
138139
chainFamily string,
140+
isRPCProxy bool,
139141
) Node[CHAIN_ID, RPC] {
140142
n := new(node[CHAIN_ID, HEAD, RPC])
141143
n.name = name
@@ -162,6 +164,7 @@ func NewNode[
162164
)
163165
n.lfcLog = logger.Named(lggr, "Lifecycle")
164166
n.rpc = rpc
167+
n.isRPCProxy = isRPCProxy
165168
n.chainFamily = chainFamily
166169
return n
167170
}

multinode/node_lifecycle.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func (n *node[CHAIN_ID, HEAD, RPC]) aliveLoop() {
164164
// threshold amount of time, mark it broken
165165
lggr.Errorw(fmt.Sprintf("RPC endpoint detected out of sync; no new heads received for %s (last head received was %v)", noNewHeadsTimeoutThreshold, localHighestChainInfo.BlockNumber), "nodeState", n.getCachedState(), "latestReceivedBlockNumber", localHighestChainInfo.BlockNumber, "noNewHeadsTimeoutThreshold", noNewHeadsTimeoutThreshold)
166166
if n.poolInfoProvider != nil {
167-
if l, _ := n.poolInfoProvider.LatestChainInfo(); l < 2 {
167+
if l, _ := n.poolInfoProvider.LatestChainInfo(); l < 2 && !n.isRPCProxy {
168168
lggr.Criticalf("RPC endpoint detected out of sync; %s %s", msgCannotDisable, msgDegradedState)
169169
// We don't necessarily want to wait the full timeout to check again, we should
170170
// check regularly and log noisily in this state
@@ -190,7 +190,7 @@ func (n *node[CHAIN_ID, HEAD, RPC]) aliveLoop() {
190190
// threshold amount of time, mark it broken
191191
lggr.Errorw(fmt.Sprintf("RPC's finalized state is out of sync; no new finalized heads received for %s (last finalized head received was %v)", noNewFinalizedBlocksTimeoutThreshold, localHighestChainInfo.FinalizedBlockNumber), "latestReceivedBlockNumber", localHighestChainInfo.BlockNumber)
192192
if n.poolInfoProvider != nil {
193-
if l, _ := n.poolInfoProvider.LatestChainInfo(); l < 2 {
193+
if l, _ := n.poolInfoProvider.LatestChainInfo(); l < 2 && !n.isRPCProxy {
194194
lggr.Criticalf("RPC's finalized state is out of sync; %s %s", msgCannotDisable, msgDegradedState)
195195
// We don't necessarily want to wait the full timeout to check again, we should
196196
// check regularly and log noisily in this state

multinode/node_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ func newTestNode(t *testing.T, opts testNodeOpts) testNode {
109109
require.NoError(t, err)
110110

111111
nodeI := NewNode[ID, Head, RPCClient[ID, Head]](opts.config, opts.chainConfig, opts.lggr, nodeMetrics,
112-
opts.wsuri, opts.httpuri, opts.name, opts.id, opts.chainID, opts.nodeOrder, opts.rpc, opts.chainFamily)
112+
opts.wsuri, opts.httpuri, opts.name, opts.id, opts.chainID, opts.nodeOrder, opts.rpc, opts.chainFamily, false)
113113

114114
return testNode{
115115
nodeI.(*node[ID, Head, RPCClient[ID, Head]]),

0 commit comments

Comments
 (0)