@@ -59,6 +59,8 @@ typedef union pc_pub_key
59
59
uint64_t k8_ [PC_PUBKEY_SIZE_64 ];
60
60
} pc_pub_key_t ;
61
61
62
+ static_assert ( sizeof ( pc_pub_key_t ) == 32 , "" );
63
+
62
64
// account header information
63
65
typedef struct pc_acc
64
66
{
@@ -68,6 +70,8 @@ typedef struct pc_acc
68
70
uint32_t size_ ; // size of populated region of account
69
71
} pc_acc_t ;
70
72
73
+ static_assert ( sizeof ( pc_acc_t ) == 16 , "" );
74
+
71
75
// hash table of symbol to price account mappings
72
76
typedef struct pc_map_table
73
77
{
@@ -81,13 +85,17 @@ typedef struct pc_map_table
81
85
pc_pub_key_t prod_ [PC_MAP_TABLE_SIZE ]; // product accounts
82
86
} pc_map_table_t ;
83
87
88
+ static_assert ( sizeof ( pc_map_table_t ) == 20536 , "" );
89
+
84
90
// variable length string
85
91
typedef struct pc_str
86
92
{
87
93
uint8_t len_ ;
88
94
char data_ [];
89
95
} pc_str_t ;
90
96
97
+ static_assert ( sizeof ( pc_str_t ) == 1 , "" );
98
+
91
99
// product reference data
92
100
typedef struct pc_prod
93
101
{
@@ -100,6 +108,8 @@ typedef struct pc_prod
100
108
// stored as strings (pc_str_t)
101
109
} pc_prod_t ;
102
110
111
+ static_assert ( sizeof ( pc_prod_t ) == 48 , "" );
112
+
103
113
// price et al. for some component or aggregate
104
114
typedef struct pc_price_info
105
115
{
@@ -110,6 +120,8 @@ typedef struct pc_price_info
110
120
uint64_t pub_slot_ ; // publish slot of price
111
121
} pc_price_info_t ;
112
122
123
+ static_assert ( sizeof ( pc_price_info_t ) == 32 , "" );
124
+
113
125
// published component price for contributing provider
114
126
typedef struct pc_price_comp
115
127
{
@@ -118,6 +130,8 @@ typedef struct pc_price_comp
118
130
pc_price_info_t latest_ ; // latest contributed prices
119
131
} pc_price_comp_t ;
120
132
133
+ static_assert ( sizeof ( pc_price_comp_t ) == 96 , "" );
134
+
121
135
// time-weighted exponential moving average
122
136
typedef struct pc_ema
123
137
{
@@ -126,6 +140,8 @@ typedef struct pc_ema
126
140
int64_t denom_ ; // denominator at full precision
127
141
} pc_ema_t ;
128
142
143
+ static_assert ( sizeof ( pc_ema_t ) == 24 , "" );
144
+
129
145
// price account containing aggregate and all component prices
130
146
typedef struct pc_price
131
147
{
@@ -153,6 +169,8 @@ typedef struct pc_price
153
169
pc_price_comp_t comp_ [PC_COMP_SIZE ];// component prices
154
170
} pc_price_t ;
155
171
172
+ static_assert ( sizeof ( pc_price_t ) == 3312 , "" );
173
+
156
174
// command enumeration
157
175
typedef enum {
158
176
@@ -229,19 +247,25 @@ typedef struct cmd_hdr
229
247
int32_t cmd_ ;
230
248
} cmd_hdr_t ;
231
249
250
+ static_assert ( sizeof ( cmd_hdr_t ) == 8 , "" );
251
+
232
252
typedef struct cmd_add_product
233
253
{
234
254
uint32_t ver_ ;
235
255
int32_t cmd_ ;
236
256
} cmd_add_product_t ;
237
257
258
+ static_assert ( sizeof ( cmd_add_product_t ) == 8 , "" );
259
+
238
260
typedef struct cmd_upd_product
239
261
{
240
262
uint32_t ver_ ;
241
263
int32_t cmd_ ;
242
264
// set of key-value pairs
243
265
} cmd_upd_product_t ;
244
266
267
+ static_assert ( sizeof ( cmd_upd_product_t ) == 8 , "" );
268
+
245
269
typedef struct cmd_add_price
246
270
{
247
271
uint32_t ver_ ;
@@ -250,6 +274,8 @@ typedef struct cmd_add_price
250
274
uint32_t ptype_ ;
251
275
} cmd_add_price_t ;
252
276
277
+ static_assert ( sizeof ( cmd_add_price_t ) == 16 , "" );
278
+
253
279
typedef struct cmd_init_price
254
280
{
255
281
uint32_t ver_ ;
@@ -258,20 +284,26 @@ typedef struct cmd_init_price
258
284
uint32_t ptype_ ;
259
285
} cmd_init_price_t ;
260
286
287
+ static_assert ( sizeof ( cmd_init_price_t ) == 16 , "" );
288
+
261
289
typedef struct cmd_add_publisher
262
290
{
263
291
uint32_t ver_ ;
264
292
int32_t cmd_ ;
265
293
pc_pub_key_t pub_ ;
266
294
} cmd_add_publisher_t ;
267
295
296
+ static_assert ( sizeof ( cmd_add_publisher_t ) == 40 , "" );
297
+
268
298
typedef struct cmd_del_publisher
269
299
{
270
300
uint32_t ver_ ;
271
301
int32_t cmd_ ;
272
302
pc_pub_key_t pub_ ;
273
303
} cmd_del_publisher_t ;
274
304
305
+ static_assert ( sizeof ( cmd_del_publisher_t ) == 40 , "" );
306
+
275
307
typedef struct cmd_upd_price
276
308
{
277
309
uint32_t ver_ ;
@@ -283,6 +315,8 @@ typedef struct cmd_upd_price
283
315
uint64_t pub_slot_ ;
284
316
} cmd_upd_price_t ;
285
317
318
+ static_assert ( sizeof ( cmd_upd_price_t ) == 40 , "" );
319
+
286
320
typedef struct cmd_upd_test
287
321
{
288
322
uint32_t ver_ ;
@@ -294,6 +328,8 @@ typedef struct cmd_upd_test
294
328
uint64_t conf_ [PC_COMP_SIZE ];
295
329
} cmd_upd_test_t ;
296
330
331
+ static_assert ( sizeof ( cmd_upd_test_t ) == 560 , "" );
332
+
297
333
// structure of clock sysvar account
298
334
typedef struct sysvar_clock
299
335
{
@@ -304,6 +340,8 @@ typedef struct sysvar_clock
304
340
int64_t unix_timestamp_ ;
305
341
} sysvar_clock_t ;
306
342
343
+ static_assert ( sizeof ( sysvar_clock_t ) == 40 , "" );
344
+
307
345
// compare if two pub_keys (accounts) are the same
308
346
inline bool pc_pub_key_equal ( pc_pub_key_t * p1 , pc_pub_key_t * p2 )
309
347
{
0 commit comments