Skip to content
This repository has been archived by the owner on Aug 23, 2020. It is now read-only.

Add milestone stage #1822

Conversation

DyrellC
Copy link
Contributor

@DyrellC DyrellC commented Apr 1, 2020

Description

This is step one towards the migration of milestone handling logic as per #1674. In this phase we add a milestone stage to the processing pipeline to handle milestone transactions as they are received rather than relying on the LatestMilestoneTracker to pull them from the db. This should mitigate the issue demonstrated on devnet, when a node has a high number of milestone transactions present in the db, and it takes a long time to pull them out. New milestones were not being seen and processed fast enough, so to fix that, we handle them straight from the received stage.

This is a follow up to #1821

Fixes #1688
Also relevant to #1448 and #1797

Type of change

  • Enhancement (a non-breaking change which adds functionality)

How Has This Been Tested?

  • Existing unit and regression tests have continued to pass with this migration

Checklist:

  • My code follows the style guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@DyrellC DyrellC mentioned this pull request Apr 1, 2020
6 tasks
acha-bill and others added 4 commits April 7, 2020 11:42
* add heartbeat message

* added javadocs

* print exception message
* Update pruning test for before and after pruning status

* m6 -> m1

Co-authored-by: Gal Rogozinski <gal.rogozinski@iota.org>
* Update broadcast fetch logic

* Comment
* Move validation to validation service package

* Add Transaction Solidifier

* Update Transaction Validator

* Update Unit Tests

* Remove tip field from solidify stage

* Move broadcast queue retreival to solidify stage

* Undo auto-formatting

* More autoformatting

* Re-remove refillBroadcast

* Move propagation logic to inner class

* Remove unused imports

* Add comment to propagator

* Remove unused txSolidifier private field

* Remove separate thread logic, check solidity from milestone solidifier

* Add solidification queue to transaction solidifier

* LinkedHashSet -> ArrayDeque in checkSolidity

* Update maxProcessedTransactions value determination

* Make Transaction Propagator private

* Fix test conflicts

* Update src/main/java/com/iota/iri/service/validation/impl/TransactionSolidifierImpl.java

Co-Authored-By: Gal Rogozinski <galrogogit@gmail.com>

* Update src/main/java/com/iota/iri/service/validation/impl/TransactionSolidifierImpl.java

Co-Authored-By: Gal Rogozinski <galrogogit@gmail.com>

* Rename

Co-authored-by: Gal Rogozinski <gal.rogozinski@iota.org>
Co-authored-by: Gal Rogozinski <galrogogit@gmail.com>
@GalRogozinski GalRogozinski changed the base branch from Dyrell-Milestone-Stage-Draft to dev April 20, 2020 08:32
@GalRogozinski GalRogozinski changed the base branch from dev to Dyrell-Milestone-Stage-Draft April 20, 2020 08:33
Copy link
Contributor

@GalRogozinski GalRogozinski left a comment

Choose a reason for hiding this comment

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

Looks good 💯
Due to conflicts I am not approving yet


confirmValidTransactionValues(transactionViewModel);
Copy link
Contributor

Choose a reason for hiding this comment

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

nice clear refactoring

@DyrellC
Copy link
Contributor Author

DyrellC commented Apr 20, 2020

@GalRogozinski ready to go. I added a couple missing unit tests as well if you want to take a quick look at those.

@GalRogozinski GalRogozinski merged commit f276e58 into iotaledger:Dyrell-Milestone-Stage-Draft Apr 21, 2020
Copy link
Contributor

@acha-bill acha-bill left a comment

Choose a reason for hiding this comment

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

LGTM


TransactionViewModel milestone = TransactionViewModel.fromHash(tangle, payload.getMilestoneHash());
int newMilestoneIndex = payload.getMilestoneIndex();
boolean isFirstInBundle = (milestone.getCurrentIndex() == 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

I would have liked this to be isTailBundle for the sake of terminology.

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

Successfully merging this pull request may close these issues.

3 participants