Skip to content

Commit

Permalink
merge main and fix block issues
Browse files Browse the repository at this point in the history
Signed-off-by: Karim Taam <[email protected]>
  • Loading branch information
matkt committed May 22, 2024
2 parents 59625dd + 87dfbcd commit a4aff35
Show file tree
Hide file tree
Showing 69 changed files with 656 additions and 371 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public static BlockHeader createBlockHeader(
null,
null,
null,
null,
blockHeaderFunctions);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ public void miningParametersBlockPeriodSecondsIsUpdatedOnTransition() {
null,
null,
null,
null,
getBlockHeaderFunctions());
final Block block1 = new Block(header1, BlockBody.empty());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ private void setSyncTarget() {
mock(EthPeer.class),
new org.hyperledger.besu.ethereum.core.BlockHeader(
null, null, null, null, null, null, null, null, 1, 1, 1, 1, null, null, null, 1, null,
null, null, null, null, null));
null, null, null, null, null, null));
}

private void clearSyncTarget() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* 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.datatypes;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ public JsonRpcResponse syncResponse(final JsonRpcRequestContext requestContext)
reqId, new JsonRpcError(INVALID_PARAMS, "Invalid withdrawal request"));
}


final Optional<ExecutionWitness> maybeExecutionWitness =
Optional.ofNullable(blockParam.getExecutionWitness())
.map(ExecutionWitnessParameter::toExecutionWitness);
Expand Down Expand Up @@ -270,8 +269,8 @@ public JsonRpcResponse syncResponse(final JsonRpcRequestContext requestContext)
: BlobGas.fromHexString(blockParam.getExcessBlobGas()),
maybeParentBeaconBlockRoot.orElse(null),
maybeRequests.map(BodyValidation::requestsRoot).orElse(null),
maybeExecutionWitness.orElse(null),
headerFunctions);
maybeExecutionWitness.orElse(null),
headerFunctions);

// ensure the block hash matches the blockParam hash
// this must be done before any other check
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright Hyperledger Besu Contributors.
* 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright Hyperledger Besu Contributors.
* 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
Expand All @@ -12,7 +12,6 @@
*
* SPDX-License-Identifier: Apache-2.0
*/

package org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.engine;

import org.hyperledger.besu.ethereum.core.BlockHeader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ public EnginePayloadParameter(
@JsonProperty("blobGasUsed") final UnsignedLongParameter blobGasUsed,
@JsonProperty("excessBlobGas") final String excessBlobGas,
@JsonProperty("depositReceipts") final List<DepositParameter> deposits,
@JsonProperty("withdrawalRequests") final List<WithdrawalRequestParameter> withdrawalRequestParameters,
@JsonProperty("withdrawalRequests")
final List<WithdrawalRequestParameter> withdrawalRequestParameters,
@JsonProperty("executionWitness") final ExecutionWitnessParameter executionWitness) {
this.blockHash = blockHash;
this.parentHash = parentHash;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* 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.ethereum.api.jsonrpc.internal.parameters;

import org.hyperledger.besu.ethereum.trie.verkle.ExecutionWitness;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* 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.ethereum.api.jsonrpc.internal.parameters;

import org.hyperledger.besu.ethereum.core.json.HexStringDeserializer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* 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.ethereum.api.jsonrpc.internal.parameters;

import org.hyperledger.besu.ethereum.trie.verkle.StateDiff;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* 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.ethereum.api.jsonrpc.internal.parameters;

import org.hyperledger.besu.ethereum.core.json.HexStringDeserializer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* 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.ethereum.api.jsonrpc.internal.parameters;

import org.hyperledger.besu.ethereum.core.json.HexStringDeserializer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* 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.ethereum.api.jsonrpc.internal.parameters;

import org.hyperledger.besu.ethereum.core.json.HexStringDeserializer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,8 @@ protected EnginePayloadParameter mockEnginePayload(
header.getBlobGasUsed().map(UnsignedLongParameter::new).orElse(null),
header.getExcessBlobGas().map(BlobGas::toHexString).orElse(null),
deposits,
withdrawalRequests,executionWitness);
withdrawalRequests,
executionWitness);
}

