@@ -9,84 +9,91 @@ package cgo
9
9
import "C"
10
10
11
11
func CreateFvmMachine (fvmVersion FvmRegisteredVersion , chainEpoch , chainTimestamp , chainId , baseFeeHi , baseFeeLo , baseCircSupplyHi , baseCircSupplyLo , networkVersion uint64 , stateRoot SliceRefUint8 , tracing bool , blockstoreId , externsId uint64 ) (* FvmMachine , error ) {
12
- resp := C .create_fvm_machine (
13
- fvmVersion ,
14
- C .uint64_t (chainEpoch ),
15
- C .uint64_t (chainTimestamp ),
16
- C .uint64_t (chainId ),
17
- C .uint64_t (baseFeeHi ),
18
- C .uint64_t (baseFeeLo ),
19
- C .uint64_t (baseCircSupplyHi ),
20
- C .uint64_t (baseCircSupplyLo ),
21
- C .uint32_t (networkVersion ),
22
- stateRoot ,
23
- C .bool (tracing ),
24
- C .uint64_t (blockstoreId ),
25
- C .uint64_t (externsId ),
26
- )
12
+ resp := & resultFvmMachine {
13
+ delegate : C .create_fvm_machine (
14
+ fvmVersion ,
15
+ C .uint64_t (chainEpoch ),
16
+ C .uint64_t (chainTimestamp ),
17
+ C .uint64_t (chainId ),
18
+ C .uint64_t (baseFeeHi ),
19
+ C .uint64_t (baseFeeLo ),
20
+ C .uint64_t (baseCircSupplyHi ),
21
+ C .uint64_t (baseCircSupplyLo ),
22
+ C .uint32_t (networkVersion ),
23
+ stateRoot ,
24
+ C .bool (tracing ),
25
+ C .uint64_t (blockstoreId ),
26
+ C .uint64_t (externsId ),
27
+ ),
28
+ }
27
29
// take out the pointer from the result to ensure it doesn't get freed
28
- executor := resp .value
29
- resp .value = nil
30
+ executor := resp .delegate . value
31
+ resp .delegate . value = nil
30
32
defer resp .destroy ()
31
33
32
34
if err := CheckErr (resp ); err != nil {
33
35
return nil , err
34
36
}
35
37
36
- return executor , nil
38
+ return & FvmMachine { delegate : executor } , nil
37
39
}
38
40
39
41
func CreateFvmDebugMachine (fvmVersion FvmRegisteredVersion , chainEpoch , chainTimestamp , chainId , baseFeeHi , baseFeeLo , baseCircSupplyHi , baseCircSupplyLo , networkVersion uint64 , stateRoot SliceRefUint8 , actorRedirect SliceRefUint8 , tracing bool , blockstoreId , externsId uint64 ) (* FvmMachine , error ) {
40
- resp := C .create_fvm_debug_machine (
41
- fvmVersion ,
42
- C .uint64_t (chainEpoch ),
43
- C .uint64_t (chainTimestamp ),
44
- C .uint64_t (chainId ),
45
- C .uint64_t (baseFeeHi ),
46
- C .uint64_t (baseFeeLo ),
47
- C .uint64_t (baseCircSupplyHi ),
48
- C .uint64_t (baseCircSupplyLo ),
49
- C .uint32_t (networkVersion ),
50
- stateRoot ,
51
- actorRedirect ,
52
- C .bool (tracing ),
53
- C .uint64_t (blockstoreId ),
54
- C .uint64_t (externsId ),
55
- )
42
+ resp := & resultFvmMachine {
43
+ delegate : C .create_fvm_debug_machine (
44
+ fvmVersion ,
45
+ C .uint64_t (chainEpoch ),
46
+ C .uint64_t (chainTimestamp ),
47
+ C .uint64_t (chainId ),
48
+ C .uint64_t (baseFeeHi ),
49
+ C .uint64_t (baseFeeLo ),
50
+ C .uint64_t (baseCircSupplyHi ),
51
+ C .uint64_t (baseCircSupplyLo ),
52
+ C .uint32_t (networkVersion ),
53
+ stateRoot ,
54
+ actorRedirect ,
55
+ C .bool (tracing ),
56
+ C .uint64_t (blockstoreId ),
57
+ C .uint64_t (externsId ),
58
+ ),
59
+ }
56
60
// take out the pointer from the result to ensure it doesn't get freed
57
- executor := resp .value
58
- resp .value = nil
61
+ executor := resp .delegate . value
62
+ resp .delegate . value = nil
59
63
defer resp .destroy ()
60
64
61
65
if err := CheckErr (resp ); err != nil {
62
66
return nil , err
63
67
}
64
68
65
- return executor , nil
69
+ return & FvmMachine { delegate : executor } , nil
66
70
}
67
71
68
72
func FvmMachineExecuteMessage (executor * FvmMachine , message SliceRefUint8 , chainLen , applyKind uint64 ) (FvmMachineExecuteResponseGo , error ) {
69
- resp := C .fvm_machine_execute_message (
70
- executor ,
71
- message ,
72
- C .uint64_t (chainLen ),
73
- C .uint64_t (applyKind ),
74
- )
73
+ resp := & resultFvmMachineExecuteResponse {
74
+ delegate : C .fvm_machine_execute_message (
75
+ executor .delegate ,
76
+ message ,
77
+ C .uint64_t (chainLen ),
78
+ C .uint64_t (applyKind ),
79
+ ),
80
+ }
75
81
defer resp .destroy ()
76
82
77
83
if err := CheckErr (resp ); err != nil {
78
84
return FvmMachineExecuteResponseGo {}, err
79
85
}
80
86
81
- return resp .value .copy (), nil
87
+ response := & FvmMachineExecuteResponse {delegate : & resp .delegate .value }
88
+ return response .copy (), nil
82
89
}
83
90
84
91
func FvmMachineFlush (executor * FvmMachine ) ([]byte , error ) {
85
- resp := C .fvm_machine_flush (executor )
92
+ resp := & resultSliceBoxedUint8 { delegate : C .fvm_machine_flush (executor . delegate )}
86
93
defer resp .destroy ()
87
94
88
95
if err := CheckErr (resp ); err != nil {
89
96
return nil , err
90
97
}
91
- return resp .value .copy (), nil
98
+ return SliceBoxedUint8 { delegate : resp .delegate . value } .copy (), nil
92
99
}
0 commit comments