-
Notifications
You must be signed in to change notification settings - Fork 479
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add endpoint to support rBuilder payload (#8160)
- Loading branch information
Showing
8 changed files
with
253 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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 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 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,46 @@ | ||
// SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
using Nethermind.Core; | ||
using Nethermind.Core.Crypto; | ||
using Nethermind.Int256; | ||
|
||
namespace Nethermind.Flashbots.Data; | ||
|
||
public class Message( | ||
ulong slot, | ||
Hash256 parent_hash, | ||
Hash256 block_hash, | ||
PublicKey builder_pubkey, | ||
PublicKey proposer_pubkey, | ||
Address proposer_fee_recipient, | ||
long gas_limit, | ||
long gas_used, | ||
UInt256 value) | ||
{ | ||
public ulong slot { get; } = slot; | ||
public required Hash256 parent_hash { get; set; } = parent_hash; | ||
public Hash256 block_hash { get; } = block_hash; | ||
public PublicKey builder_pubkey { get; } = builder_pubkey; | ||
public PublicKey proposer_pubkey { get; } = proposer_pubkey; | ||
public Address proposer_fee_recipient { get; } = proposer_fee_recipient; | ||
public long gas_limit { get; } = gas_limit; | ||
public long gas_used { get; } = gas_used; | ||
public UInt256 value { get; } = value; | ||
|
||
public BidTrace ToBidTrace() | ||
{ | ||
return new BidTrace( | ||
slot, | ||
parent_hash, | ||
block_hash, | ||
builder_pubkey, | ||
proposer_pubkey, | ||
proposer_fee_recipient, | ||
gas_limit, | ||
gas_used, | ||
value | ||
); | ||
} | ||
} | ||
|
50 changes: 50 additions & 0 deletions
50
src/Nethermind/Nethermind.Flashbots/Data/RBuilderBlockValidationRequest.cs
This file contains 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,50 @@ | ||
// SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
using System.Text.Json.Serialization; | ||
using Nethermind.Core.Crypto; | ||
using Nethermind.Merge.Plugin.Data; | ||
|
||
namespace Nethermind.Flashbots.Data; | ||
|
||
public class RBuilderBlockValidationRequest | ||
{ | ||
public RBuilderBlockValidationRequest( | ||
Message message, | ||
RExecutionPayloadV3 execution_payload, | ||
BlobsBundleV1 blobs_bundle, | ||
byte[] signature, | ||
long registered_gas_limit, | ||
Hash256 withdrawals_root, | ||
Hash256 parent_beacon_block_root) | ||
{ | ||
this.message = message; | ||
this.execution_payload = execution_payload; | ||
this.blobs_bundle = blobs_bundle; | ||
this.signature = signature; | ||
this.registered_gas_limit = registered_gas_limit; | ||
this.withdrawals_root = withdrawals_root; | ||
this.parent_beacon_block_root = parent_beacon_block_root; | ||
} | ||
|
||
[JsonRequired] | ||
public Message message { get; set; } | ||
|
||
[JsonRequired] | ||
public RExecutionPayloadV3 execution_payload { get; set; } | ||
|
||
[JsonRequired] | ||
public BlobsBundleV1 blobs_bundle { get; set; } | ||
|
||
[JsonRequired] | ||
public byte[] signature { get; set; } | ||
|
||
[JsonRequired] | ||
public long registered_gas_limit { get; set; } | ||
|
||
[JsonRequired] | ||
public Hash256 withdrawals_root { get; set; } | ||
|
||
[JsonRequired] | ||
public Hash256 parent_beacon_block_root { get; set; } | ||
} |
91 changes: 91 additions & 0 deletions
91
src/Nethermind/Nethermind.Flashbots/Data/RExecutionPayloadV3.cs
This file contains 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,91 @@ | ||
// SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited | ||
// SPDX-License-Identifier: LGPL-3.0-only | ||
|
||
using Nethermind.Core; | ||
using Nethermind.Core.Crypto; | ||
using Nethermind.Int256; | ||
using Nethermind.Merge.Plugin.Data; | ||
|
||
public class RExecutionPayloadV3 | ||
{ | ||
public Hash256 parent_hash { get; set; } | ||
public Address fee_recipient { get; set; } | ||
public Hash256 state_root { get; set; } | ||
public Hash256 receipts_root { get; set; } | ||
public Bloom logs_bloom { get; set; } | ||
public Hash256 prev_randao { get; set; } | ||
public long block_number { get; set; } | ||
public long gas_limit { get; set; } | ||
public long gas_used { get; set; } | ||
public ulong timestamp { get; set; } | ||
public byte[] extra_data { get; set; } | ||
public UInt256 base_fee_per_gas { get; set; } | ||
public Hash256 block_hash { get; set; } | ||
public byte[][] transactions { get; set; } | ||
public Withdrawal[]? withdrawals { get; set; } | ||
public ulong? blob_gas_used { get; set; } | ||
public ulong? excess_blob_gas { get; set; } | ||
|
||
public ExecutionPayloadV3 ToExecutionPayloadV3() | ||
{ | ||
return new ExecutionPayloadV3 | ||
{ | ||
ParentHash = parent_hash, | ||
FeeRecipient = fee_recipient, | ||
StateRoot = state_root, | ||
ReceiptsRoot = receipts_root, | ||
LogsBloom = logs_bloom, | ||
PrevRandao = prev_randao, | ||
BlockNumber = block_number, | ||
GasLimit = gas_limit, | ||
GasUsed = gas_used, | ||
Timestamp = timestamp, | ||
ExtraData = extra_data, | ||
BaseFeePerGas = base_fee_per_gas, | ||
BlockHash = block_hash, | ||
Transactions = transactions, | ||
Withdrawals = withdrawals, | ||
BlobGasUsed = blob_gas_used, | ||
ExcessBlobGas = excess_blob_gas | ||
}; | ||
} | ||
|
||
public RExecutionPayloadV3( | ||
Hash256 parent_hash, | ||
Address fee_recipient, | ||
Hash256 state_root, | ||
Hash256 receipts_root, | ||
Bloom logs_bloom, | ||
Hash256 prev_randao, | ||
long block_number, | ||
long gas_limit, | ||
long gas_used, | ||
ulong timestamp, | ||
byte[] extra_data, | ||
UInt256 base_fee_per_gas, | ||
Hash256 block_hash, | ||
byte[][] transactions, | ||
Withdrawal[]? withdrawals, | ||
ulong? blob_gas_used, | ||
ulong? excess_blob_gas | ||
) | ||
{ | ||
this.parent_hash = parent_hash; | ||
this.fee_recipient = fee_recipient; | ||
this.state_root = state_root; | ||
this.receipts_root = receipts_root; | ||
this.logs_bloom = logs_bloom; | ||
this.prev_randao = prev_randao; | ||
this.block_number = block_number; | ||
this.gas_limit = gas_limit; | ||
this.gas_used = gas_used; | ||
this.timestamp = timestamp; | ||
this.extra_data = extra_data; | ||
this.base_fee_per_gas = base_fee_per_gas; | ||
this.block_hash = block_hash; | ||
this.transactions = transactions; | ||
this.withdrawals = withdrawals; | ||
this.blob_gas_used = blob_gas_used; | ||
this.excess_blob_gas = excess_blob_gas; | ||
} | ||
} |
This file contains 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 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 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