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

Performance fixes - speed and memory #1567

Merged
merged 2 commits into from
Oct 2, 2023

Conversation

tudor-malene
Copy link
Collaborator

Why this change is needed

  • testnet is crashing with OOM
  • rollup creation takes longer than it should

What changes were made as part of this PR

  1. Improve performance of rollup creation by saving the list of blocks after they are fetched the first time.
  2. Set maximum memory for cache.
  3. Reduce cache memory consumption by caching a mapping between a batch hash and a batch sequence

PR checks pre-merging

Please indicate below by ticking the checkbox that you have read and performed the required
PR checks

  • PR checks reviewed and performed

…s after they are fetched the first time.

2. Set maximum memory for cache.
3. Reduce cache memory consumption by caching a mapping between a batch hash and a batch sequence
"github.com/obscuronet/go-obscuro/go/enclave/limiters"

gethcommon "github.com/ethereum/go-ethereum/common"
"github.com/obscuronet/go-obscuro/go/enclave/core"
)

// rollupProducerImpl encapsulates the logic of decoding rollup transactions submitted to the L1 and resolving them
// to rollups that the enclave can process.
type rollupProducerImpl struct {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there were a bunch of unused fields, and the comment was out of date

@tudor-malene tudor-malene changed the title 1. Improve performance of rollup creation by saving the list of block… Performance fixes - speed and memory Oct 2, 2023
return newRollup, nil
}

// createNextRollup - based on a previous rollup and batches will create a new rollup that encapsulate the state
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

outdated comment, and the method had no clear responsibility

// todo - double-check that this signing approach is secure, and it properly includes the entire payload
if err := s.signRollup(rollup); err != nil {
if err := s.signRollup(extRollup); err != nil {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes more logical sense to sign over the external rollup

Copy link
Collaborator

@BedrockSquirrel BedrockSquirrel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - minor comment

@@ -80,7 +80,7 @@ type BatchExecutor interface {

type BatchRegistry interface {
// BatchesAfter - Given a hash, will return batches following it until the head batch
BatchesAfter(batchSeqNo uint64, upToL1Height uint64, rollupLimiter limiters.RollupLimiter) ([]*core.Batch, error)
BatchesAfter(batchSeqNo uint64, upToL1Height uint64, rollupLimiter limiters.RollupLimiter) ([]*core.Batch, []*types.Block, error)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should update the comment on this probably

@tudor-malene tudor-malene merged commit a030959 into main Oct 2, 2023
2 checks passed
@tudor-malene tudor-malene deleted the tudor/rollup_perf_and_logging branch October 2, 2023 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants