Skip to content
Merged
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
4 changes: 2 additions & 2 deletions deployment/data-feeds/shared/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ func ValidateFeedID(feedID string) error {

// bytes (1-4) are random bytes, so no validation needed

// Validate attribute bucket bytes (5-6)
// Validate attribute bucket bytes (5-6), see domains/data-feeds/cmd/feed_id.go in CLD for more details
attributeBucket := [2]byte{bytes[5], bytes[6]}
attributeBucketHex := hex.EncodeToString(attributeBucket[:])
if attributeBucketHex != "0003" && attributeBucketHex != "0700" {
if attributeBucketHex != "0003" && attributeBucketHex != "0700" && attributeBucketHex != "0201" {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a comment on what these number are

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

return errors.New("invalid attribute bucket bytes")
}

Expand Down
1 change: 1 addition & 0 deletions deployment/data-feeds/shared/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func TestValidateFeedID(t *testing.T) {
}{
{"0x011e22d6bf0003320000000000000000", true}, // valid feed ID
{"0x026d06ebb60700020000000000000000", true}, // valid feed ID
{"0x01ad92ce480201320000000000000000", true}, // valid feed ID
{"0x126d06ebb60700020000000000000000", false}, // invalid feed format
{"0x126d06ebb6000020000000000000000", false}, // invalid attribute bucket
{"126d06ebb6000020000000000000000", false}, // no 0x prefix
Expand Down
Loading