-
Notifications
You must be signed in to change notification settings - Fork 11
/
block_engine.proto
98 lines (80 loc) · 3.7 KB
/
block_engine.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
syntax = "proto3";
import "packet.proto";
import "shared.proto";
import "bundle.proto";
package block_engine;
message SubscribePacketsRequest {}
message SubscribePacketsResponse {
shared.Header header = 1;
packet.PacketBatch batch = 2;
}
message SubscribeBundlesRequest {}
message SubscribeBundlesResponse {
repeated bundle.BundleUuid bundles = 1;
}
message BlockBuilderFeeInfoRequest {}
message BlockBuilderFeeInfoResponse {
string pubkey = 1;
// commission (0-100)
uint64 commission = 2;
}
message AccountsOfInterest {
// use * for all accounts
repeated string accounts = 1;
}
message AccountsOfInterestRequest {}
message AccountsOfInterestUpdate {
repeated string accounts = 1;
}
message ProgramsOfInterestRequest {}
message ProgramsOfInterestUpdate {
repeated string programs = 1;
}
// A series of packets with an expiration attached to them.
// The header contains a timestamp for when this packet was generated.
// The expiry is how long the packet batches have before they expire and are forwarded to the validator.
// This provides a more censorship resistant method to MEV than block engines receiving packets directly.
message ExpiringPacketBatch {
shared.Header header = 1;
packet.PacketBatch batch = 2;
uint32 expiry_ms = 3;
}
// Packets and heartbeats are sent over the same stream.
// ExpiringPacketBatches have an expiration attached to them so the block engine can track
// how long it has until the relayer forwards the packets to the validator.
// Heartbeats contain a timestamp from the system and is used as a simple and naive time-sync mechanism
// so the block engine has some idea on how far their clocks are apart.
message PacketBatchUpdate {
oneof msg {
ExpiringPacketBatch batches = 1;
shared.Heartbeat heartbeat = 2;
}
}
message StartExpiringPacketStreamResponse {
shared.Heartbeat heartbeat = 1;
}
/// Validators can connect to Block Engines to receive packets and bundles.
service BlockEngineValidator {
/// Validators can subscribe to the block engine to receive a stream of packets
rpc SubscribePackets (SubscribePacketsRequest) returns (stream SubscribePacketsResponse) {}
/// Validators can subscribe to the block engine to receive a stream of simulated and profitable bundles
rpc SubscribeBundles (SubscribeBundlesRequest) returns (stream SubscribeBundlesResponse) {}
// Block builders can optionally collect fees. This returns fee information if a block builder wants to
// collect one.
rpc GetBlockBuilderFeeInfo (BlockBuilderFeeInfoRequest) returns (BlockBuilderFeeInfoResponse) {}
}
/// Relayers can forward packets to Block Engines.
/// Block Engines provide an AccountsOfInterest field to only send transactions that are of interest.
service BlockEngineRelayer {
/// The block engine feeds accounts of interest (AOI) updates to the relayer periodically.
/// For all transactions the relayer receives, it forwards transactions to the block engine which write-lock
/// any of the accounts in the AOI.
rpc SubscribeAccountsOfInterest (AccountsOfInterestRequest) returns (stream AccountsOfInterestUpdate) {}
rpc SubscribeProgramsOfInterest (ProgramsOfInterestRequest) returns (stream ProgramsOfInterestUpdate) {}
// Validators can subscribe to packets from the relayer and receive a multiplexed signal that contains a mixture
// of packets and heartbeats.
// NOTE: This is a bi-directional stream due to a bug with how Envoy handles half closed client-side streams.
// The issue is being tracked here: https://github.com/envoyproxy/envoy/issues/22748. In the meantime, the
// server will stream heartbeats to clients at some reasonable cadence.
rpc StartExpiringPacketStream (stream PacketBatchUpdate) returns (stream StartExpiringPacketStreamResponse) {}
}