eth/tracers: fix memory logging

This commit is contained in:
Gary Rong 2025-03-04 14:29:57 +08:00
parent f853b5dc60
commit e90755697c
2 changed files with 7 additions and 3 deletions

View file

@ -889,11 +889,11 @@ func (api *API) TraceTransaction(ctx context.Context, hash common.Hash, config *
return nil, err
}
defer release()
msg, err := core.TransactionToMessage(tx, types.MakeSigner(api.backend.ChainConfig(), block.Number(), block.Time()), block.BaseFee())
if err != nil {
return nil, err
}
txctx := &Context{
BlockHash: blockHash,
BlockNumber: block.Number(),

View file

@ -179,8 +179,12 @@ func (s *StructLog) toLegacyJSON() json.RawMessage {
}
if len(s.Memory) > 0 {
memory := make([]string, 0, (len(s.Memory)+31)/32)
for i := 0; i+32 <= len(s.Memory); i += 32 {
memory = append(memory, fmt.Sprintf("%x", s.Memory[i:i+32]))
for i := 0; i < len(s.Memory); i += 32 {
end := i + 32
if end > len(s.Memory) {
end = len(s.Memory)
}
memory = append(memory, fmt.Sprintf("%x", s.Memory[i:end]))
}
msg.Memory = &memory
}