-
Notifications
You must be signed in to change notification settings - Fork 130
ibft mining acceptance test #483
ibft mining acceptance test #483
Conversation
return getRunningNodes().get(0); | ||
} | ||
|
||
private static class NodeInfo { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the value in this new inner class, my IntelliJ shows isRunning()
and isRunning
are not called outside NodeInfo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just way a way adding of associating a the running state with the nodes and their names. Allows me to just verify on the running nodes if I have stopped some.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True the isRunning() doesn't need to exist, I just added both the getter and setters for both fields for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This approach with NodeInfo and that with the verifyRunningNode
are inconsistent with the indirection used elsewhere within Cluster and AT framework.
Let me think about it, there'll be a more consistent way to this goal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
new PantheonFactoryConfigurationBuilder() | ||
.setName(name) | ||
.miningEnabled() | ||
.setJsonRpcConfiguration(jsonRpcConfigWithClique()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jsonRpcConfigWithClique? (not withIbft?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh that's not right. i'll fix that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. it happen to be working because it is enabled by default. I still prefer to be explicit in this case though so am doing it the same as in the clique case and adding the rpc option.
...ests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft/IbftMiningAcceptanceTest.java
Show resolved
Hide resolved
"eip158Block": 3, | ||
"byzantiumBlock": 1035301, | ||
"revisedibft": { | ||
"blockperiodseconds": 5, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to drop these values to make tests faster? (blocktime could be 1 reasonably).
If we do timeout tests, we probably don't want to wait 25 seconds for (request) timeout ....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what reasonable time is. in the clique tests I found they were not as reliable when I had the block time at such a small value. will have to think about this a bit. but in general want this to be as small as practical.
agree 25 seconds is too long. ideas on how long? I might go with 5s for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
…lock events are propagated
final PantheonNode validator1 = pantheon.createIbftNode("miner1"); | ||
final PantheonNode validator2 = pantheon.createIbftNode("miner2"); | ||
final PantheonNode validator3 = pantheon.createIbftNode("miner3"); | ||
final PantheonNode nonValidatorNode = pantheon.createIbftNode("miner4"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
textual name (miner4) doesn't line up with variable name (nonValidatorNode) - which should it be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops. that was accidental, changed back to what it was before consistent with node names.
done.
@Ignore("Temporarily disabled until ibft new block events are being sent") | ||
public void shouldMineOnMultipleNodesEvenWhenClusterContainsNonValidator() throws IOException { | ||
final String[] validators = {"validator1", "validator2", "validator3"}; | ||
final PantheonNode validator1 = pantheon.createIbftNodeWithValidators("validator1", validators); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name field could/should reference the validators array? [or even put this into a loop?]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rest of the code can't reference the validators array, best I could do is use the validator names in that array to create the validator nodes. I've done that but I think the test is less clear afterwards.
can't use stream as we have a checked exception (IOException) to deal with from the createIbft methods.
final String[] validatorNames = {"validator1", "validator2", "validator3"};
final List<PantheonNode> validators = new ArrayList<>();
for (String name: validatorNames) {
validators.add(pantheon.createIbftNodeWithValidators(name, validatorNames));
}
final PantheonNode nonValidatorNode =
pantheon.createIbftNodeWithValidators("non-validator", validatorNames);
validators.add(nonValidatorNode);
cluster.start(validators);
final Account sender = accounts.createAccount("account1");
final Account receiver = accounts.createAccount("account2");
validators.get(0).execute(transactions.createTransfer(sender, 50));
cluster.verify(sender.balanceEquals(50));
validators.get(1).execute(transactions.createIncrementalTransfers(sender, receiver, 1));
cluster.verify(receiver.balanceEquals(1));
nonValidatorNode.execute(transactions.createIncrementalTransfers(sender, receiver, 2));
cluster.verify(receiver.balanceEquals(3));
PR description
Acceptance test for IBFT to test that a single node and a cluster of 4 nodes work in the basic mining test sending transactions.
Fixed Issue(s)