Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: address serialization in PayForBlobs event #2786

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
refactor: test
  • Loading branch information
rootulp committed Oct 30, 2023
commit ce15397522896ed94cd233f3463ef16af94f31e0
8 changes: 4 additions & 4 deletions x/blob/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)

// TestPayForBlobs verifies the attributes on the emitted event.
func TestPayForBlobs(t *testing.T) {
k, stateStore := keeper(t)
ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, nil)
Expand All @@ -36,9 +37,9 @@ func TestPayForBlobs(t *testing.T) {
// verify that an event was emitted
events = ctx.EventManager().Events().ToABCIEvents()
assert.Len(t, events, 1)
parsedEvent, err := sdk.ParseTypedEvent(events[0])
protoEvent, err := sdk.ParseTypedEvent(events[0])
require.NoError(t, err)
event, err := ConvertToEventPayForBlobs(parsedEvent)
event, err := convertToEventPayForBlobs(protoEvent)
require.NoError(t, err)

// verify the attributes of the event
Expand All @@ -47,8 +48,7 @@ func TestPayForBlobs(t *testing.T) {
assert.Equal(t, blobSizes, event.BlobSizes)
}

func ConvertToEventPayForBlobs(message proto.Message) (*types.EventPayForBlobs, error) {
// Type assertion to convert proto.Message to *EventPayForBlobs
func convertToEventPayForBlobs(message proto.Message) (*types.EventPayForBlobs, error) {
if event, ok := message.(*types.EventPayForBlobs); ok {
return event, nil
}
Expand Down
Loading