-
Notifications
You must be signed in to change notification settings - Fork 928
Enable Quorum/IBFT1 to Besu migration #8262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
matthew1001
merged 25 commits into
hyperledger:main
from
pullurib:quorum-ibft1-migration
Mar 12, 2025
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
14c401d
Enable Quorum/IBFT1 to Besu migration
d5cf8fd
Fix BftMining acceptance test
c79cf36
Merge branch 'main' into quorum-ibft1-migration
pullurib 1112fab
Introduce delay after London fork update in BFT mining test to preven…
9c35bb6
Merge branch 'quorum-ibft1-migration' of github.com:pullurib/besu int…
c78c53d
Update besu/src/main/java/org/hyperledger/besu/controller/IbftLegacyB…
pullurib 828b257
Review changes
9a10a01
Merge branch 'quorum-ibft1-migration' of github.com:pullurib/besu int…
58d2563
update creating additional JSON RPC methods for all controllerbuidler…
ca49542
Create ethprotocol manager and plugin factory for both consensus cont…
6b8c5db
merge main
cdeb2e0
Refactor resource files
1906973
fix verification metadata
e013749
fix regression
f8511da
Merge branch 'main' into quorum-ibft1-migration
matthew1001 996dffd
update changelog
4269f49
Merge branch 'main' into quorum-ibft1-migration
pullurib 0851661
Fix controller selection at the transition block
2ab9f6c
Merge branch 'quorum-ibft1-migration' of github.com:pullurib/besu int…
74575e0
Review changes
c566e41
Revert BftExtraData changes
60a5ab4
Merge branch 'main' into quorum-ibft1-migration
pullurib 7ecdb22
Merge branch 'main' into quorum-ibft1-migration
pullurib c0a32bb
Merge branch 'main' into quorum-ibft1-migration
macfarla 67ecec6
Merge branch 'main' into quorum-ibft1-migration
pullurib File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
...ts/tests/src/test/java/org/hyperledger/besu/tests/acceptance/QuorumIBFTMigrationTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/* | ||
* Copyright contributors to Hyperledger Besu. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.tests.acceptance; | ||
|
||
import static org.apache.logging.log4j.util.LoaderUtil.getClassLoader; | ||
|
||
import org.hyperledger.besu.plugin.services.storage.DataStorageFormat; | ||
import org.hyperledger.besu.tests.acceptance.dsl.AcceptanceTestBase; | ||
import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.StandardCopyOption; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public class QuorumIBFTMigrationTest extends AcceptanceTestBase { | ||
|
||
public static void copyKeyFilesToNodeDataDirs(final BesuNode... nodes) throws IOException { | ||
for (BesuNode node : nodes) { | ||
copyKeyFile(node, "key"); | ||
copyKeyFile(node, "key.pub"); | ||
} | ||
} | ||
|
||
private static void copyKeyFile(final BesuNode node, final String keyFileName) | ||
throws IOException { | ||
String resourceFileName = "qbft/migration-ibft1/" + node.getName() + keyFileName; | ||
try (InputStream keyFileStream = getClassLoader().getResourceAsStream(resourceFileName)) { | ||
if (keyFileStream == null) { | ||
throw new IOException("Resource not found: " + resourceFileName); | ||
} | ||
Path targetPath = node.homeDirectory().resolve(keyFileName); | ||
Files.createDirectories(targetPath.getParent()); | ||
Files.copy(keyFileStream, targetPath, StandardCopyOption.REPLACE_EXISTING); | ||
} | ||
} | ||
|
||
public static void runBesuCommand(final Path dataPath) throws IOException, InterruptedException { | ||
ProcessBuilder processBuilder = | ||
new ProcessBuilder( | ||
" 10000 ../../build/install/besu/bin/besu", | ||
"--genesis-file", | ||
"src/test/resources/qbft/migration-ibft1/qbft-migration.json", | ||
"--data-path", | ||
dataPath.toString(), | ||
"--data-storage-format", | ||
"FOREST", | ||
"blocks", | ||
"import", | ||
"src/test/resources/qbft/migration-ibft1/ibft.blocks"); | ||
|
||
processBuilder.directory(new File(System.getProperty("user.dir"))); | ||
processBuilder.inheritIO(); // This will redirect the output to the console | ||
|
||
Process process = processBuilder.start(); | ||
int exitCode = process.waitFor(); | ||
if (exitCode == 0) { | ||
System.out.println("Import command executed successfully."); | ||
} else { | ||
throw new RuntimeException("Import command execution failed with exit code: " + exitCode); | ||
} | ||
} | ||
|
||
@Test | ||
public void shouldImportIBFTBlocksAndTransitionToQBFT() throws Exception { | ||
|
||
// Create a mix of Bonsai and Forest DB nodes | ||
final BesuNode minerNode1 = | ||
besu.createQbftMigrationNode("miner1", false, DataStorageFormat.FOREST); | ||
final BesuNode minerNode2 = | ||
besu.createQbftMigrationNode("miner2", false, DataStorageFormat.FOREST); | ||
final BesuNode minerNode3 = | ||
besu.createQbftMigrationNode("miner3", false, DataStorageFormat.FOREST); | ||
final BesuNode minerNode4 = | ||
besu.createQbftMigrationNode("miner4", false, DataStorageFormat.FOREST); | ||
final BesuNode minerNode5 = | ||
besu.createQbftMigrationNode("miner5", false, DataStorageFormat.FOREST); | ||
|
||
// Copy key files to the node datadirs | ||
// Use the key files saved in resources directory | ||
copyKeyFilesToNodeDataDirs(minerNode1, minerNode2, minerNode3, minerNode4, minerNode5); | ||
|
||
// start one node and import blocks from import file | ||
// Use import file, genesis saved in resources directory | ||
|
||
runBesuCommand(minerNode1.homeDirectory()); | ||
|
||
// After the import is done, start the rest of the nodes using the same genesis and respective | ||
// node keys | ||
|
||
cluster.start(minerNode1, minerNode2, minerNode3, minerNode4, minerNode5); | ||
|
||
// Check that the chain is progressing as expected | ||
cluster.verify(blockchain.reachesHeight(minerNode2, 1, 120)); | ||
} | ||
|
||
@Override | ||
public void tearDownAcceptanceTestBase() { | ||
cluster.stop(); | ||
super.tearDownAcceptanceTestBase(); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+97.4 KB
acceptance-tests/tests/src/test/resources/qbft/migration-ibft1/ibft.blocks
Binary file not shown.
1 change: 1 addition & 0 deletions
1
acceptance-tests/tests/src/test/resources/qbft/migration-ibft1/miner1key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0a46b91fe0c770a4355d1fec9ccd72d39264f46a74ed67a69a12ed4c265aa768 |
1 change: 1 addition & 0 deletions
1
acceptance-tests/tests/src/test/resources/qbft/migration-ibft1/miner1key.pub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
8093fb3200c783555ed487b8b5210ef3369b062a1f3ce5762d83d7a62205693d1e4f253e840ca48ec98d8f20c5b41bbbd43f34f87a1f68324ab51afe73732b96 |
1 change: 1 addition & 0 deletions
1
acceptance-tests/tests/src/test/resources/qbft/migration-ibft1/miner2key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
17c2aacfdf1f6defde20e6ae7132c6d3991e758af3799a307a75b38135678a48 |
1 change: 1 addition & 0 deletions
1
acceptance-tests/tests/src/test/resources/qbft/migration-ibft1/miner2key.pub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
d81f65976ccc44c5e7e6ca859c5ede06b0f484f72c52d35dd8f7bd7581a8b7020d9ef45878696b4593daf5575b48dda5259f78f192a3445d5cc97c032660642f |
1 change: 1 addition & 0 deletions
1
acceptance-tests/tests/src/test/resources/qbft/migration-ibft1/miner3key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
917fb1b03034e5d7156b89bc2a3bc2aae1d146d2640d75e095f07110b0871bc1 |
1 change: 1 addition & 0 deletions
1
acceptance-tests/tests/src/test/resources/qbft/migration-ibft1/miner3key.pub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
67785a2ac328648d94245abb25bdcfab853d06e68c70026d90f2fd5c8338b65c19235398eac205e4bbdb3fc1de9669ad6309e43ab203c8e7430664cea6451f56 |
1 change: 1 addition & 0 deletions
1
acceptance-tests/tests/src/test/resources/qbft/migration-ibft1/miner4key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3b3cbae8c034c4ba2d5f4df44faa013888216a6eabb7fffa0b224003ea770ba7 |
1 change: 1 addition & 0 deletions
1
acceptance-tests/tests/src/test/resources/qbft/migration-ibft1/miner4key.pub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ec403552908986b5d9e4def3be9ddcb26d5b03def3b44ef2d5d728bb9a3028603405e7379c3e185cb2bc3e784548fcdd0e7616162029c3f407155b2fb25ba0ca |
1 change: 1 addition & 0 deletions
1
acceptance-tests/tests/src/test/resources/qbft/migration-ibft1/miner5key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
4ddfb30d4fcd6f5a9f959961f734e4c1469af223bc16b217eef0d3796e64973d |
1 change: 1 addition & 0 deletions
1
acceptance-tests/tests/src/test/resources/qbft/migration-ibft1/miner5key.pub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
28c02b375d62b0adef8213b76882dfec264d5dcbb0a8ba73f167bc718a6d02f1833af80ab9f51a5f007e5f3b8320e8fc5ab287d4bd59ad497f8949bf4abb9e80 |
63 changes: 63 additions & 0 deletions
63
acceptance-tests/tests/src/test/resources/qbft/migration-ibft1/qbft-migration.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"nonce": "0x0", | ||
"timestamp": "0x58ee40ba", | ||
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000f86df86994a18182ee8ca476f2f0fb8170a1d4620edb39c5e194065541903bf3bb8c088a18046b441f5d286288c994d1e106d68cac92668b100f6f43791ddcb2c7588094d156777a1e1539fe654fc82266f41fd5d4aa548494efbbd8900222d7b2f75d081c3e7446a1f4fe10ce80c0", | ||
"gasLimit": "700000000", | ||
"gasUsed": "0x0", | ||
"number": "0x0", | ||
"difficulty": "0x1", | ||
"coinbase": "0x0000000000000000000000000000000000000000", | ||
"mixHash": "0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365", | ||
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"config": { | ||
"chainId": 1337, | ||
"homesteadBlock": 10, | ||
"eip150Block": 20, | ||
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"eip155Block": 25, | ||
"eip158Block": 30, | ||
"byzantiumBlock": 50, | ||
"constantinopleBlock": 60, | ||
"petersburgBlock": 70, | ||
"istanbulBlock": 80, | ||
"ibft": { | ||
"epochlength": 100, | ||
"blockperiodseconds": 5, | ||
"requesttimeoutseconds": 10, | ||
"policy": 0, | ||
"ceil2Nby3Block": 0, | ||
"validatorcontractaddress": "0x0000000000000000000000000000000000000000" | ||
}, | ||
"qbft": { | ||
"epochLength": 30000, | ||
"blockPeriodSeconds" : 1, | ||
"requestTimeoutSeconds": 10, | ||
"startBlock": 101 | ||
}, | ||
"txnSizeLimit": 64, | ||
"maxCodeSize": 0, | ||
"maxCodeSizeConfig": [ | ||
{ | ||
"block": 0, | ||
"size": 64 | ||
} | ||
] | ||
}, | ||
"alloc": { | ||
"0xde8e2ae09f2ee2c6c282c054b2384f8b5f9debee": { | ||
"balance": "1000000000000000000000000000" | ||
}, | ||
"0x23bcbca17fc4978909ab44ac82559c7d379aa006": { | ||
"balance": "1000000000000000000000000000" | ||
}, | ||
"0x870276532cca9f33e66273cfa494cf41e04b5a66": { | ||
"balance": "1000000000000000000000000000" | ||
}, | ||
"0x7d7fc9fdfa49e2db22fc6ebab593dcf3aeffbde8": { | ||
"balance": "1000000000000000000000000000" | ||
}, | ||
"0x4df76ad0678513846699056e0070c5f587580eb5": { | ||
"balance": "1000000000000000000000000000" | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.