@@ -138,11 +138,7 @@ func CreateTraceEnv(chainConfig *params.ChainConfig, chainContext ChainContext,
138
138
log .Error ("Proof for coinbase not available" , "coinbase" , coinbase , "error" , err )
139
139
// but we still mark the proofs map with nil array
140
140
}
141
- wrappedProof := make ([]hexutil.Bytes , len (proof ))
142
- for i , bt := range proof {
143
- wrappedProof [i ] = bt
144
- }
145
- env .Proofs [key ] = wrappedProof
141
+ env .Proofs [key ] = types .WrapProof (proof )
146
142
}
147
143
148
144
return env , nil
@@ -347,10 +343,7 @@ func (env *TraceEnv) getTxResult(state *state.StateDB, index int, block *types.B
347
343
log .Error ("Proof not available" , "address" , addrStr , "error" , err )
348
344
// but we still mark the proofs map with nil array
349
345
}
350
- wrappedProof := make ([]hexutil.Bytes , len (proof ))
351
- for i , bt := range proof {
352
- wrappedProof [i ] = bt
353
- }
346
+ wrappedProof := types .WrapProof (proof )
354
347
env .pMu .Lock ()
355
348
env .Proofs [addrStr ] = wrappedProof
356
349
txStorageTrace .Proofs [addrStr ] = wrappedProof
@@ -412,10 +405,7 @@ func (env *TraceEnv) getTxResult(state *state.StateDB, index int, block *types.B
412
405
log .Error ("Storage proof not available" , "error" , err , "address" , addrStr , "key" , keyStr )
413
406
// but we still mark the proofs map with nil array
414
407
}
415
- wrappedProof := make ([]hexutil.Bytes , len (proof ))
416
- for i , bt := range proof {
417
- wrappedProof [i ] = bt
418
- }
408
+ wrappedProof := types .WrapProof (proof )
419
409
env .sMu .Lock ()
420
410
txm [keyStr ] = wrappedProof
421
411
m [keyStr ] = wrappedProof
@@ -468,11 +458,7 @@ func (env *TraceEnv) fillBlockTrace(block *types.Block) (*types.BlockTrace, erro
468
458
if proof , err := statedb .GetProof (addr ); err != nil {
469
459
log .Error ("Proof for intrinstic address not available" , "error" , err , "address" , addr )
470
460
} else {
471
- wrappedProof := make ([]hexutil.Bytes , len (proof ))
472
- for i , bt := range proof {
473
- wrappedProof [i ] = bt
474
- }
475
- env .Proofs [addr .String ()] = wrappedProof
461
+ env .Proofs [addr .String ()] = types .WrapProof (proof )
476
462
}
477
463
}
478
464
@@ -487,11 +473,7 @@ func (env *TraceEnv) fillBlockTrace(block *types.Block) (*types.BlockTrace, erro
487
473
} else if proof , _ := statedb .GetSecureTrieProof (trie , slot ); err != nil {
488
474
log .Error ("Get storage proof for intrinstic address failed" , "error" , err , "address" , addr , "slot" , slot )
489
475
} else {
490
- wrappedProof := make ([]hexutil.Bytes , len (proof ))
491
- for i , bt := range proof {
492
- wrappedProof [i ] = bt
493
- }
494
- env .StorageProofs [addr .String ()][slot .String ()] = wrappedProof
476
+ env .StorageProofs [addr .String ()][slot .String ()] = types .WrapProof (proof )
495
477
}
496
478
}
497
479
}
0 commit comments