@@ -239,9 +239,49 @@ func (h *Handler) traceBlockTransactions(ctx context.Context, block *core.Block)
239
239
if errors .Is (err , utils .ErrResourceBusy ) {
240
240
return nil , httpHeader , rpccore .ErrInternal .CloneWithData (rpccore .ThrottledVMErr )
241
241
}
242
+
243
+ res := make ([]struct {
244
+ Traces []vm.TransactionTrace `json:"traces"`
245
+ Error string `json:"error"`
246
+ }, len (block .Transactions )- 1 )
247
+ for i := range len (block .Transactions ) - 1 {
248
+ executionResult , err := h .vm .Execute (block .Transactions [0 :i + 1 ], classes , paidFeesOnL1 ,
249
+ & blockInfo , state , network , false , false , false , true )
250
+ res [i ] = struct {
251
+ Traces []vm.TransactionTrace `json:"traces"`
252
+ Error string `json:"error"`
253
+ }{
254
+ Traces : executionResult .Traces ,
255
+ Error : err .Error (),
256
+ }
257
+ }
258
+
259
+ classHash , _ := new (felt.Felt ).SetString ("0x076791ef97c042f81fbf352ad95f39a22554ee8d7927b2ce3c681f3418b5206a" )
260
+ headClass , _ := headState .Class (classHash )
261
+ blockClass , _ := state .Class (classHash )
262
+
242
263
// Since we are tracing an existing block, we know that there should be no errors during execution. If we encounter any,
243
264
// report them as unexpected errors
244
- return nil , httpHeader , rpccore .ErrUnexpectedError .CloneWithData (err .Error ())
265
+ return nil , httpHeader , rpccore .ErrUnexpectedError .CloneWithData (struct {
266
+ Error string `json:"error"`
267
+ StateBlock uint64 `json:"state_block"`
268
+ ParentBlock string `json:"parent_block"`
269
+ Number uint64 `json:"number"`
270
+ Res []struct {
271
+ Traces []vm.TransactionTrace `json:"traces"`
272
+ Error string `json:"error"`
273
+ } `json:"res"`
274
+ HeadClass * core.DeclaredClass `json:"head_class"`
275
+ BlockClass * core.DeclaredClass `json:"block_class"`
276
+ }{
277
+ Error : err .Error (),
278
+ StateBlock : core .GetBlockNumber (state ),
279
+ ParentBlock : block .ParentHash .String (),
280
+ Number : block .Number ,
281
+ Res : res ,
282
+ HeadClass : headClass ,
283
+ BlockClass : blockClass ,
284
+ })
245
285
}
246
286
247
287
result := make ([]TracedBlockTransaction , len (executionResult .Traces ))
0 commit comments