Skip to content

Commit dbf350c

Browse files
committed
Merge branch 'master' into safer-ffi
2 parents b31c9e7 + 791b682 commit dbf350c

File tree

4 files changed

+27
-16
lines changed

4 files changed

+27
-16
lines changed

cgo/types.go

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,15 @@ type PoStProofGo struct {
9393

9494
/// FvmMachineExecuteResponse is a go allocated version of `FvmMachineExecuteResponse`.
9595
type FvmMachineExecuteResponseGo struct {
96-
ExitCode uint64
97-
ReturnVal []byte
98-
GasUsed uint64
99-
PenaltyHi uint64
100-
PenaltyLo uint64
101-
MinerTipHi uint64
102-
MinerTipLo uint64
103-
ExecTrace []byte
96+
ExitCode uint64
97+
ReturnVal []byte
98+
GasUsed uint64
99+
PenaltyHi uint64
100+
PenaltyLo uint64
101+
MinerTipHi uint64
102+
MinerTipLo uint64
103+
ExecTrace []byte
104+
FailureInfo string
104105
}
105106

106107
func (ptr SliceBoxedUint8) slice() []byte {
@@ -608,13 +609,14 @@ func (ptr *FvmMachine) Destroy() {
608609

609610
func (r FvmMachineExecuteResponse) copy() FvmMachineExecuteResponseGo {
610611
return FvmMachineExecuteResponseGo{
611-
ExitCode: uint64(r.exit_code),
612-
ReturnVal: r.return_val.copy(),
613-
GasUsed: uint64(r.gas_used),
614-
PenaltyHi: uint64(r.penalty_hi),
615-
PenaltyLo: uint64(r.penalty_lo),
616-
MinerTipHi: uint64(r.miner_tip_hi),
617-
MinerTipLo: uint64(r.miner_tip_lo),
618-
ExecTrace: r.exec_trace.copy(),
612+
ExitCode: uint64(r.exit_code),
613+
ReturnVal: r.return_val.copy(),
614+
GasUsed: uint64(r.gas_used),
615+
PenaltyHi: uint64(r.penalty_hi),
616+
PenaltyLo: uint64(r.penalty_lo),
617+
MinerTipHi: uint64(r.miner_tip_hi),
618+
MinerTipLo: uint64(r.miner_tip_lo),
619+
ExecTrace: r.exec_trace.copy(),
620+
FailureInfo: r.failure_info.copy(),
619621
}
620622
}

fvm.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ func (f *FVM) ApplyMessage(msgBytes []byte, chainLen uint) (*ApplyRet, error) {
113113
MinerPenalty: reformBigInt(resp.PenaltyHi, resp.PenaltyLo),
114114
MinerTip: reformBigInt(resp.MinerTipHi, resp.MinerTipLo),
115115
ExecTraceBytes: resp.ExecTrace,
116+
FailureInfo: resp.FailureInfo,
116117
}, nil
117118
}
118119

@@ -134,6 +135,7 @@ func (f *FVM) ApplyImplicitMessage(msgBytes []byte) (*ApplyRet, error) {
134135
GasUsed: int64(resp.GasUsed),
135136
MinerPenalty: reformBigInt(resp.PenaltyHi, resp.PenaltyLo),
136137
MinerTip: reformBigInt(resp.MinerTipHi, resp.MinerTipLo),
138+
FailureInfo: resp.FailureInfo,
137139
}, nil
138140
}
139141

@@ -154,6 +156,7 @@ type ApplyRet struct {
154156
MinerPenalty abi.TokenAmount
155157
MinerTip abi.TokenAmount
156158
ExecTraceBytes []byte
159+
FailureInfo string
157160
}
158161

159162
// NOTE: We only support 64bit platforms

rust/src/fvm/machine.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ fn fvm_machine_execute_message(
163163
None
164164
};
165165

166+
let failure_info = apply_ret
167+
.failure_info
168+
.map(|info| info.to_string().into_boxed_str().into());
169+
166170
// TODO: use the non-bigint token amount everywhere in the FVM
167171
let penalty: u128 = apply_ret.penalty.try_into().unwrap();
168172
let miner_tip: u128 = apply_ret.miner_tip.try_into().unwrap();
@@ -190,6 +194,7 @@ fn fvm_machine_execute_message(
190194
miner_tip_hi: (miner_tip >> u64::BITS) as u64,
191195
miner_tip_lo: miner_tip as u64,
192196
exec_trace,
197+
failure_info,
193198
})
194199
})
195200
}

rust/src/fvm/types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ pub struct FvmMachineExecuteResponse {
3030
pub miner_tip_hi: u64,
3131
pub miner_tip_lo: u64,
3232
pub exec_trace: Option<c_slice::Box<u8>>,
33+
pub failure_info: Option<str::Box>,
3334
}

0 commit comments

Comments
 (0)