Skip to content

Commit 8f60cea

Browse files
committed
update verifable keys
1 parent 6f82ab8 commit 8f60cea

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

fvm/evm/handler/blockHashList.go

+9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package handler
33
import (
44
"encoding/binary"
55
"fmt"
6+
"strings"
67

78
gethCommon "github.com/onflow/go-ethereum/common"
89

@@ -26,6 +27,14 @@ const (
2627
heightEncodingSize
2728
)
2829

30+
func IsBlockHashListBucketKeyFormat(id flow.RegisterID) bool {
31+
return strings.HasPrefix(id.Key, "BlockHashListBucket")
32+
}
33+
34+
func IsBlockHashListMetaKey(id flow.RegisterID) bool {
35+
return id.Key == blockHashListMetaKey
36+
}
37+
2938
// BlockHashList stores the last `capacity` number of block hashes
3039
//
3140
// Under the hood it breaks the list of hashes into

fvm/evm/offchain/utils/verify.go

+14
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/onflow/flow-go/fvm/environment"
1515
"github.com/onflow/flow-go/fvm/evm"
1616
"github.com/onflow/flow-go/fvm/evm/events"
17+
"github.com/onflow/flow-go/fvm/evm/handler"
1718
"github.com/onflow/flow-go/fvm/evm/offchain/blocks"
1819
evmStorage "github.com/onflow/flow-go/fvm/evm/offchain/storage"
1920
"github.com/onflow/flow-go/fvm/evm/offchain/sync"
@@ -98,6 +99,10 @@ func OffchainReplayBackwardCompatibilityTest(
9899
continue
99100
}
100101

102+
if !verifiableKeys(regID) {
103+
continue
104+
}
105+
101106
// when iterating backwards, duplicated register updates are stale updates,
102107
// so skipping them
103108
if _, ok := expectedUpdates[regID]; !ok {
@@ -152,7 +157,12 @@ func OffchainReplayBackwardCompatibilityTest(
152157
return err
153158
}
154159

160+
if !verifiableKeys(k) {
161+
continue
162+
}
163+
155164
actualUpdates[k] = v
165+
156166
}
157167

158168
err = verifyRegisterUpdates(expectedUpdates, actualUpdates)
@@ -166,6 +176,10 @@ func OffchainReplayBackwardCompatibilityTest(
166176
return nil
167177
}
168178

179+
func verifiableKeys(key flow.RegisterID) bool {
180+
return handler.IsBlockHashListBucketKeyFormat(key) || handler.IsBlockHashListMetaKey(key)
181+
}
182+
169183
func parseEVMEvents(evts flow.EventsList) (*events.BlockEventPayload, []events.TransactionEventPayload, error) {
170184
var blockEvent *events.BlockEventPayload
171185
txEvents := make([]events.TransactionEventPayload, 0)

0 commit comments

Comments
 (0)