From f885c4671333168089a7b86ffedf985fce81954b Mon Sep 17 00:00:00 2001 From: matkt Date: Fri, 15 Jul 2022 19:16:14 +0200 Subject: [PATCH] Update checkpoint sync for merge (#4085) Signed-off-by: Karim TAAM --- config/src/main/resources/goerli.json | 6 +++--- config/src/main/resources/mainnet.json | 6 +++--- config/src/main/resources/ropsten.json | 6 +++--- config/src/main/resources/sepolia.json | 5 +++++ .../blockheaders/NewBlockHeadersSubscriptionService.java | 8 ++++---- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/config/src/main/resources/goerli.json b/config/src/main/resources/goerli.json index f819d4deb1..12e52390c2 100644 --- a/config/src/main/resources/goerli.json +++ b/config/src/main/resources/goerli.json @@ -22,9 +22,9 @@ ] }, "checkpoint": { - "hash": "0x2ae30061bdfc7f6dad5b07361dce436502eb0fde68645de12bae4929be619188", - "number": 6720000, - "totalDifficulty": "0x967F81", + "hash": "0x50e55c39a725f062af438c5332a5c5bec9a36d02c829ee6ac2cc27d1db719446", + "number": 4350000, + "totalDifficulty": "0x61DBBF", "_comment": "must be the beginning of an epoch" } }, diff --git a/config/src/main/resources/mainnet.json b/config/src/main/resources/mainnet.json index 1ae9964a92..805a668c76 100644 --- a/config/src/main/resources/mainnet.json +++ b/config/src/main/resources/mainnet.json @@ -35,9 +35,9 @@ ] }, "checkpoint": { - "hash": "0x844d581cb00058d19f0584fb582fa2de208876ee56bbae27446a679baf4633f4", - "number": 14700000, - "totalDifficulty": "0xA2539264C62BF98CFC6" + "hash": "0x44bca881b07a6a09f83b130798072441705d9a665c5ac8bdf2f39a3cdf3bee29", + "number": 11052984, + "totalDifficulty": "0x3D103014E5C74E5E196" } }, "nonce": "0x42", diff --git a/config/src/main/resources/ropsten.json b/config/src/main/resources/ropsten.json index 3912705c18..ffd10f68fd 100644 --- a/config/src/main/resources/ropsten.json +++ b/config/src/main/resources/ropsten.json @@ -23,9 +23,9 @@ ] }, "checkpoint": { - "hash": "0x43de216f876d897e59b9757dd24186e5b53be28bc425ca6a966335b48daaa50c", - "number": 12200000, - "totalDifficulty": "0x928D05243C1CF4" + "hash": "0xeefb1f70bf7bed6394ed7d6f812f422aa37bf7680e1b75fa551d40e849f10a87", + "number": 12269949, + "totalDifficulty": "0x94730AAE0106DC" } }, "nonce": "0x0000000000000042", diff --git a/config/src/main/resources/sepolia.json b/config/src/main/resources/sepolia.json index e91896ef74..d560a5e415 100644 --- a/config/src/main/resources/sepolia.json +++ b/config/src/main/resources/sepolia.json @@ -19,6 +19,11 @@ "enode://9246d00bc8fd1742e5ad2428b80fc4dc45d786283e05ef6edbd9002cbc335d40998444732fbe921cb88e1d2c73d1b1de53bae6a2237996e9bfe14f871baf7066@18.168.182.86:30303", "enode://ec66ddcf1a974950bd4c782789a7e04f8aa7110a72569b6e65fcd51e937e74eed303b1ea734e4d19cfaec9fbff9b6ee65bf31dcb50ba79acce9dd63a6aca61c7@52.14.151.177:30303" ] + }, + "checkpoint": { + "hash": "0x491ebac1b7f9c0eb426047a495dc577140cb3e09036cd3f7266eda86b635d9fa", + "number": 1273020, + "totalDifficulty": "0x13DE1653E7D280" } }, "alloc":{ diff --git a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/subscription/blockheaders/NewBlockHeadersSubscriptionService.java b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/subscription/blockheaders/NewBlockHeadersSubscriptionService.java index d97bae0bd7..780caef504 100644 --- a/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/subscription/blockheaders/NewBlockHeadersSubscriptionService.java +++ b/ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/websocket/subscription/blockheaders/NewBlockHeadersSubscriptionService.java @@ -22,7 +22,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.websocket.subscription.request. import org.hyperledger.besu.ethereum.api.query.BlockchainQueries; import org.hyperledger.besu.ethereum.chain.BlockAddedEvent; import org.hyperledger.besu.ethereum.chain.BlockAddedObserver; -import org.hyperledger.besu.ethereum.core.Block; +import org.hyperledger.besu.ethereum.core.BlockHeader; import java.util.ArrayList; import java.util.Collections; @@ -46,8 +46,8 @@ public class NewBlockHeadersSubscriptionService implements BlockAddedObserver { @Override public void onBlockAdded(final BlockAddedEvent event) { if (event.isNewCanonicalHead()) { - final List blocks = new ArrayList<>(); - Block blockPtr = event.getBlock(); + final List blocks = new ArrayList<>(); + BlockHeader blockPtr = event.getBlock().getHeader(); while (!blockPtr.getHash().equals(event.getCommonAncestorHash())) { blocks.add(blockPtr); @@ -55,7 +55,7 @@ public class NewBlockHeadersSubscriptionService implements BlockAddedObserver { blockPtr = blockchainQueries .getBlockchain() - .getBlockByHash(blockPtr.getHeader().getParentHash()) + .getBlockHeader(blockPtr.getParentHash()) .orElseThrow(() -> new IllegalStateException("The block was on a orphaned chain.")); }