Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cannon-native): The great MIPS64 migration #11388

Closed
wants to merge 4 commits into from
Closed
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
10 changes: 5 additions & 5 deletions cannon/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ type Proof struct {

OracleKey hexutil.Bytes `json:"oracle-key,omitempty"`
OracleValue hexutil.Bytes `json:"oracle-value,omitempty"`
OracleOffset uint32 `json:"oracle-offset,omitempty"`
OracleOffset uint64 `json:"oracle-offset,omitempty"`
}

type rawHint string
Expand Down Expand Up @@ -270,7 +270,7 @@ func Run(ctx *cli.Context) error {

stopAtAnyPreimage := false
var stopAtPreimageKeyPrefix []byte
stopAtPreimageOffset := uint32(0)
stopAtPreimageOffset := uint64(0)
if ctx.IsSet(RunStopAtPreimageFlag.Name) {
val := ctx.String(RunStopAtPreimageFlag.Name)
parts := strings.Split(val, "@")
Expand All @@ -279,11 +279,11 @@ func Run(ctx *cli.Context) error {
}
stopAtPreimageKeyPrefix = common.FromHex(parts[0])
if len(parts) == 2 {
x, err := strconv.ParseUint(parts[1], 10, 32)
x, err := strconv.ParseUint(parts[1], 10, 64)
if err != nil {
return fmt.Errorf("invalid preimage offset: %w", err)
}
stopAtPreimageOffset = uint32(x)
stopAtPreimageOffset = uint64(x)
}
} else {
switch ctx.String(RunStopAtPreimageTypeFlag.Name) {
Expand Down Expand Up @@ -468,7 +468,7 @@ func Run(ctx *cli.Context) error {
}

lastPreimageKey, lastPreimageValue, lastPreimageOffset := vm.LastPreimage()
if lastPreimageOffset != ^uint32(0) {
if lastPreimageOffset != ^uint64(0) {
if stopAtAnyPreimage {
l.Info("Stopping at preimage read")
break
Expand Down
10 changes: 5 additions & 5 deletions cannon/mipsevm/exec/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
)

type MemTracker interface {
TrackMemAccess(addr uint32)
TrackMemAccess(addr uint64)
}

type MemoryTrackerImpl struct {
memory *memory.Memory
lastMemAccess uint32
lastMemAccess uint64
memProofEnabled bool
memProof [memory.MEM_PROOF_SIZE]byte
}
Expand All @@ -21,9 +21,9 @@ func NewMemoryTracker(memory *memory.Memory) *MemoryTrackerImpl {
return &MemoryTrackerImpl{memory: memory}
}

func (m *MemoryTrackerImpl) TrackMemAccess(effAddr uint32) {
func (m *MemoryTrackerImpl) TrackMemAccess(effAddr uint64) {
if m.memProofEnabled && m.lastMemAccess != effAddr {
if m.lastMemAccess != ^uint32(0) {
if m.lastMemAccess != ^uint64(0) {
panic(fmt.Errorf("unexpected different mem access at %08x, already have access at %08x buffered", effAddr, m.lastMemAccess))
}
m.lastMemAccess = effAddr
Expand All @@ -33,7 +33,7 @@ func (m *MemoryTrackerImpl) TrackMemAccess(effAddr uint32) {

func (m *MemoryTrackerImpl) Reset(enableProof bool) {
m.memProofEnabled = enableProof
m.lastMemAccess = ^uint32(0)
m.lastMemAccess = ^uint64(0)
}

func (m *MemoryTrackerImpl) MemProof() [memory.MEM_PROOF_SIZE]byte {
Expand Down
Loading