protected BlockHeader setupValidPayload(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public BlockHeader(
excessBlobGas,
parentBeaconBlockRoot,
requestsRoot,
executionWitness);
executionWitness);
this.nonce = nonce;
this.hash = Suppliers.memoize(() -> blockHeaderFunctions.hash(this));
this.parsedExtraData = Suppliers.memoize(() -> blockHeaderFunctions.parseExtraData(this));
Expand Down Expand Up @@ -168,22 +168,22 @@ public void writeTo(final RLPOutput out) {
out.writeBytes(withdrawalsRoot);
}
/*if (excessBlobGas != null && blobGasUsed != null) {
out.writeLongScalar(blobGasUsed);
out.writeUInt64Scalar(excessBlobGas);
}
if (parentBeaconBlockRoot != null) {
out.writeBytes(parentBeaconBlockRoot);
}
<<<<<<< HEAD
if (depositsRoot != null) {
out.writeBytes(depositsRoot);
}
if (exitsRoot != null) {
out.writeBytes(exitsRoot);
}
if (requestsRoot != null) {
out.writeBytes(requestsRoot);
}*/
out.writeLongScalar(blobGasUsed);
out.writeUInt64Scalar(excessBlobGas);
}
if (parentBeaconBlockRoot != null) {
out.writeBytes(parentBeaconBlockRoot);
}
<<<<<<< HEAD
if (depositsRoot != null) {
out.writeBytes(depositsRoot);
}
if (exitsRoot != null) {
out.writeBytes(exitsRoot);
}
if (requestsRoot != null) {
out.writeBytes(requestsRoot);
}*/
out.endList();
}

Expand Down Expand Up @@ -213,17 +213,15 @@ public static BlockHeader readFrom(

// TODO REACTIVATE
/*final Long blobGasUsed = !input.isEndOfCurrentList() ? input.readLongScalar() : null;
final BlobGas excessBlobGas =
!input.isEndOfCurrentList() ? BlobGas.of(input.readUInt64Scalar()) : null;
final Bytes32 parentBeaconBlockRoot = !input.isEndOfCurrentList() ? input.readBytes32() : null;
<<<<<<< HEAD
final Hash depositHashRoot =
!input.isEndOfCurrentList() ? Hash.wrap(input.readBytes32()) : null;
final Hash exitsHashRoot = !input.isEndOfCurrentList() ? Hash.wrap(input.readBytes32()) : null;
final Hash requestsRoot = !input.isEndOfCurrentList() ? Hash.wrap(input.readBytes32()) : null;
*/


final BlobGas excessBlobGas =
!input.isEndOfCurrentList() ? BlobGas.of(input.readUInt64Scalar()) : null;
final Bytes32 parentBeaconBlockRoot = !input.isEndOfCurrentList() ? input.readBytes32() : null;
<<<<<<< HEAD
final Hash depositHashRoot =
!input.isEndOfCurrentList() ? Hash.wrap(input.readBytes32()) : null;
final Hash exitsHashRoot = !input.isEndOfCurrentList() ? Hash.wrap(input.readBytes32()) : null;
final Hash requestsRoot = !input.isEndOfCurrentList() ? Hash.wrap(input.readBytes32()) : null;
*/

final ExecutionWitness executionWitness =
!input.isEndOfCurrentList() ? ExecutionWitness.readFrom(input) : null;
Expand All @@ -249,7 +247,7 @@ public static BlockHeader readFrom(
null,
null,
null,
null,
null,
executionWitness,
blockHeaderFunctions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public static BlockHeaderBuilder fromHeader(final BlockHeader header) {
.blobGasUsed(header.getBlobGasUsed().orElse(null))
.excessBlobGas(header.getExcessBlobGas().orElse(null))
.parentBeaconBlockRoot(header.getParentBeaconBlockRoot().orElse(null))
.requestsRoot(header.getRequestsRoot().orElse(null))
.requestsRoot(header.getRequestsRoot().orElse(null))
.executionWitness(header.getExecutionWitness().orElse(null));
}

Expand All @@ -151,8 +151,7 @@ public static BlockHeaderBuilder fromBuilder(final BlockHeaderBuilder fromBuilde
.withdrawalsRoot(fromBuilder.withdrawalsRoot)
.excessBlobGas(fromBuilder.excessBlobGas)
.parentBeaconBlockRoot(fromBuilder.parentBeaconBlockRoot)

.requestsRoot(fromBuilder.requestsRoot)
.requestsRoot(fromBuilder.requestsRoot)
.executionWitness(fromBuilder.executionWitness)
.blockHeaderFunctions(fromBuilder.blockHeaderFunctions);
toBuilder.nonce = fromBuilder.nonce;
Expand Down Expand Up @@ -183,8 +182,7 @@ public BlockHeader buildBlockHeader() {
blobGasUsed,
excessBlobGas,
parentBeaconBlockRoot,

requestsRoot,
requestsRoot,
executionWitness,
blockHeaderFunctions);
}
Expand Down Expand Up @@ -227,7 +225,7 @@ public SealableBlockHeader buildSealableBlockHeader() {
blobGasUsed,
excessBlobGas,
parentBeaconBlockRoot,
requestsRoot,
requestsRoot,
executionWitness);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright Hyperledger Besu Contributors.
* 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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*
* Copyright contributors to Hyperledger Besu
*
* 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
Expand All @@ -13,7 +12,6 @@
*
* SPDX-License-Identifier: Apache-2.0
*/

package org.hyperledger.besu.ethereum.mainnet;

import org.hyperledger.besu.ethereum.trie.verkle.ExecutionWitness;
Expand Down
Loading

0 comments on commit a4aff35

Please sign in to comment.