From fc4152088ee6b62dee37afd8a9009d7360117dfb Mon Sep 17 00:00:00 2001 From: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com> Date: Tue, 16 Jul 2024 15:44:13 +0200 Subject: [PATCH 01/17] change module path to erigontech/interfaces (#222) --- README.md | 2 +- go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e38a3d4..3d675b1 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ gRPC services of [Erigon](https://github.com/ledgerwatch/erigon) and [Silkworm]( Using a go module is the most effective way to include these definitions in consuming repos. ``` -go get github.com/ledgerwatch/interfaces +go get github.com/erigontech/interfaces ``` This makes local development easier as go.mod redirect can be used, and saves on submodule/tree updates (which were the previous method of consumption). diff --git a/go.mod b/go.mod index 542a921..85296bc 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module github.com/ledgerwatch/interfaces +module github.com/erigontech/interfaces go 1.18 From 810df05baa15acb99f263a5618c9da78a5339aa9 Mon Sep 17 00:00:00 2001 From: Mark Holt Date: Sat, 20 Jul 2024 17:57:13 +0100 Subject: [PATCH 02/17] update downloader stats --- downloader/downloader.proto | 2 ++ 1 file changed, 2 insertions(+) diff --git a/downloader/downloader.proto b/downloader/downloader.proto index d27d1d6..f7123ba 100644 --- a/downloader/downloader.proto +++ b/downloader/downloader.proto @@ -69,4 +69,6 @@ message StatsReply { uint64 bytes_total = 9; uint64 upload_rate = 10; // bytes/sec uint64 download_rate = 11; // bytes/sec + uint64 hash_rate = 11; // bytes/sec + uint64 completion_rate = 11; // bytes/sec } From ef1ae67f39ceef725348022f8ee5108340c02311 Mon Sep 17 00:00:00 2001 From: Mark Holt Date: Sat, 20 Jul 2024 18:31:41 +0100 Subject: [PATCH 03/17] update downloader stats --- downloader/downloader.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/downloader/downloader.proto b/downloader/downloader.proto index f7123ba..2a86a20 100644 --- a/downloader/downloader.proto +++ b/downloader/downloader.proto @@ -69,6 +69,6 @@ message StatsReply { uint64 bytes_total = 9; uint64 upload_rate = 10; // bytes/sec uint64 download_rate = 11; // bytes/sec - uint64 hash_rate = 11; // bytes/sec - uint64 completion_rate = 11; // bytes/sec + uint64 hash_rate = 12; // bytes/sec + uint64 completion_rate = 13; // bytes/sec } From ed05a9edbf6b4ea505417e982cb03cb75144bc31 Mon Sep 17 00:00:00 2001 From: Mark Holt Date: Sun, 21 Jul 2024 20:02:49 +0100 Subject: [PATCH 04/17] add flush rate --- downloader/downloader.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/downloader/downloader.proto b/downloader/downloader.proto index 2a86a20..132f569 100644 --- a/downloader/downloader.proto +++ b/downloader/downloader.proto @@ -71,4 +71,5 @@ message StatsReply { uint64 download_rate = 11; // bytes/sec uint64 hash_rate = 12; // bytes/sec uint64 completion_rate = 13; // bytes/sec + uint64 flush_rate = 14; // bytes/sec } From 0d10589c853376fc093fafc4c45d4d2c48f8e9e4 Mon Sep 17 00:00:00 2001 From: Somnath Date: Tue, 30 Jul 2024 12:54:20 +0400 Subject: [PATCH 05/17] Add consolidation req to types (#223) --- types/types.proto | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/types.proto b/types/types.proto index 073c9d3..38df0f1 100644 --- a/types/types.proto +++ b/types/types.proto @@ -79,6 +79,7 @@ message ExecutionPayload { optional uint64 excess_blob_gas = 18; repeated DepositRequest deposit_requests = 19; repeated WithdrawalRequest withdrawal_requests = 20; + repeated ConsolidationRequest consolidation_requests = 21; } message DepositRequest { @@ -95,6 +96,12 @@ message WithdrawalRequest { uint64 amount = 3; } +message ConsolidationRequest { + H160 source_address = 1; + bytes source_pubkey = 2; + bytes target_pubkey = 3; +} + message Withdrawal { uint64 index = 1; uint64 validator_index = 2; From 67688383f257514ff5a92cf82d82189fe3149641 Mon Sep 17 00:00:00 2001 From: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com> Date: Thu, 1 Aug 2024 15:59:04 +0200 Subject: [PATCH 06/17] README: ledgerwatch -> erigontech (#224) --- README.md | 2 +- _docs/README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3d675b1..a7c399a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Interfaces -gRPC services of [Erigon](https://github.com/ledgerwatch/erigon) and [Silkworm](https://github.com/erigontech/silkworm). +gRPC services of [Erigon](https://github.com/erigontech/erigon) and [Silkworm](https://github.com/erigontech/silkworm). [Components description](./_docs/README.md) diff --git a/_docs/README.md b/_docs/README.md index 5d53247..fba77bd 100644 --- a/_docs/README.md +++ b/_docs/README.md @@ -107,7 +107,7 @@ Erigon has the following interfaces for the transaction pool - [txpool_control, proto](../txpool/txpool_control.proto) - [mining, proto](../txpool/mining.proto) -See more about the architecture: https://github.com/ledgerwatch/erigon/wiki/Transaction-Pool-Design +See more about the architecture: https://github.com/erigontech/erigon/wiki/Transaction-Pool-Design ## 4. Core @@ -127,7 +127,7 @@ Core connects to [Sentry] and [Consensus Engine], and accepts connections from [ Consensus Engine is the component that abstracts away consensus mechanism like EtHash Proof Of Work, ProgPOW Proof of Work, Clique Proof Of Authority, and in the future also AuRa Proof Of Authority and Proof Of Stake mechanism. Note that at the time of writing, Consensus Engine split has not been -done yet, but some [work has been done on the interface](https://github.com/ledgerwatch/erigon/wiki/Consensus-Engine-separation). +done yet, but some [work has been done on the interface](https://github.com/erigontech/erigon/wiki/Consensus-Engine-separation). Erigon has the following interface for the consensus engine: - [consensus_engine, proto](../consensus_engine/consensus.proto) From fd1e1f60b2d7799b21a33550f2eb73891b4cac87 Mon Sep 17 00:00:00 2001 From: canepat <16927169+canepat@users.noreply.github.com> Date: Fri, 2 Aug 2024 15:14:16 +0200 Subject: [PATCH 07/17] fix typo in kv.proto (#225) --- remote/kv.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remote/kv.proto b/remote/kv.proto index f11ed61..d6212be 100644 --- a/remote/kv.proto +++ b/remote/kv.proto @@ -276,7 +276,7 @@ message Pairs { // bytes values = 3; } -message ParisPagination { +message PairsPagination { bytes next_key = 1; sint64 limit = 2; } From 740306e3debed05c0fe659613111500fc270dcaf Mon Sep 17 00:00:00 2001 From: Giulio rebuffo Date: Sun, 18 Aug 2024 18:55:15 +0200 Subject: [PATCH 08/17] Add new methods to `Ethbackend` for `CanonicalHash` and `HeaderNumber` (#227) * save * save --- remote/ethbackend.proto | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/remote/ethbackend.proto b/remote/ethbackend.proto index 214f9d4..82052fc 100644 --- a/remote/ethbackend.proto +++ b/remote/ethbackend.proto @@ -33,6 +33,12 @@ service ETHBACKEND { // Request fields are optional - it's ok to request block only by hash or only by number rpc Block(BlockRequest) returns (BlockReply); + // High-level method - can find block hash by block number + rpc CanonicalHash(CanonicalHashRequest) returns (CanonicalHashReply); + + // High-level method - can find block number by block hash + rpc HeaderNumber(HeaderNumberRequest) returns (HeaderNumberReply); + // High-level method - can find block number by txn hash // it doesn't provide consistency rpc TxnLookup(TxnLookupRequest) returns (TxnLookupReply); @@ -82,6 +88,22 @@ message ClientVersionRequest {} message ClientVersionReply { string node_name = 1; } +message CanonicalHashRequest { + uint64 block_number = 1; +} + +message CanonicalHashReply { + types.H256 hash = 1; +} + +message HeaderNumberRequest { + types.H256 hash = 1; +} + +message HeaderNumberReply { + optional uint64 number = 1; +} + message SubscribeRequest { Event type = 1; } From cd6dd25490a94a6d495100a8492b05647fcc9d23 Mon Sep 17 00:00:00 2001 From: Giulio rebuffo Date: Sat, 24 Aug 2024 17:41:49 +0200 Subject: [PATCH 09/17] save (#228) --- remote/ethbackend.proto | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/remote/ethbackend.proto b/remote/ethbackend.proto index 82052fc..e0ed93d 100644 --- a/remote/ethbackend.proto +++ b/remote/ethbackend.proto @@ -33,6 +33,9 @@ service ETHBACKEND { // Request fields are optional - it's ok to request block only by hash or only by number rpc Block(BlockRequest) returns (BlockReply); + // High-level method - can read block body (only storage metadata) from db, snapshots or apply any other logic + rpc CanonicalBodyForStorage(CanonicalBodyForStorageRequest) returns (CanonicalBodyForStorageReply); + // High-level method - can find block hash by block number rpc CanonicalHash(CanonicalHashRequest) returns (CanonicalHashReply); @@ -104,6 +107,14 @@ message HeaderNumberReply { optional uint64 number = 1; } +message CanonicalBodyForStorageRequest { + uint64 blockNumber = 1; +} + +message CanonicalBodyForStorageReply { + bytes body = 1; +} + message SubscribeRequest { Event type = 1; } From a53e7c9f9eb1e59c602d07665e7e3b5b2bbd4f3f Mon Sep 17 00:00:00 2001 From: Dmytro Vovk Date: Mon, 26 Aug 2024 16:24:43 +0100 Subject: [PATCH 10/17] added method to set downloader prefix (#229) --- downloader/downloader.proto | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/downloader/downloader.proto b/downloader/downloader.proto index 132f569..169f6ff 100644 --- a/downloader/downloader.proto +++ b/downloader/downloader.proto @@ -21,6 +21,9 @@ service Downloader { // If some part of file is bad - such part will be re-downloaded (without returning error) rpc Verify (VerifyRequest) returns (google.protobuf.Empty) {} rpc Stats (StatsRequest) returns (StatsReply) {} + + // Set log prefix for downloader + rpc SetLogPrefix (SetLogPrefixRequest) returns (google.protobuf.Empty) {} } // DownloadItem: @@ -73,3 +76,8 @@ message StatsReply { uint64 completion_rate = 13; // bytes/sec uint64 flush_rate = 14; // bytes/sec } + +// SetLogPrefixRequest: set downloader log prefix +message SetLogPrefixRequest { + string prefix = 1; +} \ No newline at end of file From 85a1a7e5d20085cb9ec0544f8c205b9be3b5cffa Mon Sep 17 00:00:00 2001 From: Dmytro Vovk Date: Wed, 28 Aug 2024 11:59:38 +0100 Subject: [PATCH 11/17] removed stats (#230) --- downloader/downloader.proto | 40 ++++++++++--------------------------- 1 file changed, 11 insertions(+), 29 deletions(-) diff --git a/downloader/downloader.proto b/downloader/downloader.proto index 169f6ff..e9266a4 100644 --- a/downloader/downloader.proto +++ b/downloader/downloader.proto @@ -20,10 +20,12 @@ service Downloader { // Trigger verification of files // If some part of file is bad - such part will be re-downloaded (without returning error) rpc Verify (VerifyRequest) returns (google.protobuf.Empty) {} - rpc Stats (StatsRequest) returns (StatsReply) {} // Set log prefix for downloader rpc SetLogPrefix (SetLogPrefixRequest) returns (google.protobuf.Empty) {} + + // Get is download completed + rpc Completed (CompletedRequest) returns (CompletedReply) {} } // DownloadItem: @@ -45,39 +47,19 @@ message DeleteRequest { message VerifyRequest { } - -message StatsRequest { -} - message ProhibitNewDownloadsRequest { string type = 1; } -message StatsReply { - // First step on startup - "resolve metadata": - // - understand total amount of data to download - // - ensure all pieces hashes available - // - validate files after crush - // - when all metadata ready - can start download/upload - int32 metadata_ready = 1; - int32 files_total = 2; - - int32 peers_unique = 4; - uint64 connections_total = 5; - - bool completed = 6; - float progress = 7; - - uint64 bytes_completed = 8; - uint64 bytes_total = 9; - uint64 upload_rate = 10; // bytes/sec - uint64 download_rate = 11; // bytes/sec - uint64 hash_rate = 12; // bytes/sec - uint64 completion_rate = 13; // bytes/sec - uint64 flush_rate = 14; // bytes/sec -} - // SetLogPrefixRequest: set downloader log prefix message SetLogPrefixRequest { string prefix = 1; +} + +message CompletedRequest { +} + +// CompletedReply: return true if download is completed +message CompletedReply { + bool completed = 1; } \ No newline at end of file From 5d234ad9e070a31d172fca5b2803b59cee1a5994 Mon Sep 17 00:00:00 2001 From: Dmytro Vovk Date: Thu, 5 Sep 2024 09:35:06 +0100 Subject: [PATCH 12/17] torrent downloaded notify (#232) --- downloader/downloader.proto | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/downloader/downloader.proto b/downloader/downloader.proto index e9266a4..3e1dd7a 100644 --- a/downloader/downloader.proto +++ b/downloader/downloader.proto @@ -26,6 +26,8 @@ service Downloader { // Get is download completed rpc Completed (CompletedRequest) returns (CompletedReply) {} + + rpc TorrentCompleted(TorrentCompletedRequest) returns (stream TorrentCompletedReply); } // DownloadItem: @@ -62,4 +64,13 @@ message CompletedRequest { // CompletedReply: return true if download is completed message CompletedReply { bool completed = 1; +} + +message TorrentCompletedRequest { +} + +// Message: downloaded file data +message TorrentCompletedReply { + string name = 1; + types.H160 hash = 2; } \ No newline at end of file From 2c1accea17aa482a4d2cd3bd80d2dad0624f86fc Mon Sep 17 00:00:00 2001 From: Shoham Chakraborty Date: Thu, 5 Sep 2024 19:30:27 +0800 Subject: [PATCH 13/17] Split BorEvent into BorEvents and BorTxnLookup (#231) * Use block number * BorEventsRequest * Remove event rlps * Add optional bortxhash * Rename * Newline * Rename --- remote/ethbackend.proto | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/remote/ethbackend.proto b/remote/ethbackend.proto index e0ed93d..97ef914 100644 --- a/remote/ethbackend.proto +++ b/remote/ethbackend.proto @@ -57,7 +57,9 @@ service ETHBACKEND { // PendingBlock returns latest built block. rpc PendingBlock(google.protobuf.Empty) returns (PendingBlockReply); - rpc BorEvent(BorEventRequest) returns (BorEventReply); + rpc BorTxnLookup(BorTxnLookupRequest) returns (BorTxnLookupReply); + + rpc BorEvents(BorEventsRequest) returns (BorEventsReply); } enum Event { @@ -194,12 +196,20 @@ message EngineGetPayloadBodiesByRangeV1Request { uint64 count = 2; } -message BorEventRequest { +message BorTxnLookupRequest { types.H256 bor_tx_hash = 1; } -message BorEventReply { +message BorTxnLookupReply { bool present = 1; uint64 block_number = 2; - repeated bytes event_rlps = 3; +} + +message BorEventsRequest { + uint64 block_num = 1; + types.H256 block_hash = 2; +} + +message BorEventsReply { + repeated bytes event_rlps = 1; } From 53ce6989bb37c4d02903e1f02d16d3bc239d0c23 Mon Sep 17 00:00:00 2001 From: Shoham Chakraborty Date: Wed, 11 Sep 2024 08:21:12 +0800 Subject: [PATCH 14/17] Create BridgeBackend (#233) * Bridge backend * Move messages --- remote/bor.proto | 36 ++++++++++++++++++++++++++++++++++++ remote/ethbackend.proto | 19 +------------------ 2 files changed, 37 insertions(+), 18 deletions(-) create mode 100644 remote/bor.proto diff --git a/remote/bor.proto b/remote/bor.proto new file mode 100644 index 0000000..af31bc9 --- /dev/null +++ b/remote/bor.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +import "google/protobuf/empty.proto"; +import "types/types.proto"; + +package remote; + +option go_package = "./remote;remoteproto"; + +service BridgeBackend { + // Version returns the service version number + rpc Version(google.protobuf.Empty) returns (types.VersionReply); + + rpc BorTxnLookup(BorTxnLookupRequest) returns (BorTxnLookupReply); + + rpc BorEvents(BorEventsRequest) returns (BorEventsReply); +} + +message BorTxnLookupRequest { + types.H256 bor_tx_hash = 1; +} + +message BorTxnLookupReply { + bool present = 1; + uint64 block_number = 2; +} + +message BorEventsRequest { + uint64 block_num = 1; + types.H256 block_hash = 2; +} + +message BorEventsReply { + string state_receiver_contract_address = 1; + repeated bytes event_rlps = 2; +} diff --git a/remote/ethbackend.proto b/remote/ethbackend.proto index 97ef914..7d8f696 100644 --- a/remote/ethbackend.proto +++ b/remote/ethbackend.proto @@ -2,6 +2,7 @@ syntax = "proto3"; import "google/protobuf/empty.proto"; import "types/types.proto"; +import "remote/bor.proto"; package remote; @@ -195,21 +196,3 @@ message EngineGetPayloadBodiesByRangeV1Request { uint64 start = 1; uint64 count = 2; } - -message BorTxnLookupRequest { - types.H256 bor_tx_hash = 1; -} - -message BorTxnLookupReply { - bool present = 1; - uint64 block_number = 2; -} - -message BorEventsRequest { - uint64 block_num = 1; - types.H256 block_hash = 2; -} - -message BorEventsReply { - repeated bytes event_rlps = 1; -} From 81edac3d39ef27bffd41148d8a6846ac86ede485 Mon Sep 17 00:00:00 2001 From: Somnath Date: Fri, 11 Oct 2024 14:25:45 +0400 Subject: [PATCH 15/17] Change Withdrawal req (#234) --- types/types.proto | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/types.proto b/types/types.proto index 38df0f1..8523d5b 100644 --- a/types/types.proto +++ b/types/types.proto @@ -91,9 +91,7 @@ message DepositRequest { } message WithdrawalRequest { - H160 source_address = 1; - bytes validator_pubkey = 2; - uint64 amount = 3; + bytes request_data = 1; } message ConsolidationRequest { From 29c1d07f457d0855b3e945a5a6bb5881815593bf Mon Sep 17 00:00:00 2001 From: Somnath Date: Fri, 11 Oct 2024 14:26:08 +0400 Subject: [PATCH 16/17] Flatten 7251 req (#237) --- types/types.proto | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/types.proto b/types/types.proto index 8523d5b..4cc8c46 100644 --- a/types/types.proto +++ b/types/types.proto @@ -95,9 +95,7 @@ message WithdrawalRequest { } message ConsolidationRequest { - H160 source_address = 1; - bytes source_pubkey = 2; - bytes target_pubkey = 3; + bytes request_data = 1; } message Withdrawal { From c6c0be284959ae33e28bc36ab200e6c2d4be315e Mon Sep 17 00:00:00 2001 From: Somnath Date: Wed, 23 Oct 2024 18:53:01 +0530 Subject: [PATCH 17/17] Som/pectra4 engine api (#239) * Flatten 7251 req * Replace requests with generic requests * fix type * change byte to uint8 * Simplify requests bundle * Rename requests_hash and remove reqs from body --- execution/execution.proto | 4 ++-- types/types.proto | 23 ++++------------------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/execution/execution.proto b/execution/execution.proto index 1bbaa16..39309fd 100644 --- a/execution/execution.proto +++ b/execution/execution.proto @@ -56,7 +56,7 @@ message Header { optional uint64 blob_gas_used = 19; // added in Dencun (EIP-4844) optional uint64 excess_blob_gas = 20; // added in Dencun (EIP-4844) optional types.H256 parent_beacon_block_root = 21; // added in Dencun (EIP-4788) - optional types.H256 requests_root = 22; // added in Pectra (EIP-7685) + optional types.H256 requests_hash = 22; // added in Pectra (EIP-7685) // AuRa optional uint64 aura_step = 23; optional bytes aura_seal = 24; @@ -70,7 +70,6 @@ message BlockBody { repeated bytes transactions = 3; repeated Header uncles = 4; repeated types.Withdrawal withdrawals = 5; // added in Shapella (EIP-4895) - repeated bytes requests = 6; // added in Pectra (EIP-7685) } message Block { @@ -143,6 +142,7 @@ message AssembledBlockData { types.ExecutionPayload execution_payload = 1; types.H256 block_value = 2; types.BlobsBundleV1 blobs_bundle = 3; + types.RequestsBundle requests = 4; } message GetAssembledBlockResponse { diff --git a/types/types.proto b/types/types.proto index 4cc8c46..72c43f5 100644 --- a/types/types.proto +++ b/types/types.proto @@ -77,25 +77,6 @@ message ExecutionPayload { repeated Withdrawal withdrawals = 16; optional uint64 blob_gas_used = 17; optional uint64 excess_blob_gas = 18; - repeated DepositRequest deposit_requests = 19; - repeated WithdrawalRequest withdrawal_requests = 20; - repeated ConsolidationRequest consolidation_requests = 21; -} - -message DepositRequest { - bytes pubkey = 1; - H256 withdrawal_credentials = 2; - uint64 amount = 3; - bytes signature = 4; - uint64 index = 5; -} - -message WithdrawalRequest { - bytes request_data = 1; -} - -message ConsolidationRequest { - bytes request_data = 1; } message Withdrawal { @@ -113,6 +94,10 @@ message BlobsBundleV1 { repeated bytes proofs = 3; } +message RequestsBundle { + repeated bytes requests = 1; +} + // End of Engine API types // ------------------------------------------------------------------------