-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtypes.proto
139 lines (118 loc) · 3.82 KB
/
types.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
syntax = "proto3";
package spacemesh.v1;
message SimpleInt {
uint64 value = 1;
}
message SimpleString {
string value = 1;
}
// A non-negative coin amount, in smidge
message Amount {
uint64 value = 1;
}
message AccountId {
string address = 1;
}
message TransactionId {
bytes id = 1;
}
message ActivationId {
bytes id = 1;
}
message SmesherId {
bytes id = 1;
}
// An Activation "transaction" (ATX)
message Activation {
ActivationId id = 1;
LayerNumber layer = 2; // the layer that this activation is part of
SmesherId smesher_id = 3; // id of smesher who created the ATX
AccountId coinbase = 4; // coinbase account id
// previous ATX pointed to
// deprecated to support ATX V2 and merging of ATXs: use previous_atxs instead
// a merged ATX might reference multiple previous ATXs
ActivationId prev_atx = 5 [deprecated = true];
uint32 num_units = 6; // number of PoST data commitment units
uint64 sequence = 7;
repeated ActivationId previous_atxs = 8; // previous ATXs
}
// An immutable Spacemesh transaction.
// do not include mutable data such as tx state or result.
message Transaction {
bytes id = 1;
AccountId principal = 2;
AccountId template = 3;
uint32 method = 4; // this is actually limited by uint8, but no type for that.
Nonce nonce = 5;
LayerLimits limits = 6;
uint64 max_gas = 7;
uint64 gas_price = 8;
uint64 max_spend = 9;
bytes raw = 10;
}
message LayerLimits {
uint32 min = 1;
uint32 max = 2;
}
message Nonce {
uint64 counter = 1;
uint32 bitfield = 2; // this is actually limited by uint8, but no type for that.
}
// Transaction that was added to the mesh.
message MeshTransaction {
Transaction transaction = 1;
LayerNumber layer_id = 2;
}
message Reward {
LayerNumber layer = 1; // layer award was paid in
Amount total = 2; // total reward paid (sum of tx fee and layer reward)
Amount layer_reward = 3; // tx_fee = total - layer_reward
LayerNumber layer_computed = 4; // layer number of the layer when reward was computed
AccountId coinbase = 5; // account awarded this reward
SmesherId smesher = 6; // id of smesher who earned this reward
}
message Block {
bytes id = 1; // block hash
repeated Transaction transactions = 2; // block transactions
ActivationId activation_id = 3; // the smesher's activation that this block refers to
SmesherId smesher_id = 4; // the id of the smesher who submitted this block
}
message Layer {
LayerNumber number = 1; // layer number - not hash - layer content may change
enum LayerStatus {
LAYER_STATUS_UNSPECIFIED = 0; // not yet approved or confirmed
LAYER_STATUS_APPROVED = 1; // approved by hare
LAYER_STATUS_CONFIRMED = 2; // confirmed by tortoise
LAYER_STATUS_APPLIED = 3; // applied in state
}
LayerStatus status = 2;
bytes hash = 3; // computer layer hash - do we need this?
repeated Block blocks = 4; // layer's blocks
repeated Activation activations = 5; // list of layer's activations
bytes root_state_hash = 6; // when available - the root state hash of global state in this layer
}
message LayerNumber {
uint32 number = 1;
}
message EpochNumber {
uint32 number = 1;
}
message AppEvent { // an event emitted from an app instance
TransactionId transaction_id = 1; // the transaction that called the code
string message = 2; // the event's string emitted from code
}
message MalfeasanceProof {
SmesherId smesher_id = 1;
LayerNumber layer = 2;
enum MalfeasanceType {
MALFEASANCE_UNSPECIFIED = 0;
MALFEASANCE_ATX = 1;
MALFEASANCE_BALLOT = 2;
MALFEASANCE_HARE = 3;
MALFEASANCE_POST_INDEX = 4;
MALFEASANCE_INCORRECT_PREV_ATX = 5;
}
MalfeasanceType kind = 3;
string debug_info = 4;
bytes proof = 5;
}