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

Reduce RAM consumption for ForceProcessing requests #5090

Merged
merged 7 commits into from
Jan 12, 2023

Conversation

OlegJakushkin
Copy link
Contributor

@OlegJakushkin OlegJakushkin commented Jan 4, 2023

Reduces RAM consumption for ForceProcessing requests. Keeping original flow and logic that can be updated in the future.

Changes

Minimal flag checks

Types of changes

flag checks added

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a fix or a feature that would cause existing functionality not to work as expected)
  • Documentation update
  • Code style update (formatting, renaming)
  • Refactoring (no functional or API changes)
  • Build-related changes
  • Other: description

Testing

  • Tested on mainnet locally (working)
  • Tested on sepolia block production by Angkor team (working)
  • tested with Kamil's special test project

Requires testing

  • Yes
  • No

If yes, did you write tests?

Covered by existing tests

  • Yes
  • No

O(N) to O(1) in case of processing requests, also reduced storage space requirements for alternative approach
Copy link
Contributor

@asdacap asdacap left a comment

Choose a reason for hiding this comment

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

Recommend checking hive test

Copy link
Contributor

@MarekM25 MarekM25 left a comment

Choose a reason for hiding this comment

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

think about unit tests :)

do
{
blocksToBeAddedToMain.Add(toBeProcessed);
iterations++;
if (!options.ContainsFlag(ProcessingOptions.ForceProcessing))
Copy link
Member

Choose a reason for hiding this comment

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

can we create a variable for that?

Comment on lines +621 to +622
bool notReachedTheReorgBoundary = (options & ProcessingOptions.Trace) == ProcessingOptions.Trace
&& (branchingPoint.Number > (_blockTree.Head?.Header.Number ?? 0));
Copy link
Member

Choose a reason for hiding this comment

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

better naming needed, now notReachedTheReorgBoundary is actually trace Or notReachedTheReorgBoundary

OlegJakushkin added a commit that referenced this pull request Jan 5, 2023
@LukaszRozmej LukaszRozmej merged commit 44ba349 into master Jan 12, 2023
@LukaszRozmej LukaszRozmej deleted the fix/issue-4557 branch January 12, 2023 09:21
@kamilchodola
Copy link
Contributor

@LukaszRozmej @OlegJakushkin How about those unit tests which should be added?

kamilchodola added a commit that referenced this pull request Jan 13, 2023
@MarekM25 MarekM25 mentioned this pull request Mar 5, 2023
12 tasks
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.

5 participants