Skip to content

Commit

Permalink
revert not to parse as json rpc against error of ibchandler.parseXXX
Browse files Browse the repository at this point in the history
Signed-off-by: Daisuke Kanda <[email protected]>
  • Loading branch information
dai1975 committed Jul 8, 2024
1 parent d4020c8 commit 546853b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
9 changes: 3 additions & 6 deletions pkg/relay/ethereum/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ func (chain *Chain) findSentPackets(ctx core.QueryContext, fromHeight uint64) (c

sendPacket, err := chain.ibcHandler.ParseSendPacket(log)
if err != nil {
revertReason, data := chain.parseRpcError(err)
return nil, fmt.Errorf("failed to parse SendPacket event: err=%v, log=%v, reason=%s, data=%s", err, log, revertReason, data)
return nil, fmt.Errorf("failed to parse SendPacket event: err=%v, log=%v", err, log)
}
if sendPacket.SourceChannel != chain.Path().ChannelID || sendPacket.SourcePort != chain.Path().PortID {
continue
Expand Down Expand Up @@ -165,8 +164,7 @@ func (chain *Chain) findRecvPacketEvents(ctx core.QueryContext, fromHeight uint6
for _, log := range logs {
event, err := chain.ibcHandler.ParseRecvPacket(log)
if err != nil {
revertReason, data := chain.parseRpcError(err)
return nil, fmt.Errorf("failed to parse RecvPacket event: err=%v, log=%v, reason%s, data=%s", err, log, revertReason, data)
- return nil, fmt.Errorf("failed to parse RecvPacket event: err=%v, log=%v", err, log)

Check failure on line 167 in pkg/relay/ethereum/events.go

View workflow job for this annotation

GitHub Actions / Test

syntax error: unexpected return, expected expression
}
if event.Packet.DestinationChannel != chain.Path().ChannelID || event.Packet.DestinationPort != chain.Path().PortID {
continue
Expand All @@ -186,8 +184,7 @@ func (chain *Chain) findWriteAckEvents(ctx core.QueryContext, fromHeight uint64)
for _, log := range logs {
event, err := chain.ibcHandler.ParseWriteAcknowledgement(log)
if err != nil {
revertReason, data := chain.parseRpcError(err)
return nil, fmt.Errorf("failed to parse WriteAcknowledgement event: err=%v, log=%v, reason=%s, data=%s", err, log, revertReason, data)
return nil, fmt.Errorf("failed to parse WriteAcknowledgement event: err=%v, log=%v", err, log)
}
if event.DestinationChannel != chain.Path().ChannelID || event.DestinationPortId != chain.Path().PortID {
continue
Expand Down
21 changes: 7 additions & 14 deletions pkg/relay/ethereum/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,29 +70,25 @@ func (c *Chain) parseMsgEventLogs(logs []*types.Log) ([]core.MsgEventLog, error)
case abiGeneratedClientIdentifier.ID:
ev, err := c.ibcHandler.ParseGeneratedClientIdentifier(*log)
if err != nil {
revertReason, data := c.parseRpcError(err)
return nil, fmt.Errorf("failed to parse GeneratedClientIdentifier event: logIndex=%d, log=%v, reason=%s, data=%s", i, log, revertReason, data)
return nil, fmt.Errorf("failed to parse GeneratedClientIdentifier event: logIndex=%d, log=%v", i, log)
}
event = &core.EventGenerateClientIdentifier{ID: ev.ClientId}
case abiGeneratedConnectionIdentifier.ID:
ev, err := c.ibcHandler.ParseGeneratedConnectionIdentifier(*log)
if err != nil {
revertReason, data := c.parseRpcError(err)
return nil, fmt.Errorf("failed to parse GeneratedConnectionIdentifier event: logIndex=%d, log=%v, reason=%s, data=%s", i, log, revertReason, data)
- return nil, fmt.Errorf("failed to parse GeneratedConnectionIdentifier event: logIndex=%d, log=%v", i, log)

Check failure on line 79 in pkg/relay/ethereum/msg.go

View workflow job for this annotation

GitHub Actions / Test

syntax error: unexpected return, expected expression
}
event = &core.EventGenerateConnectionIdentifier{ID: ev.ConnectionId}
case abiGeneratedChannelIdentifier.ID:
ev, err := c.ibcHandler.ParseGeneratedChannelIdentifier(*log)
if err != nil {
revertReason, data := c.parseRpcError(err)
return nil, fmt.Errorf("failed to parse GeneratedChannelIdentifier event: logIndex=%d, log=%v, reason=%s, data=%s", i, log, revertReason, data)
- return nil, fmt.Errorf("failed to parse GeneratedChannelIdentifier event: logIndex=%d, log=%v", i, log)

Check failure on line 85 in pkg/relay/ethereum/msg.go

View workflow job for this annotation

GitHub Actions / Test

syntax error: unexpected return, expected expression
}
event = &core.EventGenerateChannelIdentifier{ID: ev.ChannelId}
case abiSendPacket.ID:
ev, err := c.ibcHandler.ParseSendPacket(*log)
if err != nil {
revertReason, data := c.parseRpcError(err)
return nil, fmt.Errorf("failed to parse SendPacket event: logIndex=%d, log=%v, reason=%s, data=%s", i, log, revertReason, data)
- return nil, fmt.Errorf("failed to parse SendPacket event: logIndex=%d, log=%v", i, log)

Check failure on line 91 in pkg/relay/ethereum/msg.go

View workflow job for this annotation

GitHub Actions / Test

syntax error: unexpected return, expected expression
}
event = &core.EventSendPacket{
Sequence: ev.Sequence,
Expand All @@ -105,8 +101,7 @@ func (c *Chain) parseMsgEventLogs(logs []*types.Log) ([]core.MsgEventLog, error)
case abiRecvPacket.ID:
ev, err := c.ibcHandler.ParseRecvPacket(*log)
if err != nil {
revertReason, data := c.parseRpcError(err)
return nil, fmt.Errorf("failed to parse RecvPacket event: logIndex=%d, log=%v, reason=%s, data=%s", i, log, revertReason, data)
return nil, fmt.Errorf("failed to parse RecvPacket event: logIndex=%d, log=%v", i, log)
}
event = &core.EventRecvPacket{
Sequence: ev.Packet.Sequence,
Expand All @@ -119,8 +114,7 @@ func (c *Chain) parseMsgEventLogs(logs []*types.Log) ([]core.MsgEventLog, error)
case abiWriteAcknowledgement.ID:
ev, err := c.ibcHandler.ParseWriteAcknowledgement(*log)
if err != nil {
revertReason, data := c.parseRpcError(err)
return nil, fmt.Errorf("failed to parse WriteAcknowledgement event: logIndex=%d, log=%v, reason=%s, data=%s", i, log, revertReason, data)
return nil, fmt.Errorf("failed to parse WriteAcknowledgement event: logIndex=%d, log=%v", i, log)
}
event = &core.EventWriteAcknowledgement{
Sequence: ev.Sequence,
Expand All @@ -131,8 +125,7 @@ func (c *Chain) parseMsgEventLogs(logs []*types.Log) ([]core.MsgEventLog, error)
case abiAcknowledgePacket.ID:
ev, err := c.ibcHandler.ParseAcknowledgePacket(*log)
if err != nil {
revertReason, data := c.parseRpcError(err)
return nil, fmt.Errorf("failed to parse AcknowledgePacket event: logIndex=%d, log=%v, reason=%s, data=%s", i, log, revertReason, data)
return nil, fmt.Errorf("failed to parse AcknowledgePacket event: logIndex=%d, log=%v", i, log)
}
event = &core.EventAcknowledgePacket{
Sequence: ev.Packet.Sequence,
Expand Down

0 comments on commit 546853b

Please sign in to comment.