Skip to content

Commit

Permalink
fix gasused
Browse files Browse the repository at this point in the history
  • Loading branch information
AnieeG committed Oct 2, 2023
1 parent 83c2271 commit 397b278
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
18 changes: 15 additions & 3 deletions integration-tests/actions/ccip_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1201,12 +1201,16 @@ func (destCCIP *DestCCIPModule) AssertEventExecutionStateChanged(
if err != nil {
lggr.Warn().Msg("Failed to get receipt for ExecStateChanged event")
}
var gasUsed uint64
if receipt != nil {
gasUsed = receipt.GasUsed
}
if abihelpers.MessageExecutionState(e.State) == abihelpers.ExecutionStateSuccess {
reports.UpdatePhaseStats(reqNo, seqNum, testreporters.ExecStateChanged, receivedAt.Sub(timeNow),
testreporters.Success,
testreporters.TransactionStats{
TxHash: vLogs.TxHash.Hex(),
GasUsed: receipt.GasUsed,
GasUsed: gasUsed,
})
return nil
} else {
Expand Down Expand Up @@ -1266,9 +1270,13 @@ func (destCCIP *DestCCIPModule) AssertEventReportAccepted(
if err != nil {
lggr.Warn().Msg("Failed to get receipt for ReportAccepted event")
}
var gasUsed uint64
if receipt != nil {
gasUsed = receipt.GasUsed
}
reports.UpdatePhaseStats(reqNo, seqNum, testreporters.Commit, totalTime, testreporters.Success,
testreporters.TransactionStats{
GasUsed: receipt.GasUsed,
GasUsed: gasUsed,
TxHash: reportAccepted.Raw.TxHash.String(),
CommitRoot: fmt.Sprintf("%x", reportAccepted.Report.MerkleRoot),
})
Expand Down Expand Up @@ -1315,9 +1323,13 @@ func (destCCIP *DestCCIPModule) AssertReportBlessed(
if err != nil {
lggr.Fatal().Err(err).Msg("Failed to get receipt for ReportBlessed event")
}
var gasUsed uint64
if receipt != nil {
gasUsed = receipt.GasUsed
}
reports.UpdatePhaseStats(reqNo, seqNum, testreporters.ReportBlessed, receivedAt.Sub(prevEventAt), testreporters.Success,
testreporters.TransactionStats{
GasUsed: receipt.GasUsed,
GasUsed: gasUsed,
TxHash: vLogs.TxHash.String(),
CommitRoot: fmt.Sprintf("%x", CommitReport.MerkleRoot),
})
Expand Down
6 changes: 5 additions & 1 deletion integration-tests/load/ccip_loadgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,14 @@ func (c *CCIPE2ELoad) Call(_ *wasp.Generator) *wasp.CallResult {
txConfirmationTime = hdr.Timestamp
}
}
var gasUsed uint64
if rcpt != nil {
gasUsed = rcpt.GasUsed
}
c.reports.UpdatePhaseStats(msgSerialNo, 0, testreporters.TX, startTime.Sub(txConfirmationTime), testreporters.Success,
testreporters.TransactionStats{
Fee: fee.String(),
GasUsed: rcpt.GasUsed,
GasUsed: gasUsed,
TxHash: sendTx.Hash().Hex(),
NoOfTokensSent: len(msg.TokenAmounts),
MessageBytesLength: len(msg.Data),
Expand Down

0 comments on commit 397b278

Please sign in to comment.