Skip to content

Commit

Permalink
fix: attribute decoding in cometbft v0.38
Browse files Browse the repository at this point in the history
  • Loading branch information
boojamya committed Nov 13, 2024
1 parent b4df4de commit 72a4ab3
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions noble/message_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,9 @@ func txToMessageState(tx *ctypes.ResultTx) ([]*types.MessageState, error) {
var parsed bool
var parseErrs error
for _, attr := range event.Attributes {
decodedKey, err := base64.StdEncoding.DecodeString(attr.Key)
if err != nil {
parseErrs = errors.Join(parseErrs, fmt.Errorf("failed to decode attribute key: %w", err))
}
decodedKey := attr.Key
if string(decodedKey) == "message" {

Check failure on line 31 in noble/message_state.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unnecessary conversion (unconvert)
decodedValue, err := base64.StdEncoding.DecodeString(attr.Value)
if err != nil {
parseErrs = errors.Join(parseErrs, fmt.Errorf("error decoding attr.value: %w", err))
continue
}
decodedValue := attr.Value
encoded := decodedValue[1 : len(decodedValue)-1]
// Because we are using cometBFT v0.38, we need to decode the value twice.
rawMessageSentBytes, err := base64.StdEncoding.DecodeString(string(encoded))

Check failure on line 35 in noble/message_state.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unnecessary conversion (unconvert)
Expand Down

0 comments on commit 72a4ab3

Please sign in to comment.