Skip to content

Commit

Permalink
fix: substrate metadata update event not caught (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpetrun5 authored Jun 28, 2023
1 parent 30feaf1 commit ce0b9bc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion chains/substrate/events/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Retry struct {
}

const (
CodeUpdatedEvent = "System.CodeUpdated"
ParachainUpdatedEvent = "ParachainSystem.ValidationFunctionApplied"
ExtrinsicFailedEvent = "System.ExtrinsicFailed"
ExtrinsicSuccessEvent = "System.ExtrinsicSuccess"
RetryEvent = "SygmaBridge.Retry"
Expand Down
4 changes: 3 additions & 1 deletion chains/substrate/listener/event-handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ func NewSystemUpdateEventHandler(conn ChainConnection) *SystemUpdateEventHandler

func (eh *SystemUpdateEventHandler) HandleEvents(evts []*parser.Event, msgChan chan []*message.Message) error {
for _, e := range evts {
if e.Name == events.CodeUpdatedEvent {
if e.Name == events.ParachainUpdatedEvent {
log.Info().Msgf("Updating substrate metadata")

err := eh.conn.UpdateMetatdata()
if err != nil {
log.Error().Err(err).Msg("Unable to update Metadata")
Expand Down
4 changes: 2 additions & 2 deletions chains/substrate/listener/event-handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (s *SystemUpdateHandlerTestSuite) Test_UpdateMetadataFails() {

evts := []*parser.Event{
{
Name: "System.CodeUpdated",
Name: "ParachainSystem.ValidationFunctionApplied",
},
}
msgChan := make(chan []*message.Message, 1)
Expand All @@ -64,7 +64,7 @@ func (s *SystemUpdateHandlerTestSuite) Test_SuccesfullMetadataUpdate() {
s.conn.EXPECT().UpdateMetatdata().Return(nil)
evts := []*parser.Event{
{
Name: "System.CodeUpdated",
Name: "ParachainSystem.ValidationFunctionApplied",
},
}
msgChan := make(chan []*message.Message, 1)
Expand Down

0 comments on commit ce0b9bc

Please sign in to comment.