Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Ibft block mining #169

Merged
merged 2 commits into from
Nov 21, 2018
Merged

Ibft block mining #169

merged 2 commits into from
Nov 21, 2018

Conversation

rain-on
Copy link
Contributor

@rain-on rain-on commented Oct 26, 2018

This builds up PR #168, and creates classes around the creation of IBFT blocks, ensuring data from the JSON RPC (vanity data) is included.

@rain-on rain-on requested review from jframe and Errorific October 26, 2018 05:40
@rain-on rain-on force-pushed the ibft_block_mining branch 2 times, most recently from 8a3ea71 to 74fcb8a Compare October 26, 2018 21:25
@CLAassistant
Copy link

CLAassistant commented Oct 26, 2018

CLA assistant check
All committers have signed the CLA.

@rain-on rain-on requested review from saltiniroberto and removed request for jframe and Errorific October 30, 2018 04:56
@rain-on rain-on force-pushed the ibft_block_mining branch 2 times, most recently from a8f850c to 46409d2 Compare November 13, 2018 23:12
@rain-on rain-on requested a review from ajsutton November 14, 2018 00:47

// TODO(tmm): This needs to be reworked to not always be "add"
// TODO(tmm): The Vote type probably shouldn't know about serialisation values, should bein the
// extra data content.
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like a fairly important TODO.

.map(p -> Optional.of(new Vote(p.getKey(), IbftVoteType.ADD)))
.orElse(Optional.empty());

List<Address> validators = new ArrayList<>(voteTally.getCurrentValidators());
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: final.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

// TODO(tmm): This needs to be reworked to not always be "add"
// TODO(tmm): The Vote type probably shouldn't know about serialisation values, should bein the
// extra data content.
Optional<Vote> vote =
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: final


List<Address> validators = new ArrayList<>(voteTally.getCurrentValidators());

IbftExtraData extraData =
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: final

@@ -68,4 +68,14 @@ public BlockHeaderBuilder insertVoteToHeaderBuilder(
final IbftExtraData ibftExtraData = IbftExtraData.decode(header.getExtraData());
return ibftExtraData.getValidators();
}

public static Optional<Vote> toVote(final Optional<ValidatorVote> input) {
Optional<Vote> headerVote = Optional.empty();
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: headerVote appears to be unused.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

return extraData.encode();
}

// TODO(tmm): Copied from CliqueMinerExecutor
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to avoid scattering TODO items around the codebase. Either fix it now, log a ticket or decide it's ok to live with.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deal - broken out to a helper function.


@Override
public boolean isRunning() {
return false;
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems potentially misleading. I would have expected it to either always be running (but might be just waiting for it's turn to create a block) or to return true only when this node was a validator (which seems excessive). If it's false I would expect it to never create blocks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to 'true' for now, but need to revisit how this class fits with the IbftController as new capabilities are added.

Copy link
Contributor

@ajsutton ajsutton left a comment

Choose a reason for hiding this comment

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

LGTM.

@ajsutton ajsutton added the enhancement New feature or request label Nov 21, 2018
IBFT requires various aspects of the mining infrastructure in order
to create a proposed block.

This includes specifically the BlockCreator and MiningCoordinating,
the mining executor is not required at this stage, nor is the miner.
@rain-on rain-on merged commit 7b26210 into PegaSysEng:master Nov 21, 2018
@rain-on rain-on deleted the ibft_block_mining branch January 16, 2019 21:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants