Skip to content
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

Move excess_data_gas to the end of Payload #6840

Merged
merged 2 commits into from
Feb 22, 2023
Merged
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
@@ -1,7 +1,7 @@
{
"title" : "ExecutionPayloadDeneb",
"type" : "object",
"required" : [ "parent_hash", "fee_recipient", "state_root", "receipts_root", "logs_bloom", "prev_randao", "block_number", "gas_limit", "gas_used", "timestamp", "extra_data", "base_fee_per_gas", "excess_data_gas", "block_hash", "transactions", "withdrawals" ],
"required" : [ "parent_hash", "fee_recipient", "state_root", "receipts_root", "logs_bloom", "prev_randao", "block_number", "gas_limit", "gas_used", "timestamp", "extra_data", "base_fee_per_gas", "block_hash", "transactions", "withdrawals", "excess_data_gas" ],
"properties" : {
"parent_hash" : {
"type" : "string",
Expand Down Expand Up @@ -75,12 +75,6 @@
"example" : "1",
"format" : "uint256"
},
"excess_data_gas" : {
"type" : "string",
"description" : "unsigned 256 bit integer",
"example" : "1",
"format" : "uint256"
},
"block_hash" : {
"type" : "string",
"description" : "Bytes32 hexadecimal",
Expand All @@ -101,6 +95,12 @@
"items" : {
"$ref" : "#/components/schemas/Withdrawal"
}
},
"excess_data_gas" : {
"type" : "string",
"description" : "unsigned 256 bit integer",
"example" : "1",
"format" : "uint256"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title" : "ExecutionPayloadHeaderDeneb",
"type" : "object",
"required" : [ "parent_hash", "fee_recipient", "state_root", "receipts_root", "logs_bloom", "prev_randao", "block_number", "gas_limit", "gas_used", "timestamp", "extra_data", "base_fee_per_gas", "excess_data_gas", "block_hash", "transactions_root", "withdrawals_root" ],
"required" : [ "parent_hash", "fee_recipient", "state_root", "receipts_root", "logs_bloom", "prev_randao", "block_number", "gas_limit", "gas_used", "timestamp", "extra_data", "base_fee_per_gas", "block_hash", "transactions_root", "withdrawals_root", "excess_data_gas" ],
"properties" : {
"parent_hash" : {
"type" : "string",
Expand Down Expand Up @@ -75,12 +75,6 @@
"example" : "1",
"format" : "uint256"
},
"excess_data_gas" : {
"type" : "string",
"description" : "unsigned 256 bit integer",
"example" : "1",
"format" : "uint256"
},
"block_hash" : {
"type" : "string",
"description" : "Bytes32 hexadecimal",
Expand All @@ -98,6 +92,12 @@
"description" : "Bytes32 hexadecimal",
"example" : "0xcf8e0d4e9587369b2301d0790347320302cc0943d5a1884560367e8208d920f2",
"format" : "byte"
},
"excess_data_gas" : {
"type" : "string",
"description" : "unsigned 256 bit integer",
"example" : "1",
"format" : "uint256"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public ExecutionPayloadDeneb(
@JsonProperty("timestamp") final UInt64 timestamp,
@JsonProperty("extra_data") final Bytes extraData,
@JsonProperty("base_fee_per_gas") final UInt256 baseFeePerGas,
@JsonProperty("excess_data_gas") final UInt256 excessDataGas,
@JsonProperty("block_hash") final Bytes32 blockHash,
@JsonProperty("transactions") final List<Bytes> transactions,
@JsonProperty("withdrawals") final List<Withdrawal> withdrawals) {
@JsonProperty("withdrawals") final List<Withdrawal> withdrawals,
@JsonProperty("excess_data_gas") final UInt256 excessDataGas) {
super(
parentHash,
feeRecipient,
Expand Down Expand Up @@ -125,10 +125,10 @@ public String toString() {
.add("timestamp", timestamp)
.add("extraData", extraData)
.add("baseFeePerGas", baseFeePerGas)
.add("excessDataGas", excessDataGas)
.add("blockHash", blockHash)
.add("transactions", transactions)
.add("withdrawals", withdrawals)
.add("excessDataGas", excessDataGas)
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ public ExecutionPayloadHeaderDeneb(
@JsonProperty("timestamp") final UInt64 timestamp,
@JsonProperty("extra_data") final Bytes extraData,
@JsonProperty("base_fee_per_gas") final UInt256 baseFeePerGas,
@JsonProperty("excess_data_gas") final UInt256 excessDataGas,
@JsonProperty("block_hash") final Bytes32 blockHash,
@JsonProperty("transactions_root") final Bytes32 transactionsRoot,
@JsonProperty("withdrawals_root") final Bytes32 withdrawalsRoot) {
@JsonProperty("withdrawals_root") final Bytes32 withdrawalsRoot,
@JsonProperty("excess_data_gas") final UInt256 excessDataGas) {
super(
parentHash,
feeRecipient,
Expand Down Expand Up @@ -153,10 +153,10 @@ public String toString() {
.add("timestamp", timestamp)
.add("extraData", extraData)
.add("baseFeePerGas", baseFeePerGas)
.add("excessDataGas", excessDataGas)
.add("blockHash", blockHash)
.add("transactionsRoot", transactionsRoot)
.add("withdrawalsRoot", withdrawalsRoot)
.add("excessDataGas", excessDataGas)
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ public ExecutionPayloadV3(
@JsonProperty("timestamp") UInt64 timestamp,
@JsonProperty("extraData") Bytes extraData,
@JsonProperty("baseFeePerGas") UInt256 baseFeePerGas,
@JsonProperty("excessDataGas") UInt256 excessDataGas,
@JsonProperty("blockHash") Bytes32 blockHash,
@JsonProperty("transactions") List<Bytes> transactions,
@JsonProperty("withdrawals") List<WithdrawalV1> withdrawals) {
@JsonProperty("withdrawals") List<WithdrawalV1> withdrawals,
@JsonProperty("excessDataGas") UInt256 excessDataGas) {
super(
parentHash,
feeRecipient,
Expand Down Expand Up @@ -91,12 +91,15 @@ public static ExecutionPayloadV3 fromInternalExecutionPayload(
executionPayload.getTimestamp(),
executionPayload.getExtraData(),
executionPayload.getBaseFeePerGas(),
executionPayload.toVersionDeneb().map(ExecutionPayloadDeneb::getExcessDataGas).orElse(null),
executionPayload.getBlockHash(),
executionPayload.getTransactions().stream()
.map(SszByteListImpl::getBytes)
.collect(Collectors.toList()),
withdrawalsList);
withdrawalsList,
executionPayload
.toVersionDeneb()
.map(ExecutionPayloadDeneb::getExcessDataGas)
.orElse(null));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public enum ExecutionPayloadFields implements SszFieldName {
TIMESTAMP,
EXTRA_DATA,
BASE_FEE_PER_GAS,
EXCESS_DATA_GAS,
BLOCK_HASH,
TRANSACTIONS,
WITHDRAWALS,
TRANSACTIONS_ROOT,
WITHDRAWALS_ROOT;
WITHDRAWALS_ROOT,
EXCESS_DATA_GAS;

private final String sszFieldName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ public ExecutionPayload build() {
SszUInt64.of(timestamp),
schema.getExtraDataSchema().fromBytes(extraData),
SszUInt256.of(baseFeePerGas),
SszUInt256.of(excessDataGas),
SszBytes32.of(blockHash),
transactions.stream()
.map(schema.getTransactionSchema()::fromBytes)
.collect(schema.getTransactionsSchema().collector()),
schema.getWithdrawalsSchema().createFromElements(withdrawals));
schema.getWithdrawalsSchema().createFromElements(withdrawals),
SszUInt256.of(excessDataGas));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public class ExecutionPayloadDenebImpl
SszUInt64,
SszByteList,
SszUInt256,
SszUInt256,
SszBytes32,
SszList<Transaction>,
SszList<Withdrawal>>
SszList<Withdrawal>,
SszUInt256>
implements ExecutionPayloadDeneb {

public ExecutionPayloadDenebImpl(
Expand All @@ -68,10 +68,10 @@ public ExecutionPayloadDenebImpl(
SszUInt64,
SszByteList,
SszUInt256,
SszUInt256,
SszBytes32,
SszList<Transaction>,
SszList<Withdrawal>>
SszList<Withdrawal>,
SszUInt256>
schema,
TreeNode backingNode) {
super(schema, backingNode);
Expand All @@ -91,10 +91,10 @@ public ExecutionPayloadDenebImpl(
SszUInt64 timestamp,
SszByteList extraData,
SszUInt256 baseFeePerGas,
SszUInt256 excessDataGas,
SszBytes32 blockHash,
SszList<Transaction> transactions,
SszList<Withdrawal> withdrawals) {
SszList<Withdrawal> withdrawals,
SszUInt256 excessDataGas) {
super(
schema,
parentHash,
Expand All @@ -109,10 +109,10 @@ public ExecutionPayloadDenebImpl(
timestamp,
extraData,
baseFeePerGas,
excessDataGas,
blockHash,
transactions,
withdrawals);
withdrawals,
excessDataGas);
}

@Override
Expand Down Expand Up @@ -190,14 +190,9 @@ public UInt256 getBaseFeePerGas() {
return getField11().get();
}

@Override
public UInt256 getExcessDataGas() {
return getField12().get();
}

@Override
public Bytes32 getBlockHash() {
return getField13().get();
return getField12().get();
}

@Override
Expand All @@ -207,12 +202,17 @@ public Bytes32 getPayloadHash() {

@Override
public SszList<Transaction> getTransactions() {
return getField14();
return getField13();
}

@Override
public SszList<Withdrawal> getWithdrawals() {
return getField15();
return getField14();
}

@Override
public UInt256 getExcessDataGas() {
return getField15().get();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ public ExecutionPayloadHeader build() {
SszUInt64.of(timestamp),
schema.getExtraDataSchema().fromBytes(extraData),
SszUInt256.of(baseFeePerGas),
SszUInt256.of(excessDataGas),
SszBytes32.of(blockHash),
SszBytes32.of(transactionsRoot),
SszBytes32.of(withdrawalsRoot));
SszBytes32.of(withdrawalsRoot),
SszUInt256.of(excessDataGas));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ public class ExecutionPayloadHeaderDenebImpl
SszUInt64,
SszByteList,
SszUInt256,
SszUInt256,
SszBytes32,
SszBytes32,
SszBytes32>
SszBytes32,
SszUInt256>
implements ExecutionPayloadHeaderDeneb {

protected ExecutionPayloadHeaderDenebImpl(
Expand All @@ -63,10 +63,10 @@ protected ExecutionPayloadHeaderDenebImpl(
SszUInt64,
SszByteList,
SszUInt256,
SszUInt256,
SszBytes32,
SszBytes32,
SszBytes32>
SszBytes32,
SszUInt256>
schema,
TreeNode backingTree) {
super(schema, backingTree);
Expand All @@ -86,10 +86,10 @@ public ExecutionPayloadHeaderDenebImpl(
SszUInt64 timestamp,
SszByteList extraData,
SszUInt256 baseFeePerGas,
SszUInt256 excessDataGas,
SszBytes32 blockHash,
SszBytes32 transactionsRoot,
SszBytes32 withdrawalsRoot) {
SszBytes32 withdrawalsRoot,
SszUInt256 excessDataGas) {
super(
schema,
parentHash,
Expand All @@ -104,10 +104,10 @@ public ExecutionPayloadHeaderDenebImpl(
timestamp,
extraData,
baseFeePerGas,
excessDataGas,
blockHash,
transactionsRoot,
withdrawalsRoot);
withdrawalsRoot,
excessDataGas);
}

@Override
Expand Down Expand Up @@ -185,19 +185,14 @@ public UInt256 getBaseFeePerGas() {
return getField11().get();
}

@Override
public UInt256 getExcessDataGas() {
return getField12().get();
}

@Override
public Bytes32 getBlockHash() {
return getField13().get();
return getField12().get();
}

@Override
public Bytes32 getTransactionsRoot() {
return getField14().get();
return getField13().get();
}

@Override
Expand All @@ -207,6 +202,11 @@ public Bytes32 getPayloadHash() {

@Override
public Bytes32 getWithdrawalsRoot() {
return getField14().get();
}

@Override
public UInt256 getExcessDataGas() {
return getField15().get();
}
}
Loading