Skip to content

remove totalDifficulty from blockResult #8430

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

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"miner": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"difficulty": "0x0",
"totalDifficulty": "0x400000000",
"extraData": "0x",
"baseFeePerGas": "0x7",
"size": "0x1fa",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"receiptsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"miner" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"difficulty" : "0x0",
"totalDifficulty" : "0x400000000",
"extraData" : "0x",
"baseFeePerGas" : "0x7",
"size" : "0x1fa",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"miner": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"difficulty": "0x0",
"totalDifficulty": "0x400000000",
"extraData": "0x",
"baseFeePerGas": "0x7",
"size": "0x1fa",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"receiptsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"miner" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"difficulty" : "0x0",
"totalDifficulty" : "0x400000000",
"extraData" : "0x",
"baseFeePerGas" : "0x7",
"size" : "0x1fa",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"miner": "0x0000000000000000000000000000000000000000",
"difficulty": "0x0",
"totalDifficulty": "0x0",
"extraData": "0x",
"baseFeePerGas": "0x3b9aca00",
"size": "0x244",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"receiptsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"miner" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x400000000",
"totalDifficulty" : "0x400000000",
"extraData" : "0x0000000000000000000000000000000000000000000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"baseFeePerGas" : "0x7",
"size" : "0x2ba",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"receiptsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"miner" : "0x0000000000000000000000000000000000000000",
"difficulty" : "0x400000000",
"totalDifficulty" : "0x400000000",
"extraData":"0x0000000000000000000000000000000000000000000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"baseFeePerGas" : "0x7",
"size" : "0x275",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"receiptsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"miner" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"difficulty" : "0x0",
"totalDifficulty" : "0x400000000",
"extraData" : "0x",
"baseFeePerGas" : "0x7",
"size" : "0x1fa",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"receiptsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"miner" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"difficulty" : "0x0",
"totalDifficulty" : "0x400000000",
"extraData" : "0x",
"baseFeePerGas" : "0x7",
"size" : "0x21c",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"receiptsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"miner" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"difficulty" : "0x0",
"totalDifficulty" : "0x400000000",
"extraData" : "0x",
"baseFeePerGas" : "0x7",
"size" : "0x24e",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"receiptsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"miner" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"difficulty" : "0x0",
"totalDifficulty" : "0x400000000",
"extraData" : "0x",
"baseFeePerGas" : "0x7",
"size" : "0x1fa",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"receiptsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"miner" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"difficulty" : "0x0",
"totalDifficulty" : "0x400000000",
"extraData" : "0x",
"baseFeePerGas" : "0x7",
"size" : "0x21c",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"receiptsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"miner" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"difficulty" : "0x0",
"totalDifficulty" : "0x400000000",
"extraData" : "0x",
"baseFeePerGas" : "0x7",
"size" : "0x24e",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.hyperledger.besu.ethereum.api.query.TransactionReceiptWithMetadata;
import org.hyperledger.besu.ethereum.api.query.TransactionWithMetadata;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.Difficulty;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;

import java.util.ArrayList;
Expand Down Expand Up @@ -65,15 +64,6 @@ public Optional<Integer> getTransactionCount() {
return Optional.of(blockWithMetaData.getTransactions().size());
}

/**
* Returns the total difficulty of the block.
*
* @return the total difficulty of the block.
*/
public Difficulty getTotalDifficulty() {
return blockWithMetaData.getTotalDifficulty();
}

