babylonlabs-io / babylon-staking-indexer

Other
0 stars 2 forks source link

FinalityProviderStateChangeEvent is not parsed correctly #24

Closed gusin13 closed 4 days ago

gusin13 commented 1 month ago

SDK's parse typed event function is not working properly for FinalityProviderStateChangeEvent. I logged the event and I see a weird attribute "mode" which is causing the parser to fail but Babylon is not sending this ref so I am not sure where is that extra attribute coming from which is breaking the parser.

panic: failed to parse typed event: json: error calling MarshalJSON for type json.RawMessage: invalid character 'B' looking for beginning of value

goroutine 1 [running]:
github.com/babylonlabs-io/babylon-staking-indexer/internal/services.(*Service).processEvent(0x14000eac320, {0x107c45970, 0x140013ff420}, {{0x106b5dd78, 0x5}, {{0x14000dc6fc0, 0x37}, {0x14001242680, 0x3, 0x3}}})
    /Users/gusin/Github/labs/cursor-web-repos/babylon-staking-indexer/internal/services/events.go:90 +0x4a4
github.com/babylonlabs-io/babylon-staking-indexer/internal/services.(*Service).StartBbnEventProcessor(0x14000eac320, {0x107c45890?, 0x1097774e0?})
    /Users/gusin/Github/labs/cursor-web-repos/babylon-staking-indexer/internal/services/events.go:49 +0x11c
github.com/babylonlabs-io/babylon-staking-indexer/internal/services.(*Service).StartIndexerSync(0x14000eac320, {0x107c45890, 0x1097774e0})
    /Users/gusin/Github/labs/cursor-web-repos/babylon-staking-indexer/internal/services/service.go:48 +0x58
main.main()
    /Users/gusin/Github/labs/cursor-web-repos/babylon-staking-indexer/cmd/babylon-staking-indexer/main.go:67 +0x2b8
exit status 2
make: *** [run-local] Error 1

{"level":"debug","raw_event":{"type":"babylon.btcstaking.v1.EventFinalityProviderStatusChange","attributes":[{"key":"btc_pk","value":"\"9b41bd6b26586e5e52c7dedb4c75a5b461fce14bfe80f8dee37ad61e5f0887a1\"","index":true},{"key":"new_state","value":"\"FINALITY_PROVIDER_STATUS_ACTIVE\"","index":true},{"key":"mode","value":"BeginBlock","index":true}