-
Notifications
You must be signed in to change notification settings - Fork 9
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
Fix rpc usage #408
base: celestia-integration
Are you sure you want to change the base?
Fix rpc usage #408
Conversation
In order to allow the inbox reader to read the init message start with a polling time of roughly 1 minute against the parent-chain sequencer inbox. This is because we need to populate the init message in the db for the start method to work, but we won't do that if the initial iteration of the run method takes longer than this timeout.
To lighten the load on l1 when we are caught up with the sequencer inbox, we set the inbox reader to only poll every 240 blocks. On arb one/ sepolia, this is roughly equivalent to polling every minute.
@@ -167,7 +167,7 @@ func (r *InboxReader) Start(ctxIn context.Context) error { | |||
} | |||
break | |||
} | |||
if i == 30*10 { | |||
if i == 60*11 { |
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.
This change allows this function to wait 66 seconds before throwing an error related to the init message not being present in the inbox trackers database.
The reasoning is this allows the inbox reader to process the init message in the ~minute it would take it to either read 240 blocks from the parent chain, or exceed it's time default time limit. This then allows the inbox reader to populate the inbox trackers db with the init message batch before the timeout in the InboxReader::Start()
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.
LGTM!
Closes #403
This PR:
WAIT TO MERGE
We should wait to merge this PR until we have tested this against our current dev net to ensure this produces a big enough reduction for our needs.
Edits the default config of the inbox reader to poll the sequencer inbox and bridge contracts roughly once a minute, rather than once per block on the parent chain as it previously did.
This PR also edits a condition during the inbox reader's start function so that it is allowed to wait this full minute and populate it's database with the init message so that the inbox reader can start successfully.
This PR does not:
Edit any tests or make significant logic changes.
Key places to review:
inbox_reader.go
Things tested
This default configuration will reduce the number of rpc requests when the parent chain has fast block times (e.g. arb-sepolia, as is the case with the caldera dev net)