Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

x/evm/types: properly split in 32 chunks trace.Memory #838

Merged
merged 1 commit into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
### Bug Fixes

* (rpc) [tharsis#831](https://github.com/tharsis/ethermint/pull/831) Fix BaseFee value when height is specified.
* (evm) [tharsis#838](https://github.com/tharsis/ethermint/pull/838) Fix splitting of trace.Memory into 32 chunks.

## [v0.9.0] - 2021-12-01

Expand Down
9 changes: 7 additions & 2 deletions x/evm/types/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,13 @@ func FormatLogs(logs []vm.StructLog) []StructLogRes {

if trace.Memory != nil {
memory := make([]string, 0, (len(trace.Memory)+31)/32)
for i := 0; i+32 <= len(trace.Memory); i += 32 {
memory = append(memory, fmt.Sprintf("%x", trace.Memory[i:i+32]))
for i, n := 0, len(trace.Memory); i < n; {
end := i + 32
if end >= n {
end = n
}
memory = append(memory, fmt.Sprintf("%x", trace.Memory[i:end]))
i = end
}
formatted[index].Memory = &memory
}
Expand Down