@@ -183,30 +183,35 @@ where
183183 } = ret;
184184
185185 // Extract the exit code and build the result of the message application.
186- let receipt = match res {
186+ let ( receipt, return_codec ) = match res {
187187 Ok ( InvocationResult { exit_code, value } ) => {
188- // Convert back into a top-level return "value". We throw away the codec here,
189- // unfortunately.
190- let return_data = value
191- . map ( |blk| RawBytes :: from ( blk. data ( ) . to_vec ( ) ) )
192- . unwrap_or_default ( ) ;
188+ let ( return_data, return_codec) = match value {
189+ Some ( blk) => ( RawBytes :: from ( blk. data ( ) . to_vec ( ) ) , Some ( blk. codec ( ) ) ) ,
190+ None => ( RawBytes :: default ( ) , None ) ,
191+ } ;
193192
194193 if exit_code. is_success ( ) {
195194 backtrace. clear ( ) ;
196195 }
196+ (
197+ Receipt {
198+ exit_code,
199+ return_data,
200+ gas_used,
201+ events_root,
202+ } ,
203+ return_codec,
204+ )
205+ }
206+ Err ( ExecutionError :: OutOfGas ) => (
197207 Receipt {
198- exit_code,
199- return_data,
208+ exit_code : ExitCode :: SYS_OUT_OF_GAS ,
209+ return_data : Default :: default ( ) ,
200210 gas_used,
201211 events_root,
202- }
203- }
204- Err ( ExecutionError :: OutOfGas ) => Receipt {
205- exit_code : ExitCode :: SYS_OUT_OF_GAS ,
206- return_data : Default :: default ( ) ,
207- gas_used,
208- events_root,
209- } ,
212+ } ,
213+ None ,
214+ ) ,
210215 Err ( ExecutionError :: Syscall ( err) ) => {
211216 // Errors indicate the message couldn't be dispatched at all
212217 // (as opposed to failing during execution of the receiving actor).
@@ -218,12 +223,15 @@ where
218223 } ;
219224
220225 backtrace. begin ( backtrace:: Cause :: from_syscall ( "send" , "send" , err) ) ;
221- Receipt {
222- exit_code,
223- return_data : Default :: default ( ) ,
224- gas_used,
225- events_root,
226- }
226+ (
227+ Receipt {
228+ exit_code,
229+ return_data : Default :: default ( ) ,
230+ gas_used,
231+ events_root,
232+ } ,
233+ None ,
234+ )
227235 }
228236 Err ( ExecutionError :: Fatal ( err) ) => {
229237 // We produce a receipt with SYS_ASSERTION_FAILED exit code, and
@@ -243,12 +251,15 @@ where
243251 self . context( ) . epoch,
244252 ) ) ;
245253 backtrace. set_cause ( backtrace:: Cause :: from_fatal ( err) ) ;
246- Receipt {
247- exit_code : ExitCode :: SYS_ASSERTION_FAILED ,
248- return_data : Default :: default ( ) ,
249- gas_used : msg. gas_limit ,
250- events_root,
251- }
254+ (
255+ Receipt {
256+ exit_code : ExitCode :: SYS_ASSERTION_FAILED ,
257+ return_data : Default :: default ( ) ,
258+ gas_used : msg. gas_limit ,
259+ events_root,
260+ } ,
261+ None ,
262+ )
252263 }
253264 } ;
254265
@@ -267,6 +278,7 @@ where
267278 gas_cost,
268279 exec_trace,
269280 events,
281+ return_codec,
270282 ) ,
271283 ApplyKind :: Implicit => Ok ( ApplyRet {
272284 msg_receipt : receipt,
@@ -280,6 +292,7 @@ where
280292 failure_info,
281293 exec_trace,
282294 events,
295+ return_codec,
283296 } ) ,
284297 }
285298 }
@@ -472,6 +485,7 @@ where
472485 gas_cost : TokenAmount ,
473486 exec_trace : ExecutionTrace ,
474487 events : Vec < StampedEvent > ,
488+ return_codec : Option < u64 > ,
475489 ) -> anyhow:: Result < ApplyRet > {
476490 // NOTE: we don't support old network versions in the FVM, so we always burn.
477491 let GasOutputs {
@@ -529,6 +543,7 @@ where
529543 failure_info,
530544 exec_trace,
531545 events,
546+ return_codec,
532547 } )
533548 }
534549
0 commit comments