Skip to content

Commit 22656e6

Browse files
authored
Merge pull request #6510 from oasisprotocol/peternose/bugfix/incomming-msgs
go/consensus/cometbft/apps/roothash: Validate runtime ID of messages
2 parents 9a01f1a + fd75479 commit 22656e6

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

.changelog/6510.bugfix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
go/consensus/cometbft/apps/roothash: Validate runtime ID of messages

go/consensus/cometbft/apps/roothash/state/state.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,8 @@ func (s *ImmutableState) IncomingMessageQueueMeta(ctx context.Context, runtimeID
244244

245245
// IncomingMessageQueue returns a list of queued messages, starting with the passed offset.
246246
func (s *ImmutableState) IncomingMessageQueue(ctx context.Context, runtimeID common.Namespace, offset uint64, limit uint32) ([]*message.IncomingMessage, error) {
247+
hashedRuntimeID := keyformat.PreHashed(runtimeID.Hash())
248+
247249
it := s.state.NewIterator(ctx)
248250
defer it.Close()
249251

@@ -256,6 +258,9 @@ func (s *ImmutableState) IncomingMessageQueue(ctx context.Context, runtimeID com
256258
if !inMsgQueueKeyFmt.Decode(it.Key(), &decRuntimeID, &decID) {
257259
break
258260
}
261+
if decRuntimeID != hashedRuntimeID {
262+
break
263+
}
259264
if decID < offset {
260265
continue
261266
}

0 commit comments

Comments
 (0)