/**
* Returns the ommer count of the block.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"receiptsRoot",
"miner",
"difficulty",
"totalDifficulty",
"extraData",
"baseFeePerGas",
"size",
Expand All @@ -73,7 +72,6 @@ public class BlockResult implements JsonRpcResult {
private final String receiptsRoot;
private final String miner;
private final String difficulty;
private final String totalDifficulty;
private final String extraData;
private final String baseFeePerGas;
private final String size;
Expand Down Expand Up @@ -133,7 +131,6 @@ public BlockResult(
this.receiptsRoot = header.getReceiptsRoot().toString();
this.miner = header.getCoinbase().toString();
this.difficulty = Quantity.create(header.getDifficulty());
this.totalDifficulty = Quantity.create(totalDifficulty);
this.extraData = header.getExtraData().toString();
this.baseFeePerGas = header.getBaseFee().map(Quantity::create).orElse(null);
this.size = Quantity.create(size);
Expand Down Expand Up @@ -217,11 +214,6 @@ public String getDifficulty() {
return difficulty;
}

@JsonGetter(value = "totalDifficulty")
public String getTotalDifficulty() {
return totalDifficulty;
}

@JsonGetter(value = "extraData")
public String getExtraData() {
return extraData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ public void getBlockByHashWithTransactions() throws Exception {
testHelper.assertValidJsonRpcResult(json, id);
// Check result
final JsonObject result = json.getJsonObject("result");
verifyBlockResult(block, blockWMetadata.getTotalDifficulty(), result, false);
verifyBlockResult(block, result, false);
}
}

Expand Down Expand Up @@ -738,7 +738,7 @@ public void getBlockByHashWithTransactionHashes() throws Exception {
testHelper.assertValidJsonRpcResult(json, id);
// Check result
final JsonObject result = json.getJsonObject("result");
verifyBlockResult(block, blockWMetadata.getTotalDifficulty(), result, true);
verifyBlockResult(block, result, true);
}
}

Expand Down Expand Up @@ -928,7 +928,7 @@ public void getBlockByNumberWithTransactions() throws Exception {
testHelper.assertValidJsonRpcResult(json, id);
// Check result
final JsonObject result = json.getJsonObject("result");
verifyBlockResult(block, blockWithMetadata.getTotalDifficulty(), result, false);
verifyBlockResult(block, result, false);
}
}

Expand Down Expand Up @@ -960,7 +960,7 @@ public void getBlockByNumberWithTransactionHashes() throws Exception {
testHelper.assertValidJsonRpcResult(json, id);
// Check result
final JsonObject result = json.getJsonObject("result");
verifyBlockResult(block, blockWithMetadata.getTotalDifficulty(), result, true);
verifyBlockResult(block, result, true);
}
}

Expand Down Expand Up @@ -1012,7 +1012,7 @@ public void getBlockByNumberForEarliest() throws Exception {
testHelper.assertValidJsonRpcResult(json, id);
// Check result
final JsonObject result = json.getJsonObject("result");
verifyBlockResult(block, blockWithMetadata.getTotalDifficulty(), result, false);
verifyBlockResult(block, result, false);
}
}

Expand Down Expand Up @@ -1041,7 +1041,7 @@ public void getBlockByNumberForBlockNumberZero() throws Exception {
testHelper.assertValidJsonRpcResult(json, id);
// Check result
final JsonObject result = json.getJsonObject("result");
verifyBlockResult(block, blockWithMetadata.getTotalDifficulty(), result, false);
verifyBlockResult(block, result, false);
}
}

Expand Down Expand Up @@ -1074,7 +1074,7 @@ public void getBlockByNumberForLatest() throws Exception {
testHelper.assertValidJsonRpcResult(json, id);
// Check result
final JsonObject result = json.getJsonObject("result");
verifyBlockResult(block, blockWithMetadata.getTotalDifficulty(), result, false);
verifyBlockResult(block, result, false);
}
}

Expand Down Expand Up @@ -1106,7 +1106,7 @@ public void getBlockByNumberForPending() throws Exception {
testHelper.assertValidJsonRpcResult(json, id);
// Check result
final JsonObject result = json.getJsonObject("result");
verifyBlockResult(block, blockWithMetadata.getTotalDifficulty(), result, false);
verifyBlockResult(block, result, false);
}
}

Expand Down Expand Up @@ -1632,17 +1632,10 @@ public void emptyBatchRequest() throws Exception {
}

private void verifyBlockResult(
final Block block,
final Difficulty td,
final JsonObject result,
final boolean shouldTransactionsBeHashed) {
final Block block, final JsonObject result, final boolean shouldTransactionsBeHashed) {
assertBlockResultMatchesBlock(result, block);

if (td == null) {
assertThat(result.getJsonObject("totalDifficulty")).isNull();
} else {
assertThat(Difficulty.fromHexString(result.getString("totalDifficulty"))).isEqualTo(td);
}
assertThat(result.getJsonObject("totalDifficulty")).isNull();

// Check ommers
final JsonArray ommersResult = result.getJsonArray("uncles");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
],
"timestamp": "0x561bc336",
"difficulty": "0x20740",
"totalDifficulty": "0x3e6cc0",
"gasUsed": "0x5c21",
"gasLimit": "0x2fefd8",
"hash": "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
],
"timestamp": "0x561bc336",
"difficulty": "0x20740",
"totalDifficulty": "0x3e6cc0",
"gasUsed": "0x5c21",
"gasLimit": "0x2fefd8",
"hash": "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
],
"timestamp": "0x561bc336",
"difficulty": "0x20740",
"totalDifficulty": "0x3e6cc0",
"gasUsed": "0x5c21",
"gasLimit": "0x2fefd8",
"hash": "0xc8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000",
"stateRoot": "0x34727aff24d1c51cd63fdc14515b15ddaa156fa0671c58a96c72b1553819945d",
"totalDifficulty": "0x427c00",
"withdrawalsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
"withdrawals": [],
"blobGasUsed": "0x40000",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"mixHash": "0x4edd77bfff565659bb0ae09421918e4def65d938a900eb94230eb01f5ce80c99",
"nonce": "0xdb063000b00e8026",
"stateRoot": "0xf65f3dd13f72f5fa5607a5224691419969b4f4bae7a00a6cdb853f2ca9eeb1be",
"totalDifficulty": "0x427c00",
"transactions": [
{
"gasPrice": "0x1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000",
"stateRoot": "0x0d3c456bb68669bad05da3a1a766daab236c9df1da8f74edf5ebe9383f00084c",
"totalDifficulty": "0x427c00",
"transactions": [
{
"r": "0x8abbfbd4c5f2a13a8d5ed394ac50bac7d678f83a23f645818492f76e8ee17ab3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"receiptsRoot": "0x3e5fff5f6eaeee82841547e049b6bdb980c4e6bd8539fb072a346a30ee72a25d",
"miner": "0x8888f1f195afa192cfee860698584c030f4c9db1",
"difficulty": "0x203c0",
"totalDifficulty": "0x221e00",
"extraData": "0x",
"size": "0x288",
"gasLimit": "0x2fefd8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"receiptsRoot": "0xb56f5313fa6822e1ee3f84487b5b2f12c5e1746778ad39f9a89e5f0239cc9b83",
"miner": "0x0000000000000000000000000000000000000000",
"difficulty": "0x0",
"totalDifficulty": "0x427c00",
"extraData": "0x",
"baseFeePerGas": "0x3437004a",
"size": "0x308",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"receiptsRoot": "0xd8f831982345c98e4189e8e76c303d833d1dc22f51efa20d717e31b9337a43cb",
"miner": "0x0000000000000000000000000000000000000000",
"difficulty": "0x0",
"totalDifficulty": "0x427c00",
"extraData": "0x",
"baseFeePerGas": "0x3b9aca00",
"size": "0x2f0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"receiptsRoot": "0x3e5fff5f6eaeee82841547e049b6bdb980c4e6bd8539fb072a346a30ee72a25d",
"miner": "0x8888f1f195afa192cfee860698584c030f4c9db1",
"difficulty": "0x203c0",
"totalDifficulty": "0x221e00",
"extraData": "0x",
"size": "0x288",
"gasLimit": "0x2fefd8",
Expand Down
Loading