-
Notifications
You must be signed in to change notification settings - Fork 132
Allow nitro nodes to forward requests based on block number to archive nodes #451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Allow nitro nodes to forward requests based on block number to archive nodes #451
Conversation
Requests can come in to any of the nodes, so each node will need to be able to determine which node to forward requests to if needed. So a node that has information for blocks 10,000-20,000 might forward request for block 500 to a node1, and block 21,000 to node 3. |
arbitrum/config.go
Outdated
type ArchiveRedirectConfig struct { | ||
URL string `koanf:"url"` | ||
Timeout time.Duration `koanf:"timeout"` | ||
LastBlock uint64 `koanf:"last-block"` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we see ourselves having archive nodes with an "EarliestBlock" too? If that's the case then we should have that info too. We'd also have to change the pool function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope we wont be supporting EarliestBlock
instead it is assumed the blocks presence is contiguous i.e if i give configs with last blocks as nodeA=100 and nodeB=200 then requests for blocks from classic.last-block to 100 will go to nodeA and 101 to 200 will go to nodeB
for _, lastBlockAndClient := range a.lastBlockAndClients { | ||
if blockNum <= lastBlockAndClient.lastBlock { | ||
return lastBlockAndClient.client | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we have it randomly select within clients that have the same last block? Otherwise it'll always send to the same one.
This PR allows forwarding of requests to archive nodes based on block numbers thus allowing splitting of archive databases for better manageability. Configured via
block-redirects
option which is a list ofBlockRedirectConfig
consisting of fields-url
,timeout
andlast-block
(block up to which this archive node can service requests).User can also configure via command line using
block-redirects-list
which is a string that should be in json format consisting array of above archive node configs.Corresponding nitro PR- OffchainLabs/nitro#3215
part of NIT-3211