diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index a0a5ea96..2aed5bc8 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,4 @@ # CODEOWNERS: https://help.github.com/articles/about-codeowners/ # Primary repo maintainers -* @P1sar @waymobetta @mpetrun5 @tcar121293 @MakMuftic @nmlinaric @vezenovm +* @mpetrun5 @tcar121293 @MakMuftic @nmlinaric diff --git a/relayer/message/message.go b/relayer/message/message.go index 4d0ffd9f..1859c247 100644 --- a/relayer/message/message.go +++ b/relayer/message/message.go @@ -5,14 +5,16 @@ type Message struct { Source uint8 // Source where message was initiated Destination uint8 // Destination chain of message Data interface{} // Data associated with the message + ID string // ID is used to track and identify message across networks Type MessageType // Message type } -func NewMessage(source, destination uint8, data interface{}, msgType MessageType) *Message { +func NewMessage(source, destination uint8, data interface{}, id string, msgType MessageType) *Message { return &Message{ Source: source, Destination: destination, Data: data, Type: msgType, + ID: id, } } diff --git a/relayer/proposal/proposal.go b/relayer/proposal/proposal.go index 456d5ea8..fc82d9a0 100644 --- a/relayer/proposal/proposal.go +++ b/relayer/proposal/proposal.go @@ -6,13 +6,15 @@ type Proposal struct { Destination uint8 Data interface{} Type ProposalType + MessageID string // MessageID identifies the message that created the proposal } -func NewProposal(source uint8, destination uint8, data interface{}, propType ProposalType) *Proposal { +func NewProposal(source uint8, destination uint8, data interface{}, messageID string, propType ProposalType) *Proposal { return &Proposal{ Source: source, Destination: destination, Data: data, Type: propType, + MessageID: messageID, } } diff --git a/relayer/relayer.go b/relayer/relayer.go index 6f6a10f6..948250c1 100644 --- a/relayer/relayer.go +++ b/relayer/relayer.go @@ -61,11 +61,12 @@ func (r *Relayer) route(msgs []*message.Message) { return } + log := log.With().Uint8("domainID", destChain.DomainID()).Str("messageID", msgs[0].ID).Logger() props := make([]*proposal.Proposal, 0) for _, m := range msgs { prop, err := destChain.ReceiveMessage(m) if err != nil { - log.Err(err).Uint8("domainID", destChain.DomainID()).Msgf("Failed receiving message %+v", m) + log.Err(err).Msgf("Failed receiving message %+v", m) continue } if prop != nil { @@ -78,7 +79,7 @@ func (r *Relayer) route(msgs []*message.Message) { err := destChain.Write(props) if err != nil { - log.Err(err).Uint8("domainID", destChain.DomainID()).Msgf("Failed writing message") + log.Err(err).Msgf("Failed writing message") return } } diff --git a/relayer/relayer_test.go b/relayer/relayer_test.go index ec8ab3ea..aab60835 100644 --- a/relayer/relayer_test.go +++ b/relayer/relayer_test.go @@ -70,6 +70,7 @@ func (s *RouteTestSuite) TestReceiveMessageFails() { func (s *RouteTestSuite) TestAvoidWriteWithoutProposals() { s.mockRelayedChain.EXPECT().ReceiveMessage(gomock.Any()).Return(nil, nil) + s.mockRelayedChain.EXPECT().DomainID().Return(uint8(1)) chains := make(map[uint8]RelayedChain) chains[1] = s.mockRelayedChain relayer := NewRelayer( @@ -105,6 +106,7 @@ func (s *RouteTestSuite) TestWritesToChain() { props[0] = prop s.mockRelayedChain.EXPECT().ReceiveMessage(gomock.Any()).Return(prop, nil) s.mockRelayedChain.EXPECT().Write(props).Return(nil) + s.mockRelayedChain.EXPECT().DomainID().Return(uint8(1)).Times(1) chains := make(map[uint8]RelayedChain) chains[1] = s.mockRelayedChain relayer := NewRelayer(