Skip to content

Commit

Permalink
feat(relayer): handle fail status (#13493)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey authored Mar 28, 2023
1 parent cb3f7b9 commit dfac2c4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/relayer/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const (
EventStatusNew EventStatus = iota
EventStatusRetriable
EventStatusDone
EventStatusFailed
EventStatusNewOnlyOwner
)

Expand Down
15 changes: 15 additions & 0 deletions packages/relayer/indexer/handle_event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ func Test_canProcessMessage(t *testing.T) {
relayerAddr,
false,
},
{
"cantProcess, eventStatusFailed",
relayer.EventStatusFailed,
common.HexToAddress("0x"),
relayerAddr,
false,
},
{
"canProcess, eventStatusOnlyOwner and relayer address is owner",
relayer.EventStatusNewOnlyOwner,
Expand Down Expand Up @@ -92,6 +99,14 @@ func Test_eventStatusFromMsgHash(t *testing.T) {
nil,
relayer.EventStatusDone,
},
{
"eventStatusFailed",
context.Background(),
nil,
mock.FailSignal,
nil,
relayer.EventStatusFailed,
},
{
"eventStatusNewOnlyOwner, 0GasLimit",
context.Background(),
Expand Down
4 changes: 4 additions & 0 deletions packages/relayer/mock/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ func (b *Bridge) GetMessageStatus(opts *bind.CallOpts, msgHash [32]byte) (uint8,
return uint8(relayer.EventStatusNew), nil
}

if msgHash == FailSignal {
return uint8(relayer.EventStatusFailed), nil
}

return uint8(relayer.EventStatusDone), nil
}

Expand Down

0 comments on commit dfac2c4

Please sign in to comment.