Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
cam-schultz committed Oct 3, 2023
1 parent 388919a commit 783b9d1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ The relayer consists of the following components:

## Testing

---

### Unit tests

Unit tests can be ran locally by running the command in root of the project:
Expand Down
12 changes: 8 additions & 4 deletions tests/basic_relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func BasicRelay() {
//
// Send a transaction to Subnet A to issue a Warp Message from the Teleporter contract to Subnet B
//
log.Info("Sending transaction from Subnet A to Subnet B")
ctx := context.Background()

relayerCmd, relayerCancel = testUtils.RunRelayerExecutable(ctx, relayerConfigPath)
Expand All @@ -161,14 +162,14 @@ func BasicRelay() {
"sendCrossChainMessage",
teleporterTestUtils.SendCrossChainMessageInput{
DestinationChainID: subnetBInfo.BlockchainID,
DestinationAddress: fundedAddress,
DestinationAddress: teleporterMessage.DestinationAddress,
FeeInfo: teleporterTestUtils.FeeInfo{
ContractAddress: fundedAddress,
Amount: big.NewInt(0),
},
RequiredGasLimit: big.NewInt(1),
AllowedRelayerAddresses: []common.Address{},
Message: []byte{1, 2, 3, 4},
RequiredGasLimit: teleporterMessage.RequiredGasLimit,
AllowedRelayerAddresses: teleporterMessage.AllowedRelayerAddresses,
Message: teleporterMessage.Message,
},
)
Expect(err).Should(BeNil())
Expand Down Expand Up @@ -253,6 +254,7 @@ func BasicRelay() {
//
// Try Relaying Already Delivered Message
//
log.Info("Creating new relayer instance to test already delivered message")
logger := logging.NewLogger(
"awm-relayer",
logging.NewWrappedCore(
Expand All @@ -272,6 +274,7 @@ func BasicRelay() {
relayerCmd, relayerCancel = testUtils.RunRelayerExecutable(ctx, relayerConfigPath)

// We should not receive a new block on subnet B, since the relayer should have seen the Teleporter message was already delivered
log.Info("Waiting for 10s to ensure no new block confirmations on destination chain")
Consistently(newHeadsB, 10*time.Second, 500*time.Millisecond).ShouldNot(Receive())

// Cancel the command and stop the relayer
Expand All @@ -281,6 +284,7 @@ func BasicRelay() {
//
// Validate Received Warp Message Values
//
log.Info("Validating received warp message")
Expect(receivedWarpMessage.SourceChainID).Should(Equal(subnetAInfo.BlockchainID))
addressedPayload, err := warpPayload.ParseAddressedPayload(receivedWarpMessage.Payload)
Expect(err).Should(BeNil())
Expand Down
1 change: 1 addition & 0 deletions tests/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func RunRelayerExecutable(ctx context.Context, relayerConfigPath string) (*exec.
cmdReader, _ := relayerCmd.StdoutPipe()

// Start the command
log.Info("Starting the relayer executable")
err := relayerCmd.Start()
Expect(err).Should(BeNil())

Expand Down

0 comments on commit 783b9d1

Please sign in to comment.