Skip to content

Commit

Permalink
Convert streamID and channelID => uint64
Browse files Browse the repository at this point in the history
  • Loading branch information
samsondav committed Jan 26, 2024
1 parent b6c9370 commit 33b81e8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions llo/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,16 @@ const (
// Solana, CosmWasm, kalechain, etc... all go here
)

// MakeChannelHash is used for mapping ChannelDefinitionWithIDs
func MakeChannelHash(cd ChannelDefinitionWithID) ChannelHash {
h := sha256.New()
h.Write(cd.ChannelID[:])
binary.Write(h, binary.BigEndian, cd.ChannelID)
binary.Write(h, binary.BigEndian, uint32(len(cd.ReportFormat)))

Check failure on line 102 in llo/plugin.go

View workflow job for this annotation

GitHub Actions / ci-lint

cd.ReportFormat undefined (type ChannelDefinitionWithID has no field or method ReportFormat) (typecheck)
h.Write([]byte(cd.ReportFormat))

Check failure on line 103 in llo/plugin.go

View workflow job for this annotation

GitHub Actions / ci-lint

cd.ReportFormat undefined (type ChannelDefinitionWithID has no field or method ReportFormat) (typecheck)
binary.Write(h, binary.BigEndian, cd.ChainSelector)

Check failure on line 104 in llo/plugin.go

View workflow job for this annotation

GitHub Actions / ci-lint

cd.ChainSelector undefined (type ChannelDefinitionWithID has no field or method ChainSelector) (typecheck)
binary.Write(h, binary.BigEndian, uint32(len(cd.StreamIDs)))

Check failure on line 105 in llo/plugin.go

View workflow job for this annotation

GitHub Actions / ci-lint

cd.StreamIDs undefined (type ChannelDefinitionWithID has no field or method StreamIDs) (typecheck)
for _, stream := range cd.StreamIDs {
binary.Write(h, binary.BigEndian, uint32(len(stream)))
h.Write([]byte(stream))
for _, streamID := range cd.StreamIDs {

Check failure on line 106 in llo/plugin.go

View workflow job for this annotation

GitHub Actions / ci-lint

cd.StreamIDs undefined (type ChannelDefinitionWithID has no field or method StreamIDs) (typecheck)
binary.Write(h, binary.BigEndian, streamID)
}
var result [32]byte
h.Sum(result[:0])
Expand Down Expand Up @@ -498,7 +498,7 @@ func (out *Outcome) ReportableChannels() []commontypes.ChannelID {
}

sort.Slice(result, func(i, j int) bool {
return result[i].Less(result[j])
return result[i] < result[j]
})

return result
Expand Down Expand Up @@ -900,7 +900,7 @@ func subtractChannelDefinitions(minuend commontypes.ChannelDefinitions, subtrahe

// Sort so we return deterministic result
sort.Slice(differenceList, func(i, j int) bool {
return differenceList[i].ChannelID.Less(differenceList[j].ChannelID)
return differenceList[i].ChannelID < differenceList[j].ChannelID
})

if len(differenceList) > limit {
Expand Down

0 comments on commit 33b81e8

Please sign in to comment.