Skip to content

Commit

Permalink
feat: Unfair fee distribution due to floating
Browse files Browse the repository at this point in the history
However, this if is not good since it invalidates the purpose of the underflow. As a result, I am leaning no fix which is why I didn't fix tests
  • Loading branch information
reednaa committed Apr 30, 2024
1 parent e410087 commit d6f5e01
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/IncentivizedMessageEscrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -810,9 +810,11 @@ abstract contract IncentivizedMessageEscrow is IIncentivizedMessageEscrow, Bytes
// Compute the reward distribution. We need the time it took to deliver the ack back.
uint64 executionTime;
unchecked {
// Underflow is desired in this code chuck. It ensures that the code piece continues working
// past the time when uint64 stops working. *As long as any timedelta is less than uint64.
executionTime = uint64(block.timestamp) - messageExecutionTimestamp;
// If the timestamp between 2 different chains are not synced with eachother
// it may be that messageExecutionTimestamp > block.timestamp.
// If this happened, then the transaction was relayed pretty quickly
// So the source to destination relayer should get the funds.
executionTime = uint64(block.timestamp) > messageExecutionTimestamp ? uint64(block.timestamp) - messageExecutionTimestamp : 0;
}
// The incentive scheme is as follows: When executionTime = targetDelta then
// The rewards are distributed as per the incentive spec. If the time is less, then
Expand Down

0 comments on commit d6f5e01

Please sign in to comment.