Skip to content

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ganeshvanahalli
Copy link
Contributor

@ganeshvanahalli ganeshvanahalli commented May 6, 2025

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 of BlockRedirectConfig consisting of fields- url, timeout and last-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.

--execution.rpc.block-redirects-list=`[{"url": "<>", "timeout":<in nano seconds>, "last-block": 100}, {"url":"<>}]`

Corresponding nitro PR- OffchainLabs/nitro#3215
part of NIT-3211

@joshuacolvin0
Copy link
Member

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.

Comment on lines 49 to 53
type ArchiveRedirectConfig struct {
URL string `koanf:"url"`
Timeout time.Duration `koanf:"timeout"`
LastBlock uint64 `koanf:"last-block"`
}
Copy link
Member

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.

Copy link
Contributor Author

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

Comment on lines +47 to +51
for _, lastBlockAndClient := range a.lastBlockAndClients {
if blockNum <= lastBlockAndClient.lastBlock {
return lastBlockAndClient.client
}
}
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s CLA signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants