Skip to content

Commit

Permalink
add register checks
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangchiqing committed Nov 22, 2024
1 parent 99faac8 commit 103f257
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions fvm/evm/offchain/utils/verify.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package utils

import (
"bytes"
"context"
"errors"
"fmt"
"strings"

"github.com/onflow/cadence"
Expand Down Expand Up @@ -124,6 +126,21 @@ func OffchainReplayBackwardCompatibilityTest(
if err != nil {
return err
}

expectedUpdate, ok := updates[k]
if !ok {
return fmt.Errorf("missing update for register %v, %v", k, expectedUpdate)
}

if bytes.Equal(expectedUpdate, v) {
return fmt.Errorf("unexpected update for register %v, expected %v, got %v", k, expectedUpdate, v)
}

delete(updates, k)
}

if len(updates) > 0 {
return fmt.Errorf("missing updates for registers %v", updates)
}

log.Info().Msgf("verified block %d", height)
Expand Down

0 comments on commit 103f257

Please sign in to comment.