@@ -61,6 +61,7 @@ macro_rules! define_index {
61
61
#[ cfg_attr( any( test, feature = "fuzzing" ) , derive( proptest_derive:: Arbitrary ) ) ]
62
62
#[ cfg_attr( any( test, feature = "fuzzing" ) , proptest( no_params) ) ]
63
63
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
64
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
64
65
#[ doc=$comment]
65
66
pub struct $name( pub TableIndex ) ;
66
67
@@ -218,6 +219,7 @@ pub const NO_TYPE_ARGUMENTS: SignatureIndex = SignatureIndex(0);
218
219
#[ cfg_attr( any( test, feature = "fuzzing" ) , derive( proptest_derive:: Arbitrary ) ) ]
219
220
#[ cfg_attr( any( test, feature = "fuzzing" ) , proptest( no_params) ) ]
220
221
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
222
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
221
223
pub struct ModuleHandle {
222
224
/// Index into the `AddressIdentifierIndex`. Identifies module-holding account's address.
223
225
pub address : AddressIdentifierIndex ,
@@ -242,6 +244,7 @@ pub struct ModuleHandle {
242
244
#[ cfg_attr( any( test, feature = "fuzzing" ) , derive( proptest_derive:: Arbitrary ) ) ]
243
245
#[ cfg_attr( any( test, feature = "fuzzing" ) , proptest( no_params) ) ]
244
246
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
247
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
245
248
pub struct StructHandle {
246
249
/// The module that defines the type.
247
250
pub module : ModuleHandleIndex ,
@@ -284,6 +287,7 @@ pub struct StructTypeParameter {
284
287
#[ cfg_attr( any( test, feature = "fuzzing" ) , derive( proptest_derive:: Arbitrary ) ) ]
285
288
#[ cfg_attr( any( test, feature = "fuzzing" ) , proptest( params = "usize" ) ) ]
286
289
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
290
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
287
291
pub struct FunctionHandle {
288
292
/// The module that defines the function.
289
293
pub module : ModuleHandleIndex ,
@@ -302,6 +306,7 @@ pub struct FunctionHandle {
302
306
#[ cfg_attr( any( test, feature = "fuzzing" ) , derive( proptest_derive:: Arbitrary ) ) ]
303
307
#[ cfg_attr( any( test, feature = "fuzzing" ) , proptest( no_params) ) ]
304
308
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
309
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
305
310
pub struct FieldHandle {
306
311
pub owner : StructDefinitionIndex ,
307
312
pub field : MemberCount ,
@@ -315,6 +320,7 @@ pub struct FieldHandle {
315
320
#[ cfg_attr( any( test, feature = "fuzzing" ) , derive( proptest_derive:: Arbitrary ) ) ]
316
321
#[ cfg_attr( any( test, feature = "fuzzing" ) , proptest( no_params) ) ]
317
322
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
323
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
318
324
pub enum StructFieldInformation {
319
325
Native ,
320
326
Declared ( Vec < FieldDefinition > ) ,
@@ -333,6 +339,7 @@ pub enum StructFieldInformation {
333
339
#[ cfg_attr( any( test, feature = "fuzzing" ) , derive( proptest_derive:: Arbitrary ) ) ]
334
340
#[ cfg_attr( any( test, feature = "fuzzing" ) , proptest( no_params) ) ]
335
341
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
342
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
336
343
pub struct StructDefInstantiation {
337
344
pub def : StructDefinitionIndex ,
338
345
pub type_parameters : SignatureIndex ,
@@ -343,6 +350,7 @@ pub struct StructDefInstantiation {
343
350
#[ cfg_attr( any( test, feature = "fuzzing" ) , derive( proptest_derive:: Arbitrary ) ) ]
344
351
#[ cfg_attr( any( test, feature = "fuzzing" ) , proptest( no_params) ) ]
345
352
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
353
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
346
354
pub struct FunctionInstantiation {
347
355
pub handle : FunctionHandleIndex ,
348
356
pub type_parameters : SignatureIndex ,
@@ -358,6 +366,7 @@ pub struct FunctionInstantiation {
358
366
#[ cfg_attr( any( test, feature = "fuzzing" ) , derive( proptest_derive:: Arbitrary ) ) ]
359
367
#[ cfg_attr( any( test, feature = "fuzzing" ) , proptest( no_params) ) ]
360
368
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
369
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
361
370
pub struct FieldInstantiation {
362
371
pub handle : FieldHandleIndex ,
363
372
pub type_parameters : SignatureIndex ,
@@ -369,6 +378,7 @@ pub struct FieldInstantiation {
369
378
#[ cfg_attr( any( test, feature = "fuzzing" ) , derive( proptest_derive:: Arbitrary ) ) ]
370
379
#[ cfg_attr( any( test, feature = "fuzzing" ) , proptest( no_params) ) ]
371
380
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
381
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
372
382
pub struct StructDefinition {
373
383
/// The `StructHandle` for this `StructDefinition`. This has the name and the abilities
374
384
/// for the type.
@@ -402,6 +412,7 @@ impl StructDefinition {
402
412
#[ cfg_attr( any( test, feature = "fuzzing" ) , derive( proptest_derive:: Arbitrary ) ) ]
403
413
#[ cfg_attr( any( test, feature = "fuzzing" ) , proptest( no_params) ) ]
404
414
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
415
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
405
416
pub struct FieldDefinition {
406
417
/// The name of the field.
407
418
pub name : IdentifierIndex ,
@@ -453,6 +464,7 @@ impl std::convert::TryFrom<u8> for Visibility {
453
464
#[ cfg_attr( any( test, feature = "fuzzing" ) , derive( proptest_derive:: Arbitrary ) ) ]
454
465
#[ cfg_attr( any( test, feature = "fuzzing" ) , proptest( params = "usize" ) ) ]
455
466
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
467
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
456
468
pub struct FunctionDefinition {
457
469
/// The prototype of the function (module, name, signature).
458
470
pub function : FunctionHandleIndex ,
@@ -506,6 +518,7 @@ impl FunctionDefinition {
506
518
#[ cfg_attr( any( test, feature = "fuzzing" ) , derive( proptest_derive:: Arbitrary ) ) ]
507
519
#[ cfg_attr( any( test, feature = "fuzzing" ) , proptest( no_params) ) ]
508
520
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
521
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
509
522
pub struct TypeSignature ( pub SignatureToken ) ;
510
523
511
524
// TODO: remove at some point or move it in the front end (language/move-ir-compiler)
@@ -515,6 +528,7 @@ pub struct TypeSignature(pub SignatureToken);
515
528
#[ cfg_attr( any( test, feature = "fuzzing" ) , derive( proptest_derive:: Arbitrary ) ) ]
516
529
#[ cfg_attr( any( test, feature = "fuzzing" ) , proptest( params = "usize" ) ) ]
517
530
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
531
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
518
532
pub struct FunctionSignature {
519
533
/// The list of return types.
520
534
#[ cfg_attr(
@@ -540,6 +554,7 @@ pub struct FunctionSignature {
540
554
#[ cfg_attr( any( test, feature = "fuzzing" ) , derive( proptest_derive:: Arbitrary ) ) ]
541
555
#[ cfg_attr( any( test, feature = "fuzzing" ) , proptest( params = "usize" ) ) ]
542
556
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
557
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
543
558
pub struct Signature (
544
559
#[ cfg_attr(
545
560
any( test, feature = "fuzzing" ) ,
@@ -571,6 +586,7 @@ pub type TypeParameterIndex = u16;
571
586
#[ derive( Debug , Clone , Eq , Copy , Hash , Ord , PartialEq , PartialOrd ) ]
572
587
#[ cfg_attr( any( test, feature = "fuzzing" ) , derive( proptest_derive:: Arbitrary ) ) ]
573
588
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
589
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
574
590
pub enum Ability {
575
591
/// Allows values of types with this ability to be copied, via CopyLoc or ReadRef
576
592
Copy = 0x1 ,
@@ -834,6 +850,7 @@ impl Arbitrary for AbilitySet {
834
850
/// enforced by the verifier.
835
851
#[ derive( Clone , Eq , Hash , Ord , PartialEq , PartialOrd ) ]
836
852
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
853
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
837
854
pub enum SignatureToken {
838
855
/// Boolean, `true` or `false`.
839
856
Bool ,
@@ -1112,6 +1129,7 @@ impl SignatureToken {
1112
1129
/// loader/evauluator
1113
1130
#[ derive( Clone , Debug , Eq , PartialEq , Hash ) ]
1114
1131
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
1132
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
1115
1133
pub struct Constant {
1116
1134
pub type_ : SignatureToken ,
1117
1135
pub data : Vec < u8 > ,
@@ -1122,6 +1140,7 @@ pub struct Constant {
1122
1140
#[ cfg_attr( any( test, feature = "fuzzing" ) , derive( proptest_derive:: Arbitrary ) ) ]
1123
1141
#[ cfg_attr( any( test, feature = "fuzzing" ) , proptest( params = "usize" ) ) ]
1124
1142
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
1143
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
1125
1144
pub struct CodeUnit {
1126
1145
/// List of locals type. All locals are typed.
1127
1146
pub locals : SignatureIndex ,
@@ -1142,6 +1161,7 @@ pub struct CodeUnit {
1142
1161
#[ cfg_attr( any( test, feature = "fuzzing" ) , derive( proptest_derive:: Arbitrary ) ) ]
1143
1162
#[ cfg_attr( any( test, feature = "fuzzing" ) , proptest( no_params) ) ]
1144
1163
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
1164
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
1145
1165
pub enum Bytecode {
1146
1166
/// Pop and discard the value at the top of the stack.
1147
1167
/// The value on the stack must be an copyable type.
@@ -1785,6 +1805,7 @@ impl Bytecode {
1785
1805
/// A CompiledScript defines the constant pools (string, address, signatures, etc.), the handle
1786
1806
/// tables (external code references) and it has a `main` definition.
1787
1807
#[ derive( Clone , Default , Eq , PartialEq , Debug ) ]
1808
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
1788
1809
pub struct CompiledScript {
1789
1810
/// Version number found during deserialization
1790
1811
pub version : u32 ,
@@ -1828,6 +1849,7 @@ impl CompiledScript {
1828
1849
/// A module is published as a single entry and it is retrieved as a single blob.
1829
1850
#[ derive( Clone , Debug , Default , Eq , PartialEq ) ]
1830
1851
#[ cfg_attr( feature = "fuzzing" , derive( arbitrary:: Arbitrary ) ) ]
1852
+ #[ cfg_attr( feature = "wasm" , derive( Serialize , Deserialize ) ) ]
1831
1853
pub struct CompiledModule {
1832
1854
/// Version number found during deserialization
1833
1855
pub version : u32 ,
0 commit comments