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

Fixes some hive test related to invalid hash #4102

Merged
merged 10 commits into from
Jun 8, 2022

Conversation

asdacap
Copy link
Contributor

@asdacap asdacap commented Jun 3, 2022

Changes:

Types of changes

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

@asdacap asdacap force-pushed the asdacap/fix-ancestor-invalidation branch 2 times, most recently from b0d5443 to 561c5c9 Compare June 6, 2022 05:18
Copy link
Member

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

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

Potentially missing tests that InvalidChainTracker is used correctly in all those places.

Despite quite a few comments on details I really like this approach and code!

Comment on lines +121 to +142

_api.HeaderValidator = new InvalidHeaderInterceptor(
new MergeHeaderValidator(_poSSwitcher, _api.BlockTree, _api.SpecProvider, _api.SealValidator,
_api.LogManager),
_invalidChainTracker,
_api.LogManager);
_api.UnclesValidator = new MergeUnclesValidator(_poSSwitcher, _api.UnclesValidator);
_api.BlockValidator = new BlockValidator(_api.TxValidator, _api.HeaderValidator, _api.UnclesValidator,
_api.SpecProvider, _api.LogManager);
_api.BlockValidator = new InvalidBlockInterceptor(
new BlockValidator(_api.TxValidator, _api.HeaderValidator, _api.UnclesValidator,
_api.SpecProvider, _api.LogManager),
_invalidChainTracker,
_api.LogManager);
_api.HealthHintService =
new MergeHealthHintService(_api.HealthHintService, _poSSwitcher);
_mergeBlockProductionPolicy = new MergeBlockProductionPolicy(_api.BlockProductionPolicy);
_api.BlockProductionPolicy = _mergeBlockProductionPolicy;

_api.FinalizationManager = new MergeFinalizationManager(_blockFinalizationManager, _api.FinalizationManager, _poSSwitcher);

// Need to do it here because blockprocessor is not available in init
_invalidChainTracker.SetupBlockchainProcessorInterceptor(_api.BlockchainProcessor!);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should add InitBlockchain to plugins that is after InitBlockchain step? @MarekM25 WDYT?

src/Nethermind/Nethermind.Merge.Plugin/MergePlugin.cs Outdated Show resolved Hide resolved
}

Keccak effectiveParent = parent;
BlockHeader? parentHeader = TryGetBlockHeader(parent);
Copy link
Member

Choose a reason for hiding this comment

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

just take in Headers in first place, they should be available in all scenarios: OnInvalidBlock(BlockHeader failedBlock, BlockHeader parent)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Problem, sometime it does not have the parent header. Eg, in case of newPayload where it's parent is not synced or missed.

Copy link
Member

Choose a reason for hiding this comment

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

ok, but maybe lets try resolve parent upstream then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Upstream?

Copy link
Member

Choose a reason for hiding this comment

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

Upstream - the code that is calling this code. Now with OnInvalidBlockArg I think it's not a problem to get ParentHeader from caller.

@asdacap asdacap force-pushed the asdacap/fix-ancestor-invalidation branch from 561c5c9 to d130647 Compare June 8, 2022 12:44
@LukaszRozmej LukaszRozmej self-requested a review June 8, 2022 14:39
@asdacap asdacap requested a review from MarekM25 June 8, 2022 14:40
@LukaszRozmej LukaszRozmej merged commit ce81e1e into master Jun 8, 2022
@LukaszRozmej LukaszRozmej deleted the asdacap/fix-ancestor-invalidation branch June 8, 2022 23:59
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.

None yet

3 participants