Skip to content

Commit 02c43c2

Browse files
committed
go/consensus/cometbft: Remove unused DecodeEvent method from context
1 parent d217b56 commit 02c43c2

2 files changed

Lines changed: 0 additions & 18 deletions

File tree

go/consensus/cometbft/api/context.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -370,17 +370,6 @@ func (c *Context) HasEvent(app string, kind events.TypedAttribute) bool {
370370
return c.hasEvent(app, kind.EventKind())
371371
}
372372

373-
// DecodeEvent decodes the given raw event as a specific typed event.
374-
func (c *Context) DecodeEvent(index int, ev events.TypedAttribute) error {
375-
raw := c.events[index]
376-
for _, pair := range raw.Attributes {
377-
if events.IsAttributeKind(pair.GetKey(), ev) {
378-
return events.DecodeValue(pair.GetValue(), ev)
379-
}
380-
}
381-
return fmt.Errorf("incompatible event")
382-
}
383-
384373
// ProvableEvents returns the emitted provable events.
385374
func (c *Context) ProvableEvents() []events.Provable {
386375
return c.eventsProvable

go/consensus/cometbft/apps/staking/state/state_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -974,13 +974,6 @@ func TestTransfer(t *testing.T) {
974974
require.EqualValues(*quantity.NewFromUint64(250), a2.General.Balance, "amount in destination account should be correct")
975975
require.Len(ctx.GetEvents(), 1, "one event should be emitted")
976976

977-
var ev staking.TransferEvent
978-
err = ctx.DecodeEvent(0, &ev)
979-
require.NoError(err, "DecodeEvent")
980-
require.EqualValues(addr1, ev.From, "event should have the correct source address")
981-
require.EqualValues(addr2, ev.To, "event should have the correct destination address")
982-
require.EqualValues(*quantity.NewFromUint64(50), ev.Amount, "event should have the correct amount")
983-
984977
// Test min transact balance checks.
985978
err = s.Transfer(ctx, addr1, addr2, quantity.NewFromUint64(101))
986979
require.ErrorIs(err, staking.ErrBalanceTooLow, "Transfer leaving below min transact balance in source")

0 commit comments

Comments
 (0)