Skip to content

Commit

Permalink
more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
0xnogo committed Nov 8, 2024
1 parent c76deef commit 7a317b3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions execute/exectypes/costly_messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@ func (c *CCIPMessageFeeUSD18Calculator) MessageFeeUSD18(
// message will not be executed (as it will be considered too costly).
c.lggr.Warnw("missing timestamp for message", "messageID", msg.Header.MessageID)
} else {
feeUSD18 = waitBoostedFee(c.now().Sub(timestamp), feeUSD18, c.relativeBoostPerWaitHour)
c.lggr.Warnw("message timestamp", "messageID", msg.Header.MessageID, "timestamp", timestamp)
feeUSD18 = waitBoostedFee(c.lggr, c.now().Sub(timestamp), feeUSD18, c.relativeBoostPerWaitHour)
}
c.lggr.Warnw("message fee", "messageID", msg.Header.MessageID.String(), "fee", feeUSD18,
"linkPriceUSD", linkPriceUSD, "feeValueJuels", msg.FeeValueJuels)
Expand All @@ -331,12 +332,14 @@ func (c *CCIPMessageFeeUSD18Calculator) MessageFeeUSD18(
// At the same time, messages that are slightly underpaid will start going through after waiting for a little bit.
//
// wait_boosted_fee(m) = (1 + (now - m.send_time).hours * RELATIVE_BOOST_PER_WAIT_HOUR) * fee(m)
func waitBoostedFee(waitTime time.Duration, fee *big.Int, relativeBoostPerWaitHour float64) *big.Int {
func waitBoostedFee(lggr logger.Logger, waitTime time.Duration, fee *big.Int, relativeBoostPerWaitHour float64) *big.Int {
k := 1.0 + waitTime.Hours()*relativeBoostPerWaitHour

boostedFee := big.NewFloat(0).Mul(big.NewFloat(k), new(big.Float).SetInt(fee))
res, _ := boostedFee.Int(nil)

lggr.Warnw("waitBoostedFee", "feeBefore", fee, "waitTime", waitTime, "feeAfter", res)

return res
}

Expand Down Expand Up @@ -416,8 +419,10 @@ func (c *CCIPMessageExecCostUSD18Calculator) getFeesUSD18(
dataAvailabilityFee := mathslib.CalculateUsdPerUnitGas(feeComponents.DataAvailabilityFee, nativeTokenPrice.Int)

c.lggr.Warnw("getFeesUSD18", "nativeTokenPrice", nativeTokenPrice,
"feeComponents.ExecutionFee", feeComponents.ExecutionFee, "feeComponents.DataAvailabilityFee",
feeComponents.DataAvailabilityFee, "executionFee", executionFee, "dataAvailabilityFee", dataAvailabilityFee)
"feeComponents.ExecutionFee", feeComponents.ExecutionFee,
"feeComponents.DataAvailabilityFee", feeComponents.DataAvailabilityFee,
"executionFee", executionFee,
"dataAvailabilityFee", dataAvailabilityFee)

return executionFee, dataAvailabilityFee, nil
}
Expand Down

0 comments on commit 7a317b3

Please sign in to comment.