diff --git a/x/meshsecurity/keeper/relay.go b/x/meshsecurity/keeper/relay.go index 5f5ead24..366c8d75 100644 --- a/x/meshsecurity/keeper/relay.go +++ b/x/meshsecurity/keeper/relay.go @@ -34,7 +34,7 @@ func (k Keeper) SendPackets(ctx sdk.Context) { k.channelKeeper, channelID, // source channel id types.ConsumerPortID, // source port id - s.GetBytes(), + s.MarshalConsumerPacketData(), k.GetParams(ctx).GetTimeoutPeriod(), ) if err != nil { diff --git a/x/meshsecurity/keeper/valset_updates.go b/x/meshsecurity/keeper/valset_updates.go index 5260fcab..3c8eb79a 100644 --- a/x/meshsecurity/keeper/valset_updates.go +++ b/x/meshsecurity/keeper/valset_updates.go @@ -124,7 +124,7 @@ func (k Keeper) ScheduleModified(ctx sdk.Context, addr sdk.ValAddress) error { func (k Keeper) sendAsync(ctx sdk.Context, op cptypes.PipedValsetOperation, valAddr sdk.ValAddress, packet cptypes.ConsumerPacketData) error { // if op ModuleLogger(ctx).Debug("storing for async update", "operation", int(op), "val", valAddr.String()) - value := packet.GetBytes() + value := packet.MarshalConsumerPacketData() ctx.KVStore(k.memKey).Set(types.BuildPipedValsetOpKey(op, valAddr), value) // and schedule an update callback for all registered contracts var innerErr error diff --git a/x/types/wire.go b/x/types/wire.go index c9f8e2a8..6da90e76 100644 --- a/x/types/wire.go +++ b/x/types/wire.go @@ -5,7 +5,7 @@ import ( "encoding/binary" ) -func (c ConsumerPacketData) GetBytes() []byte { +func (c ConsumerPacketData) MarshalConsumerPacketData() []byte { var bytes []byte bytes = append(bytes, Int32ToBytes(int32(c.Type))...) if c.Type != PipedValsetOperation_VALIDATOR_SLASHED { diff --git a/x/types/wire_test.go b/x/types/wire_test.go index 16d02a17..6473e42f 100644 --- a/x/types/wire_test.go +++ b/x/types/wire_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/require" ) -func TestGetBytesAndGetData(t *testing.T) { +func TestGetBytesAndUnmarshalConsumerPacketData(t *testing.T) { c1 := ConsumerPacketData{ Type: PipedValsetOperation_VALIDATOR_SLASHED, Data: &ConsumerPacketData_SlashPacketData{ @@ -20,7 +20,7 @@ func TestGetBytesAndGetData(t *testing.T) { }, } - data := c1.GetBytes() + data := c1.MarshalConsumerPacketData() c2, err := UnmarshalConsumerPacketData(data) require.NoError(t, err) require.Equal(t, c1, c2) @@ -40,7 +40,7 @@ func TestGetBytesAndGetData(t *testing.T) { }, }, } - data = s1.GetBytes() + data = s1.MarshalConsumerPacketData() s2, err := UnmarshalConsumerPacketData(data) require.NoError(t, err) require.Equal(t, s1, s2)