@@ -138,21 +138,23 @@ where
138138 }
139139 }
140140 Err ( ExecutionError :: Fatal ( err) ) => {
141- // // Annotate the error with the message context.
142- // let err = {
143- // let backtrace = String::from("foo"); //e.backtrace().to_string();
144- // // e.context(format!(
145- // // "[from={}, to={}, seq={}, m={}, h={}] fatal error; backtrace: {}",
146- // // msg.from,
147- // // msg.to,
148- // // msg.sequence,
149- // // msg.method_num,
150- // // self.context().epoch,
151- // // backtrace,
152- // // ))
153- // };
141+ // We produce a receipt with SYS_ASSERTION_FAILED exit code, and
142+ // we consume the full gas amount so that, in case of a network-
143+ // wide fatal errors, all nodes behave deterministically.
144+ //
145+ // We set the backtrace from the fatal error to aid diagnosis.
146+ // Note that we use backtrace#set_cause instead of backtrace#begin
147+ // because we want to retain the propagation chain that we've
148+ // accumulated on the way out.
149+ let err = err. context ( format ! (
150+ "[from={}, to={}, seq={}, m={}, h={}]" ,
151+ msg. from,
152+ msg. to,
153+ msg. sequence,
154+ msg. method_num,
155+ self . context( ) . epoch,
156+ ) ) ;
154157 backtrace. set_cause ( backtrace:: Cause :: from_fatal ( err) ) ;
155- // Produce a receipt that consumes the full gas amount.
156158 Receipt {
157159 exit_code : ExitCode :: SYS_ASSERTION_FAILED ,
158160 return_data : Default :: default ( ) ,
0 commit comments