Skip to content

Add ChangeView.Reason#926

Merged
shargon merged 6 commits intoneo-project:masterfrom
shargon:change-view-optimization
Jul 17, 2019
Merged

Add ChangeView.Reason#926
shargon merged 6 commits intoneo-project:masterfrom
shargon:change-view-optimization

Conversation

@shargon
Copy link
Copy Markdown
Member

@shargon shargon commented Jul 16, 2019

TODO: We can review if the most common reason was TxNotFound and reduce the next block proposal from 500 tx to 250.

Copy link
Copy Markdown
Member

@vncoelho vncoelho left a comment

Choose a reason for hiding this comment

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

Let me just check with careful asap.

This will open possibilities for other improvements. Nice job.

lock9
lock9 previously approved these changes Jul 16, 2019
Copy link
Copy Markdown
Contributor

@lock9 lock9 left a comment

Choose a reason for hiding this comment

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

Very good. No tests, but there was no change in logic. I will approve this PR, but please try to make more tests, this way I can run your code here 👍

@shargon
Copy link
Copy Markdown
Member Author

shargon commented Jul 16, 2019

I think that it would be good for take decisions according to the view change. For example, if we have 5 view changes because policy, maybe i need to clean my memory pool?

@shargon shargon added this to the NEO 3.0 milestone Jul 16, 2019
@lock9
Copy link
Copy Markdown
Contributor

lock9 commented Jul 16, 2019

@shargon That is a good idea! When you had that method to clean added to the ProtocolHandler, I already had in mind that this "clean" should be automated, just like most apps are (if you get a memory warning, you need to clean resources).

So, yes, I think that this "inconsistency" of the network may lead nodes to clean their data.
I'm just a little skeptical because @canesin said something about "having low risk transactions that can be 'confirmed' without waiting for the block".
If we have this "cleanup", there is a chance these 'valid transactions' are dropped.

What do you guys think? I think this is a good idea, not sure about side effects, especially for Nash

Edit: But if we proceed, please create another issue 😄

@shargon shargon requested review from erikzhang, lock9 and vncoelho July 17, 2019 09:29
@codecov-io
Copy link
Copy Markdown

codecov-io commented Jul 17, 2019

Codecov Report

Merging #926 into master will decrease coverage by <.01%.
The diff coverage is 31.25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #926      +/-   ##
==========================================
- Coverage   45.35%   45.35%   -0.01%     
==========================================
  Files         178      178              
  Lines       12628    12637       +9     
==========================================
+ Hits         5728     5731       +3     
- Misses       6900     6906       +6
Impacted Files Coverage Δ
neo/Consensus/ConsensusContext.cs 54.57% <0%> (-0.21%) ⬇️
neo/Consensus/ConsensusService.cs 15.7% <0%> (-0.18%) ⬇️
neo/Consensus/ChangeView.cs 93.33% <100%> (+1.66%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0a85a9e...2784b72. Read the comment docs.

// if my last change view payload, `message`, has NewViewNumber lower than current view to change
if (message is null || message.NewViewNumber < viewNumber)
localNode.Tell(new LocalNode.SendDirectly { Inventory = context.MakeChangeView() });
localNode.Tell(new LocalNode.SendDirectly { Inventory = context.MakeChangeView(ChangeViewReason.WrongExpectedView) });
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it sends ChangeView because everyone wants to change view. There is nothing wrong.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @erikzhang Yoda master,

I think that if the reason is something like invalid tx there will be no reason for recovery, for example.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ConsensusChange?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Follow?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@erikzhang, my comment above was wrong...

I just remembered now that we already created a special payload RecoveryRequest.
In this sense, I am not sure about a real use of this Reason.

Should we revert, @shargon? Or do you have an idea for using it?
@igormcoelho

@shargon shargon merged commit 7d0951d into neo-project:master Jul 17, 2019
@erikzhang erikzhang deleted the change-view-optimization branch July 17, 2019 18:26
@erikzhang erikzhang removed this from the NEO 3.0 milestone Dec 6, 2019
Tommo-L pushed a commit to Tommo-L/neo that referenced this pull request Jun 22, 2020
* Change view reason

* Move order for compatibility

* Moved to other file

* Change order

* Change agreement
roman-khimov added a commit to nspcc-dev/dbft that referenced this pull request Jul 11, 2020
Follow neo-project/neo#926 for Neo 3 (though the change is compatible with Neo
2).
roman-khimov added a commit to nspcc-dev/dbft that referenced this pull request Jul 11, 2020
Follow neo-project/neo#926 for Neo 3 (though the change is compatible with Neo
2).
roman-khimov added a commit to nspcc-dev/dbft that referenced this pull request Jul 11, 2020
Follow neo-project/neo#926 for Neo 3 (though the change is compatible with Neo
2).
roman-khimov added a commit to nspcc-dev/dbft that referenced this pull request Jul 11, 2020
Follow neo-project/neo#926 for Neo 3 (though the change is compatible with Neo
2).
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