Skip to content
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

feat(SequencerInbox): gas optimization #22

Closed
wants to merge 2 commits into from

Conversation

shotaronowhere
Copy link
Contributor

This PR simply packs the MaxTimeVariation members into a single slot.

Each time the sequencer posts a batch, the time boundary is calculated accessing each member of MaxTimeVariation.

Timestamps fit in uint32 data types, this is sufficient for atleast 80 years. I see uint64 is the time data type convention used in the repo so this is suitable for the MaxTimeVariation.delaySeconds/futureSeconds.

Regarding blocktime, even if Arbitrum settled on BSC (~3 second block time) or Solana (400 millisecond block time), uint64 is more than sufficient for million millions of years.

This PR saves approximately 6300 gas per sequencer batch posted --- about 2 billion gas, or 20 - 60 eth since Nitro launched.

@cla-bot cla-bot bot added the s label Jun 16, 2023
@gzeoneth gzeoneth self-requested a review June 16, 2023 19:24
@gzeoneth
Copy link
Member

LGTM tho will merge later since this included a storage modification

@shotaronowhere
Copy link
Contributor Author

PR is stale, optimization is now in #68

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

Successfully merging this pull request may close these issues.

2 participants