erigon-pulse/interfaces/remote/kv.proto
ledgerwatch df95313a31
Add blockGasLimit to the state stream (#261)
* Remove interfaces for replacement

* Squashed 'interfaces/' content from commit eff9f8f

git-subtree-dir: interfaces
git-subtree-split: eff9f8f7273dda7c78575f2474e3103da61825db

* Add blockGasLimit to the state stream

* Pass blockGasLimit into txpool

* Add NotTooMuchGas bit, refactored promote

* Replace effectiveTip with minTip in the queues and slices

* Fix lint

* Refactor

* Improve terminology of ordering function

* Optimise baseFee change

* cleanup

* Safe operations

* Fix UnsafeAdd

* also print pendingBaseFee

* trace txpool_content

* trace txpool_content

* user sender ID inverted index to speed up txpool_content

* copy rlp from Db

* remove debug printing

* change from string to []byte

* safe storage of sender in the map

* Fix compile

* safe storage of sender in the map

* Print errors

* Prints

* Prints

* Prints

* Change worst function

* Change worst function

* Change worst function

* Change worst function

* Fix minTip

* Fix minTip

* Warn on db error, but not stop

* Fix interface

* More prints

* Cleanup

* Cleanup

* Differentiate baseFee pool

* Bump version of remove KV interface

* Not print every block

* Not print every block

Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local>
Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
2022-01-25 10:20:11 +00:00

110 lines
2.8 KiB
Protocol Buffer

syntax = "proto3";
import "google/protobuf/empty.proto";
import "types/types.proto";
package remote;
option go_package = "./remote;remote";
// Provides methods to access key-value data
service KV {
// Version returns the service version number
rpc Version(google.protobuf.Empty) returns (types.VersionReply);
// Tx exposes read-only transactions for the key-value store
//
// When tx open, client must receive 1 message from server with txID
// When cursor open, client must receive 1 message from server with cursorID
// Then only client can initiate messages from server
rpc Tx(stream Cursor) returns (stream Pair);
rpc StateChanges(StateChangeRequest) returns (stream StateChangeBatch);
}
enum Op {
FIRST = 0;
FIRST_DUP = 1;
SEEK = 2;
SEEK_BOTH = 3;
CURRENT = 4;
LAST = 6;
LAST_DUP = 7;
NEXT = 8;
NEXT_DUP = 9;
NEXT_NO_DUP = 11;
PREV = 12;
PREV_DUP = 13;
PREV_NO_DUP = 14;
SEEK_EXACT = 15;
SEEK_BOTH_EXACT = 16;
OPEN = 30;
CLOSE = 31;
}
message Cursor {
Op op = 1;
string bucketName = 2;
uint32 cursor = 3;
bytes k = 4;
bytes v = 5;
}
message Pair {
bytes k = 1;
bytes v = 2;
uint32 cursorID = 3; // send once after new cursor open
uint64 txID = 4; // send once after tx open. mdbx's tx.ID() - id of write transaction in db - where this changes happened
}
enum Action {
STORAGE = 0; // Change only in the storage
UPSERT = 1; // Change of balance or nonce (and optionally storage)
CODE = 2; // Change of code (and optionally storage)
UPSERT_CODE = 3; // Change in (balance or nonce) and code (and optinally storage)
DELETE = 4; // Account is deleted
}
message StorageChange {
types.H256 location = 1;
bytes data = 2;
}
message AccountChange {
types.H160 address = 1;
uint64 incarnation = 2;
Action action = 3;
bytes data = 4; // nil if there is no UPSERT in action
bytes code = 5; // nil if there is no CODE in action
repeated StorageChange storageChanges = 6;
}
enum Direction {
FORWARD = 0;
UNWIND = 1;
}
// StateChangeBatch - list of StateDiff done in one DB transaction
message StateChangeBatch {
uint64 databaseViewID = 1; // mdbx's tx.ID() - id of write transaction in db - where this changes happened
repeated StateChange changeBatch = 2;
uint64 pendingBlockBaseFee = 3; // BaseFee of the next block to be produced
uint64 blockGasLimit = 4; // GasLimit of the latest block - proxy for the gas limit of the next block to be produced
}
// StateChange - changes done by 1 block or by 1 unwind
message StateChange {
Direction direction = 1;
uint64 blockHeight = 2;
types.H256 blockHash = 3;
repeated AccountChange changes = 4;
repeated bytes txs = 5; // enable by withTransactions=true
}
message StateChangeRequest {
bool withStorage = 1;
bool withTransactions = 2;
}