From 1a5a788f992f7a23397ea39c8dee2603370bc572 Mon Sep 17 00:00:00 2001 From: Minhyuk Kim Date: Tue, 1 Oct 2024 12:57:38 -0600 Subject: [PATCH] Fix linting --- rvgo/cmd/load_elf.go | 1 + rvgo/cmd/witness.go | 1 + rvgo/fast/memory_test.go | 14 ++++++++++++++ rvgo/fast/state.go | 3 ++- rvgo/fast/state_test.go | 3 ++- 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/rvgo/cmd/load_elf.go b/rvgo/cmd/load_elf.go index 5ef60eb3..1c4410d4 100644 --- a/rvgo/cmd/load_elf.go +++ b/rvgo/cmd/load_elf.go @@ -3,6 +3,7 @@ package cmd import ( "debug/elf" "fmt" + cannon "github.com/ethereum-optimism/optimism/cannon/cmd" "github.com/ethereum-optimism/optimism/cannon/serialize" "github.com/ethereum-optimism/optimism/op-service/ioutil" diff --git a/rvgo/cmd/witness.go b/rvgo/cmd/witness.go index 071ac37a..4941bd03 100644 --- a/rvgo/cmd/witness.go +++ b/rvgo/cmd/witness.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "github.com/urfave/cli/v2" "github.com/ethereum-optimism/asterisc/rvgo/fast" diff --git a/rvgo/fast/memory_test.go b/rvgo/fast/memory_test.go index d5f0258b..0c4a9553 100644 --- a/rvgo/fast/memory_test.go +++ b/rvgo/fast/memory_test.go @@ -173,3 +173,17 @@ func TestMemoryJSON(t *testing.T) { m.GetUnaligned(8, dest[:]) require.Equal(t, uint8(123), dest[0]) } + +func TestMemoryBinary(t *testing.T) { + m := NewMemory() + m.SetUnaligned(8, []byte{123}) + ser := new(bytes.Buffer) + err := m.Serialize(ser) + require.NoError(t, err, "must serialize state") + m2 := NewMemory() + err = m2.Deserialize(ser) + require.NoError(t, err, "must deserialize state") + var dest [1]byte + m.GetUnaligned(8, dest[:]) + require.Equal(t, uint8(123), dest[0]) +} diff --git a/rvgo/fast/state.go b/rvgo/fast/state.go index d9bc56f7..7e598eb5 100644 --- a/rvgo/fast/state.go +++ b/rvgo/fast/state.go @@ -3,9 +3,10 @@ package fast import ( "encoding/binary" "fmt" - "github.com/ethereum-optimism/optimism/cannon/serialize" "io" + "github.com/ethereum-optimism/optimism/cannon/serialize" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" diff --git a/rvgo/fast/state_test.go b/rvgo/fast/state_test.go index 1dac3b81..5581e35b 100644 --- a/rvgo/fast/state_test.go +++ b/rvgo/fast/state_test.go @@ -2,10 +2,11 @@ package fast import ( "bytes" + "testing" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/stretchr/testify/require" - "testing" ) func TestSerializeStateRoundTrip(t *testing.T) {