From 056f92e40612fecd64a97184401c5120a75555e8 Mon Sep 17 00:00:00 2001 From: Minhyuk Kim Date: Fri, 13 Dec 2024 17:06:17 +0900 Subject: [PATCH] Remove duplicative constants in state.go and fix mismatched page size --- rvgo/fast/memory.go | 4 ++-- rvgo/fast/state.go | 10 ---------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/rvgo/fast/memory.go b/rvgo/fast/memory.go index e239fcdd..03e36a4e 100644 --- a/rvgo/fast/memory.go +++ b/rvgo/fast/memory.go @@ -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 } @@ -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 } diff --git a/rvgo/fast/state.go b/rvgo/fast/state.go index 3f970e3f..75b4460a 100644 --- a/rvgo/fast/state.go +++ b/rvgo/fast/state.go @@ -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"`