Skip to content

Commit

Permalink
Merge pull request #104 from ethereum-optimism/feature/mininny/audit-18
Browse files Browse the repository at this point in the history
Remove duplicative constants in state.go and fix mismatched page size
  • Loading branch information
mininny authored Jan 15, 2025
2 parents f75a5bc + 056f92e commit 5e1a9ea
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
4 changes: 2 additions & 2 deletions rvgo/fast/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (m *Memory) GetUnaligned(addr uint64, dest []byte) {
p, ok := m.pageLookup(pageIndex)
var d int
if !ok {
l := pageSize - pageAddr
l := PageSize - pageAddr
if l > 32 {
l = 32
}
Expand All @@ -160,7 +160,7 @@ func (m *Memory) GetUnaligned(addr uint64, dest []byte) {
pageAddr = addr & PageAddrMask
p, ok = m.pageLookup(pageIndex)
if !ok {
l := pageSize - pageAddr
l := PageSize - pageAddr
if l > 32 {
l = 32
}
Expand Down
10 changes: 0 additions & 10 deletions rvgo/fast/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ import (
"github.com/ethereum/go-ethereum/crypto"
)

// page size must be at least 32 bytes (one merkle node)
// memory merkleization will look the same regardless of page size past 32.
const (
pageAddrSize = 10
pageKeySize = 64 - pageAddrSize
pageSize = 1 << pageAddrSize
pageAddrMask = pageSize - 1
maxPageCount = 1 << pageKeySize
)

type VMState struct {
Memory *Memory `json:"memory"`

Expand Down

0 comments on commit 5e1a9ea

Please sign in to comment.