Skip to content

Commit

Permalink
RawU256 must be big-endian
Browse files Browse the repository at this point in the history
  • Loading branch information
frankbraun committed Jun 22, 2021
1 parent b67e8be commit 7705c27
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion replayer/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package replayer
// RawAddress type for Aurora Engine.
type RawAddress [20]uint8

// RawU256 type for Aurora Engine (little-endian large integer type).
// RawU256 type for Aurora Engine (big-endian large integer type).
type RawU256 [32]uint8
5 changes: 1 addition & 4 deletions replayer/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ func bigIntToRawU256(b *big.Int) (RawU256, error) {
fmt.Errorf("replayer: big.Int cannot be represented as RawU256: %s",
b.String())
}
// convert big-endian to little-endian
for i, j := 0, len(bytes)-1; i < j; i, j = i+1, j-1 {
bytes[i], bytes[j] = bytes[j], bytes[i]
}
// the encoding is already big-endian
copy(res[:], bytes[:])
return res, nil
}
Expand Down

0 comments on commit 7705c27

Please sign in to comment.