Created
December 11, 2018 11:28
-
-
Save goral09/fef38f8bd630409b7efd253c33acd49b to your computer and use it in GitHub Desktop.
Protobuf message definitions
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
message Deploy { | |
bytes pk = 1; // public key of the deployer | |
int64 timestamp = 2; | |
bytes session_code = 3; | |
bytes payment_code = 4; | |
int64 gas_limit = 5; | |
int64 gas_price = 6; | |
int64 nonce = 7; | |
bytes deploy_sig = 8; // signature over (hash(session code), timestamp) | |
bytes payment_sig = 9; // signature over (hash(payment code), timestamp, gas limit, gas | |
} | |
// Describes operation that are allowed to do on a value under a key. | |
message Op { | |
oneof op_instance { | |
Read_Op read = 1; | |
Write_Op write = 2; | |
Add_Op add = 3; | |
NoOp_Op noop = 4; | |
} | |
} | |
message Read_Op {} | |
message Write_Op {} | |
message Add_Op {} | |
message NoOp_Op {} | |
message Key { | |
oneof key_instance { | |
KeyAccount account = 1; // hash of the key of the account, length 20 bytes | |
KeyHash hash = 2; // hash of the key of the contract, length 32 bytes | |
KeyURef uref = 3; // length 32 bytes TODO: more bytes? | |
} | |
} | |
message KeyAccount { | |
bytes account = 1; | |
} | |
message KeyHash { | |
bytes = 1; | |
} | |
message KeyURef { | |
bytes = 1; | |
} | |
// Things to store under the key in the global state. | |
message Value { | |
oneof value_instance { | |
int32 integer = 1; | |
bytes byte_arr = 2; | |
repeated int32 int_list = 3; | |
string string_val = 4; | |
Account account = 5; | |
Contract contract = 6; | |
} | |
} | |
message Account { | |
bytes pub_key = 1; // Should have 32 elements | |
int64 nonce = 2; | |
repeated Key known_urefs = 3; | |
} | |
message Contract { | |
bytes body = 1; | |
} | |
// Final transformation to the value under the key. | |
// It's the outcome of applying all `op`s | |
message Transform { | |
oneof transform_instance { | |
TransformIdentity identity = 1; | |
TransformAdd add = 2; | |
TransformWrite write = 3; | |
} | |
} | |
message TransformIdentity {} | |
message TransformAdd { | |
int32 value = 1; | |
} | |
message TransformWrite { | |
Value value = 1; | |
} | |
// Models key value pair of (key, op) entry. | |
// Required b/c protobuff doesn't support maps natively | |
message OpEntry { | |
Key key = 1; | |
Op operation = 2; | |
} | |
message TransformEntry { | |
Key key = 1; | |
Transform transform = 2; | |
} | |
// Returned by ExecutionEngine to consensus layer. | |
// (Map[Key, Op], Map[Key, Transform]) pair, describes how the deploy modifies the global state. | |
// op_map and transform_map should be of equal lengths | |
message ExecutonEffect { | |
repeated OpEntry op_map = 1; | |
repeated TransformEntry transform_map = 2; | |
} | |
// Map of effects to execute | |
// Sent from the consensus layer to Execute Engine. | |
// Contains a set of transformations that are safe to apply in parallel, because of their commutative nature. | |
message ExecuteEffects { | |
repeated TransformEntry effects = 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment