Skip to content

feat(SequencerInbox): gas optimization#22

Closed
shotaronowhere wants to merge 2 commits intoOffchainLabs:developfrom
shotaronowhere:develop
Closed

feat(SequencerInbox): gas optimization#22
shotaronowhere wants to merge 2 commits intoOffchainLabs:developfrom
shotaronowhere:develop

Conversation

@shotaronowhere
Copy link
Copy Markdown
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
Copy Markdown
Member

LGTM tho will merge later since this included a storage modification

@shotaronowhere
Copy link
Copy Markdown
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