-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.x
152 lines (114 loc) · 3.26 KB
/
test.x
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
140
141
142
143
144
145
146
147
148
149
150
151
152
%#include "common.x"
namespace mazzaroth
{
typedef opaque Signature[64];
typedef opaque ID[32];
typedef opaque Hash[32];
typedef opaque Parameter<>;
// A transaction that calls a function on a user defined contract.
struct Call
{
// Contract function to execute.
string function<256>;
// Parameters to the contract function. The serialization format is defined
// by the contract itself.
Parameter parameters<>;
};
// A transaction that provides a contract as a wasm binary.
struct Update
{
// Contract binary bytes.
opaque contract<>;
};
enum ActionCategoryType
{
NONE = 0,
CALL = 1,
UPDATE = 2
};
union ActionCategory switch (ActionCategoryType Type)
{
case NONE:
void;
case CALL:
Call call;
case UPDATE:
Update update;
};
// The Action data of a transaction
// Set by the client to form a transaction
struct Action
{
ID channelId;
unsigned hyper nonce;
ActionCategory category;
boolean test_bool;
};
// A transaction that calls a function on a user defined contract.
struct Transaction
{
// Byte array signature of the Transaction bytes signed by the Transaction
// sender's private key.
Signature signature;
// Byte array representing the id of the sender, this also happens
// to be the sender's account public key.
ID address[12];
// The action data for this transaction
Action action<3>;
// The action data for this transaction
int bug_test<>;
};
// A transaction that has been executed, contains a receipt, and is
// ready to be stored in the ledger.
struct CommittedTransaction
{
// The transaction itself
Transaction transaction;
// The execution ordering of the transaction, provided by consensus
unsigned hyper sequenceNumber[12];
// The receipt hash generated by consensus, to be compared to local execution results
ID receiptId[12];
// The transaction merkle root after adding this transaction to the merkle tree, for validation
Hash currentTransactionRoot<23>;
// Consensus signatures
Signature signatures<>;
};
struct TestTable
{
string id<256>;
unsigned hyper nonce;
string info<256>;
hyper list_fixed[3];
hyper list_var<3>;
Call test_struct;
};
struct SecondTable
{
[primary_key]
string fun_id<256>;
unsigned hyper nonce;
string info<256>;
ID test_id;
ID test_id_array[10];
};
enum TestUnionSwitchArrayEnum {
Type_Int = 0,
Type_String = 1,
Type_FixedString = 2,
Type_Array = 3,
Type_Empty = 4
};
union TestUnionSwitchArrayUnion switch (TestUnionSwitchArrayEnum Type)
{
case Type_Int:
hyper anInt;
case Type_String:
string aString<>;
case Type_FixedString:
string fixedString<36>;
case Type_Array:
boolean bools<>;
case Type_Empty:
void;
}
}