Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into txmum-lookup-method
Browse files Browse the repository at this point in the history
  • Loading branch information
JkLondon committed Oct 24, 2024
2 parents 3e246a5 + c6c0be2 commit c5606cf
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 58 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

Expand All @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions _docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down
50 changes: 27 additions & 23 deletions downloader/downloader.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ 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) {}

rpc TorrentCompleted(TorrentCompletedRequest) returns (stream TorrentCompletedReply);
}

// DownloadItem:
Expand All @@ -42,31 +49,28 @@ message DeleteRequest {
message VerifyRequest {
}

message ProhibitNewDownloadsRequest {
string type = 1;
}

message StatsRequest {
// SetLogPrefixRequest: set downloader log prefix
message SetLogPrefixRequest {
string prefix = 1;
}

message ProhibitNewDownloadsRequest {
string type = 1;
message CompletedRequest {
}

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
// 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;
}
4 changes: 2 additions & 2 deletions execution/execution.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/ledgerwatch/interfaces
module github.com/erigontech/interfaces

go 1.18
36 changes: 36 additions & 0 deletions remote/bor.proto
Original file line number Diff line number Diff line change
@@ -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;
}
48 changes: 37 additions & 11 deletions remote/ethbackend.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";

import "google/protobuf/empty.proto";
import "types/types.proto";
import "remote/bor.proto";

package remote;

Expand Down Expand Up @@ -33,6 +34,15 @@ 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);

// 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);
Expand All @@ -52,7 +62,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 {
Expand Down Expand Up @@ -86,6 +98,30 @@ 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 CanonicalBodyForStorageRequest {
uint64 blockNumber = 1;
}

message CanonicalBodyForStorageReply {
bytes body = 1;
}

message SubscribeRequest {
Event type = 1;
}
Expand Down Expand Up @@ -168,13 +204,3 @@ message EngineGetPayloadBodiesByRangeV1Request {
uint64 start = 1;
uint64 count = 2;
}

message BorEventRequest {
types.H256 bor_tx_hash = 1;
}

message BorEventReply {
bool present = 1;
uint64 block_number = 2;
repeated bytes event_rlps = 3;
}
2 changes: 1 addition & 1 deletion remote/kv.proto
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ message Pairs {
// bytes values = 3;
}

message ParisPagination {
message PairsPagination {
bytes next_key = 1;
sint64 limit = 2;
}
Expand Down
20 changes: 4 additions & 16 deletions types/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +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;
}

message DepositRequest {
bytes pubkey = 1;
H256 withdrawal_credentials = 2;
uint64 amount = 3;
bytes signature = 4;
uint64 index = 5;
}

message WithdrawalRequest {
H160 source_address = 1;
bytes validator_pubkey = 2;
uint64 amount = 3;
}

message Withdrawal {
Expand All @@ -110,6 +94,10 @@ message BlobsBundleV1 {
repeated bytes proofs = 3;
}

message RequestsBundle {
repeated bytes requests = 1;
}

// End of Engine API types
// ------------------------------------------------------------------------

Expand Down

0 comments on commit c5606cf

Please sign in to comment.