Skip to content
This repository has been archived by the owner on Jun 25, 2021. It is now read-only.

feat/elder: update shared state on consensus of AckMessage #1720

Merged
merged 2 commits into from Jul 31, 2019

Conversation

maqi
Copy link
Member

@maqi maqi commented Jul 26, 2019

Partial fix for #1670

Copy link
Contributor

@jeanphilippeD jeanphilippeD left a comment

Choose a reason for hiding this comment

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

The main problem seem to be that it is not doing the updating of their_knowledge as the ack message is suppose to be used for that purpose.

src/states/elder/mod.rs Outdated Show resolved Hide resolved
src/chain/network_event.rs Outdated Show resolved Hide resolved
src/states/elder/mod.rs Outdated Show resolved Hide resolved
src/states/elder/mod.rs Outdated Show resolved Hide resolved
src/chain/chain.rs Outdated Show resolved Hide resolved
@jeanphilippeD
Copy link
Contributor

Looks good, just the issue of the test code.

Copy link
Contributor

@jeanphilippeD jeanphilippeD left a comment

Choose a reason for hiding this comment

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

Looks better, Added some comment to clarify the test.

src/states/elder/mod.rs Outdated Show resolved Hide resolved
tests/mock_network/mod.rs Outdated Show resolved Hide resolved
.count();
assert!(num_of_receives >= min_section_size);
assert!(num_of_receives < 2 * min_section_size);
assert!(num_of_consensus >= min_section_size);
Copy link
Contributor

Choose a reason for hiding this comment

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

I am ok with this assert in this PR, but I am wondering if this reflects a problem that we will have to solve in a follow up PR (i.e shouldn't both side know the other their_knowledge)?

Copy link
Member Author

@maqi maqi Jul 29, 2019

Choose a reason for hiding this comment

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

Yeah, I agree.

btw. as the function used to setup is adding nodes until split. So at the tip of split, only the section that not containing the last node (which causes the split), will have their_knowledge (i.e. the last added node cause that the peer section changed.
So, maybe that's why there is only one section having their_knowledge?

Copy link
Contributor

Choose a reason for hiding this comment

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

Strange, when the last node is added, it change both section since they are both the result of the split (But maybe a message is not sent, or consensus not reached somewhere).

src/chain/chain.rs Outdated Show resolved Hide resolved
maqi added 2 commits July 29, 2019 22:35
The AckMessage shall do the job, hence removing the flow of
NeighbourConfirm totally.
@maqi maqi changed the title WIP feat/elder: update shared state on consensus of AckMessage feat/elder: update shared state on consensus of AckMessage Jul 29, 2019
@maqi maqi requested a review from fizyk20 July 29, 2019 14:36
@@ -2087,6 +2059,12 @@ impl Approved for Elder {
Ok(())
}

fn handle_ack_message_event(&mut self, sec_info: SectionInfo) -> Result<(), RoutingError> {
self.chain
.update_their_knowledge(*sec_info.prefix(), *sec_info.version());
Copy link
Contributor

@fizyk20 fizyk20 Jul 30, 2019

Choose a reason for hiding this comment

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

Is sec_info.version() correct here? We want the their_knowledge to point not to a SectionInfo, but to a SectionProofBlock within our_history. The index in our_history and the version in SectionInfo might differ.

What we should be doing, in my opinion, would be to put a BlsPublicKey in the AckMessage (which would ideally be taken from security_metadata of the original message, but that's what I'm working on at the moment), then on receiving AckMessage find the block that contains this key and update their_knowledge to the index of this block.

Since security_metadata is not yet done, we could temporarily do what's in this PR (and maybe add a TODO), or alternatively we'd have to postpone this until we have security_metadata and a proper source of the public key to vote on.

Copy link
Contributor

Choose a reason for hiding this comment

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

The index in our_history and the version in SectionInfo might differ.

True, but that does not seem to be the their_knowledge job to make that adjustment, otherwise we need to update that map every time we prune our_history.

What we should be doing, in my opinion...

Seem to be functionaly equivalent until the part were we use the block index which may change, and that does not seem nice.

Copy link
Contributor

Choose a reason for hiding this comment

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

Issue raised: #1722

Copy link
Contributor

@fizyk20 fizyk20 left a comment

Choose a reason for hiding this comment

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

I'm good with fixing the issue I pointed out in a separate PR.

@jeanphilippeD jeanphilippeD merged commit 5a94128 into maidsafe:fleming Jul 31, 2019
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.

None yet

3 participants