Skip to content

Commit

Permalink
fix panic in load test (#1069)
Browse files Browse the repository at this point in the history
  • Loading branch information
AnieeG authored Jun 21, 2024
1 parent c7472e4 commit acb2d60
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions integration-tests/ccip-tests/load/ccip_loadgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,23 +286,29 @@ func (c *CCIPE2ELoad) Call(_ *wasp.Generator) *wasp.Response {
lggr.Info().Str("tx", sendTx.Hash().Hex()).Msg("waiting for tx to be mined")
ctx, cancel := context.WithTimeout(context.Background(), sourceCCIP.Common.ChainClient.GetNetworkConfig().Timeout.Duration)
defer cancel()
rcpt, err1 := bind.WaitMined(ctx, sourceCCIP.Common.ChainClient.DeployBackend(), sendTx)
if err1 == nil {
hdr, err1 := c.Lane.Source.Common.ChainClient.HeaderByNumber(context.Background(), rcpt.BlockNumber)
if err1 == nil {
txConfirmationTime = hdr.Timestamp
}
rcpt, err := bind.WaitMined(ctx, sourceCCIP.Common.ChainClient.DeployBackend(), sendTx)
if err != nil {
res.Error = fmt.Sprintf("ccip-send request tx not mined, err=%s", err.Error())
res.Failed = true
res.Data = stats.StatusByPhase
return res
}
lggr = lggr.With().Str("Msg Tx", sendTx.Hash().String()).Logger()
var gasUsed uint64
if rcpt != nil {
gasUsed = rcpt.GasUsed
if rcpt == nil {
res.Error = "ccip-send request tx not mined, receipt is nil"
res.Failed = true
res.Data = stats.StatusByPhase
return res
}
hdr, err := c.Lane.Source.Common.ChainClient.HeaderByNumber(context.Background(), rcpt.BlockNumber)
if err == nil && hdr != nil {
txConfirmationTime = hdr.Timestamp
}
lggr = lggr.With().Str("Msg Tx", sendTx.Hash().String()).Logger()
if rcpt.Status != types.ReceiptStatusSuccessful {
stats.UpdateState(&lggr, 0, testreporters.TX, txConfirmationTime.Sub(startTime), testreporters.Failure,
testreporters.TransactionStats{
Fee: fee.String(),
GasUsed: gasUsed,
GasUsed: rcpt.GasUsed,
TxHash: sendTx.Hash().Hex(),
NoOfTokensSent: len(msg.TokenAmounts),
MessageBytesLength: int64(len(msg.Data)),
Expand All @@ -319,7 +325,7 @@ func (c *CCIPE2ELoad) Call(_ *wasp.Generator) *wasp.Response {
stats.UpdateState(&lggr, 0, testreporters.TX, txConfirmationTime.Sub(startTime), testreporters.Success,
testreporters.TransactionStats{
Fee: fee.String(),
GasUsed: gasUsed,
GasUsed: rcpt.GasUsed,
TxHash: sendTx.Hash().Hex(),
NoOfTokensSent: len(msg.TokenAmounts),
MessageBytesLength: int64(len(msg.Data)),
Expand Down

0 comments on commit acb2d60

Please sign in to comment.