Skip to content

Commit

Permalink
Merge branch 'zkbesu' into clique-simulate-block-production
Browse files Browse the repository at this point in the history
  • Loading branch information
fab-10 committed Sep 30, 2024
2 parents 18af579 + badb334 commit b284e35
Show file tree
Hide file tree
Showing 18 changed files with 159 additions and 76 deletions.
2 changes: 1 addition & 1 deletion MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ The following steps must occur for a contributor to be "upgraded" as a maintaine
- The proposed maintainer accepts the nomination and expresses a willingness
to be a long-term (more than 6 month) committer by adding a comment in the proposal PR.
- The PR will be communicated in all appropriate communication channels
including at least [besu-contributors channel on Hyperledger Discord](https://discord.gg/hyperledger),
including at least [besu-contributors channel on Discord](https://discord.gg/hyperledger),
the [mailing list](https://lists.hyperledger.org/g/besu)
and any maintainer/community call.
- Approval by at least 3 current maintainers within two weeks of the proposal or
Expand Down
10 changes: 5 additions & 5 deletions SUPPORT.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Hyperledger Besu Support
# Besu Support

Welcome to the Besu repository! The following links are a set of guidelines for contributing to this repo and its packages. These are mostly guidelines, not rules. Use your best judgement, and feel free to propose changes to this document in a pull request. Contributions come in the form of code submissions, writing documentation, raising issues, helping others in chat, and any other actions that help develop Besu.

### Github/Discord/LF Accounts

Having Github, Discord, and Linux Foundation accounts is necessary for obtaining support for Besu through the community channels, wiki and issue management.
* If you want to raise an issue, you can do so [on the github issue tab](https://github.com/hyperledger/besu/issues).
* Hyperledger Discord requires a [Discord account].
* The Hyperledger wiki also requires a [Linux Foundation (LF) account] in order to edit pages.
* Discord requires a [Discord account].
* The Besu wiki also requires a [Linux Foundation (LF) account] in order to edit pages.

### Useful support links

* [Besu User Documentation]
* [Besu channel on Hyperledger Discord]
* [Besu channel on Discord]
* [I just have a quick question](https://wiki.hyperledger.org/display/BESU/I+just+have+a+quick+question)
* [Did you find a bug?](https://wiki.hyperledger.org/display/BESU/Reporting+Bugs)
* [Issues](https://wiki.hyperledger.org/display/BESU/Issues)
* [Contributing Guidelines]


[Besu User Documentation]: https://besu.hyperledger.org
[Besu channel on Hyperledger Discord]: https://discord.gg/hyperledger
[Besu channel on Discord]: https://discord.gg/hyperledger
[Contributing Guidelines]: CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,10 @@ public void shouldCreateIbft2ExtraData() throws IOException {
false,
singletonList("key.pub"),
Optional.empty(),
Optional.of(
"0xf853a00000000000000000000000000000000000000000000000000000000000000000ea94d5feb0fc5a54a89f97aeb34c3df15397c19f6dd294d6a9a4c886eb008ac307abdc1f38745c1dd13a88808400000000c0"));
List.of(
new Field(
"extraData",
"0xf853a00000000000000000000000000000000000000000000000000000000000000000ea94d5feb0fc5a54a89f97aeb34c3df15397c19f6dd294d6a9a4c886eb008ac307abdc1f38745c1dd13a88808400000000c0")));
}

@Test
Expand All @@ -296,8 +298,49 @@ public void shouldCreateQbftExtraData() throws IOException {
false,
singletonList("key.pub"),
Optional.empty(),
Optional.of(
"0xf84fa00000000000000000000000000000000000000000000000000000000000000000ea94d5feb0fc5a54a89f97aeb34c3df15397c19f6dd294d6a9a4c886eb008ac307abdc1f38745c1dd13a88c080c0"));
List.of(
new Field(
"extraData",
"0xf84fa00000000000000000000000000000000000000000000000000000000000000000ea94d5feb0fc5a54a89f97aeb34c3df15397c19f6dd294d6a9a4c886eb008ac307abdc1f38745c1dd13a88c080c0")));
}

@Test
public void generatedGenesisFileShouldContainAllOriginalFieldsExcludingExtraData()
throws IOException {
final JsonObject alloc =
new JsonObject(
"""
{
"24defc2d149861d3d245749b81fe0e6b28e04f31": {
"balance": "0x446c3b15f9926687d2c40534fdb564000000000000"
},
"2a813d7db3de19b07f92268b6d4125ed295cbe00": {
"balance": "0x446c3b15f9926687d2c40534fdb542000000000000"
}
}""");
final List<Field> fields =
List.of(
new Field("nonce", "0x0"),
new Field("timestamp", "0x5b3c3d18"),
new Field("gasUsed", "0x0"),
new Field(
"parentHash", "0x0000000000000000000000000000000000000000000000000000000000000000"),
new Field("gasLimit", "0x47b760"),
new Field("difficulty", "0x1"),
new Field(
"mixHash", "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365"),
new Field("coinbase", "0x0000000000000000000000000000000000000000"),
new Field("alloc", alloc.getMap().toString()));

runCmdAndCheckOutput(
cmd(),
"/operator/config_generate_keys.json",
tmpOutputDirectoryPath,
"genesis.json",
false,
singletonList("key.pub"),
Optional.empty(),
fields);
}

private void runCmdAndCheckOutput(
Expand All @@ -316,7 +359,7 @@ private void runCmdAndCheckOutput(
generate,
expectedKeyFiles,
Optional.empty(),
Optional.empty());
List.of());
}

private void runCmdAndCheckOutput(
Expand All @@ -336,9 +379,11 @@ private void runCmdAndCheckOutput(
generate,
expectedKeyFiles,
signatureAlgorithm,
Optional.empty());
List.of());
}

private record Field(String key, String value) {}

private void runCmdAndCheckOutput(
final Cmd cmd,
final String configFile,
Expand All @@ -347,7 +392,7 @@ private void runCmdAndCheckOutput(
final boolean generate,
final Collection<String> expectedKeyFiles,
final Optional<SignatureAlgorithm> signatureAlgorithm,
final Optional<String> expectedExtraData)
final List<Field> expectedFields)
throws IOException {
final URL configFilePath = this.getClass().getResource(configFile);
parseCommand(
Expand All @@ -368,8 +413,9 @@ private void runCmdAndCheckOutput(
final String genesisString = contentOf(outputGenesisFile, UTF_8);
final JsonObject genesisContent = new JsonObject(genesisString);
assertThat(genesisContent.containsKey("extraData")).isTrue();
expectedExtraData.ifPresent(
extraData -> assertThat(genesisContent.getString("extraData")).isEqualTo(extraData));

expectedFields.forEach(
field -> assertThat(genesisContent.getString(field.key)).isEqualTo(field.value));

final Path expectedKeysPath = outputDirectoryPath.resolve("keys");
final File keysDirectory = new File(expectedKeysPath.toUri());
Expand Down
9 changes: 3 additions & 6 deletions besu/src/test/resources/operator/config_generate_keys.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"chainId": 2017,
"eip150Block": 0,
"ibft2": {

"blockperiodseconds": 2,
"epochlength": 30000,
"requesttimeoutseconds": 10
}
},
"nonce": "0x0",
Expand All @@ -16,11 +18,6 @@
"difficulty": "0x1",
"mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
"coinbase": "0x0000000000000000000000000000000000000000",
"ibft2": {
"blockperiodseconds": 2,
"epochlength": 30000,
"requesttimeoutseconds": 10
},
"alloc": {
"24defc2d149861d3d245749b81fe0e6b28e04f31": {
"balance": "0x446c3b15f9926687d2c40534fdb564000000000000"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"eip150Block": 0,
"ecCurve": "abcd",
"ibft2": {

"blockperiodseconds": 2,
"epochlength": 30000,
"requesttimeoutseconds": 10
}
},
"nonce": "0x0",
Expand All @@ -17,11 +19,6 @@
"difficulty": "0x1",
"mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
"coinbase": "0x0000000000000000000000000000000000000000",
"ibft2": {
"blockperiodseconds": 2,
"epochlength": 30000,
"requesttimeoutseconds": 10
},
"alloc": {
"24defc2d149861d3d245749b81fe0e6b28e04f31": {
"balance": "0x446c3b15f9926687d2c40534fdb564000000000000"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"eip150Block": 0,
"ecCurve": "secp256r1",
"ibft2": {

"blockperiodseconds": 2,
"epochlength": 30000,
"requesttimeoutseconds": 10
}
},
"nonce": "0x0",
Expand All @@ -17,11 +19,6 @@
"difficulty": "0x1",
"mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
"coinbase": "0x0000000000000000000000000000000000000000",
"ibft2": {
"blockperiodseconds": 2,
"epochlength": 30000,
"requesttimeoutseconds": 10
},
"alloc": {
"24defc2d149861d3d245749b81fe0e6b28e04f31": {
"balance": "0x446c3b15f9926687d2c40534fdb564000000000000"
Expand Down
9 changes: 3 additions & 6 deletions besu/src/test/resources/operator/config_import_keys.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"chainId": 2017,
"petersburgBlock": 0,
"ibft2": {

"blockperiodseconds": 2,
"epochlength": 30000,
"requesttimeoutseconds": 10
}
},
"nonce": "0x0",
Expand All @@ -16,11 +18,6 @@
"difficulty": "0x1",
"mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
"coinbase": "0x0000000000000000000000000000000000000000",
"ibft2": {
"blockperiodseconds": 2,
"epochlength": 30000,
"requesttimeoutseconds": 10
},
"alloc": {
"24defc2d149861d3d245749b81fe0e6b28e04f31": {
"balance": "0x446c3b15f9926687d2c40534fdb564000000000000"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"chainId": 2017,
"petersburgBlock": 0,
"ibft2": {

"blockperiodseconds": 2,
"epochlength": 30000,
"requesttimeoutseconds": 10
}
},
"nonce": "0x0",
Expand All @@ -16,11 +18,6 @@
"difficulty": "0x1",
"mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
"coinbase": "0x0000000000000000000000000000000000000000",
"ibft2": {
"blockperiodseconds": 2,
"epochlength": 30000,
"requesttimeoutseconds": 10
},
"alloc": {
"24defc2d149861d3d245749b81fe0e6b28e04f31": {
"balance": "0x446c3b15f9926687d2c40534fdb564000000000000"
Expand Down
9 changes: 3 additions & 6 deletions besu/src/test/resources/operator/config_import_keys_qbft.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"chainId": 2017,
"petersburgBlock": 0,
"qbft": {

"blockperiodseconds": 2,
"epochlength": 30000,
"requesttimeoutseconds": 10
}
},
"nonce": "0x0",
Expand All @@ -16,11 +18,6 @@
"difficulty": "0x1",
"mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
"coinbase": "0x0000000000000000000000000000000000000000",
"ibft2": {
"blockperiodseconds": 2,
"epochlength": 30000,
"requesttimeoutseconds": 10
},
"alloc": {
"24defc2d149861d3d245749b81fe0e6b28e04f31": {
"balance": "0x446c3b15f9926687d2c40534fdb564000000000000"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"petersburgBlock": 0,
"ecCurve": "secp256r1",
"ibft2": {

"blockperiodseconds": 2,
"epochlength": 30000,
"requesttimeoutseconds": 10
}
},
"nonce": "0x0",
Expand All @@ -17,11 +19,6 @@
"difficulty": "0x1",
"mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
"coinbase": "0x0000000000000000000000000000000000000000",
"ibft2": {
"blockperiodseconds": 2,
"epochlength": 30000,
"requesttimeoutseconds": 10
},
"alloc": {
"24defc2d149861d3d245749b81fe0e6b28e04f31": {
"balance": "0x446c3b15f9926687d2c40534fdb564000000000000"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"petersburgBlock": 0,
"ecCurve": "secp256r1",
"ibft2": {

"blockperiodseconds": 2,
"epochlength": 30000,
"requesttimeoutseconds": 10
}
},
"nonce": "0x0",
Expand All @@ -17,11 +19,6 @@
"difficulty": "0x1",
"mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
"coinbase": "0x0000000000000000000000000000000000000000",
"ibft2": {
"blockperiodseconds": 2,
"epochlength": 30000,
"requesttimeoutseconds": 10
},
"alloc": {
"24defc2d149861d3d245749b81fe0e6b28e04f31": {
"balance": "0x446c3b15f9926687d2c40534fdb564000000000000"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
"difficulty": "0x1",
"mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365",
"coinbase": "0x0000000000000000000000000000000000000000",
"ibft2": {
"blockperiodseconds": 2,
"epochlength": 30000,
"requesttimeoutseconds": 10
},
"alloc": {
"24defc2d149861d3d245749b81fe0e6b28e04f31": {
"balance": "0x446c3b15f9926687d2c40534fdb564000000000000"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ class FromObjectNode implements GenesisReader {
private final ObjectNode rootWithoutAllocations;

public FromObjectNode(final ObjectNode root) {
final var removedAllocations = root.remove(ALLOCATION_FIELD);
this.allocations =
removedAllocations != null
? (ObjectNode) removedAllocations
root.get(ALLOCATION_FIELD) != null
? (ObjectNode) root.get(ALLOCATION_FIELD)
: JsonUtil.createEmptyObjectNode();
this.rootWithoutAllocations = normalizeKeys(root);
this.rootWithoutAllocations =
normalizeKeys(root, field -> !field.getKey().equals(ALLOCATION_FIELD));
}

@Override
Expand Down
Loading

0 comments on commit b284e35

Please sign in to comment.