-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(relayer): Allow relayer to run in "target single transaction has…
…h" mode (#15546) Co-authored-by: RogerLamTd <[email protected]>
- Loading branch information
1 parent
5192485
commit e500f3d
Showing
7 changed files
with
102 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package processor | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"strings" | ||
|
||
"github.com/ethereum/go-ethereum/accounts/abi" | ||
"github.com/taikoxyz/taiko-mono/packages/relayer/bindings/bridge" | ||
"github.com/taikoxyz/taiko-mono/packages/relayer/pkg/queue" | ||
) | ||
|
||
func (p *Processor) processSingle(ctx context.Context) error { | ||
bridgeAbi, err := abi.JSON(strings.NewReader(bridge.BridgeABI)) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
receipt, err := p.srcEthClient.TransactionReceipt(ctx, *p.targetTxHash) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
for _, log := range receipt.Logs { | ||
topic := log.Topics[0] | ||
|
||
if topic == bridgeAbi.Events["MessageSent"].ID { | ||
event, err := p.destBridge.ParseMessageSent(*log) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
msg := queue.QueueMessageBody{ | ||
ID: 0, | ||
Event: event, | ||
} | ||
|
||
marshalledMsg, err := json.Marshal(msg) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if err := p.processMessage(ctx, queue.Message{ | ||
Body: marshalledMsg, | ||
}); err != nil { | ||
return err | ||
} | ||
} | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters