Skip to content

Commit cc119d5

Browse files
committed
feat(fvm): wire return_codec through FFI
Ref: filecoin-project/ref-fvm#2264 Add return_codec to FvmMachineExecuteResponse and populate it from the FVM ApplyRet. The v2/v3 engine adapters default to 0. The Go bindings read it into the ApplyRet.ReturnCodec field.
1 parent 74ba028 commit cc119d5

9 files changed

Lines changed: 983 additions & 935 deletions

File tree

cgo/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ type FvmMachineExecuteResponseGo struct {
110110
FailureInfo string
111111
Events []byte
112112
EventsRoot []byte
113+
ReturnCodec uint64
113114
}
114115

115116
func (ptr SliceBoxedUint8) slice() []byte {

cgo/types_fvm.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,6 @@ func (r FvmMachineExecuteResponse) copy() FvmMachineExecuteResponseGo {
7676
FailureInfo: string((*SliceBoxedUint8)(&r.failure_info).slice()),
7777
Events: (*SliceBoxedUint8)(&r.events).copy(),
7878
EventsRoot: (*SliceBoxedUint8)(&r.events_root).copy(),
79+
ReturnCodec: uint64(r.return_codec),
7980
}
8081
}

fvm.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ func buildResponse(resp cgo.FvmMachineExecuteResponseGo) (*ApplyRet, error) {
178178
FailureInfo: resp.FailureInfo,
179179
EventsRoot: eventsRoot,
180180
EventsBytes: resp.Events,
181+
ReturnCodec: resp.ReturnCodec,
181182
}, nil
182183
}
183184

@@ -206,6 +207,7 @@ type ApplyRet struct {
206207
FailureInfo string
207208
EventsRoot *cid.Cid
208209
EventsBytes []byte
210+
ReturnCodec uint64
209211
}
210212

211213
// NOTE: We only support 64bit platforms

fvm_stub.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ type ApplyRet struct {
6666
FailureInfo string
6767
EventsRoot *cid.Cid
6868
EventsBytes []byte
69+
ReturnCodec uint64
6970
}
7071

7172
// Ensure cgo.Externs referenced to avoid unused import when stubbed

0 commit comments

Comments
 (0)