Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: precision issue #493

Merged
merged 5 commits into from
Nov 21, 2024
Merged

fix: precision issue #493

merged 5 commits into from
Nov 21, 2024

Conversation

Mikelle
Copy link
Member

@Mikelle Mikelle commented Nov 20, 2024

Describe your changes

Fixing precision issue

Issue ticket number and link

Fixes #492

Checklist before requesting a review

  • I have added tests that prove my fix is effective or that my feature works
  • I have made corresponding changes to the documentation

@Mikelle Mikelle requested review from ckartik and shaspitz November 20, 2024 18:19
@Mikelle Mikelle self-assigned this Nov 20, 2024
@@ -29,8 +29,8 @@ contract DeployTestnet is Script {
address protocolFeeRecipient = address(
0xfA0B0f5d298d28EFE4d35641724141ef19C05684 // Placeholder for now, L1 preconf.eth address
);
uint16 feePercent = 2;
uint16 providerPenaltyPercent = 5;
uint256 feePercent = 2 * 1e16; // 2%
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The number 1e16 repeats, consider creating a constant.

@@ -194,7 +194,7 @@ contract BidderRegistryTest is Test {

bidderRegistry.openBid(commitmentDigest, 1 ether, bidder, blockNumber);

bidderRegistry.retrieveFunds(nextWindow, commitmentDigest, payable(provider), 100);
bidderRegistry.retrieveFunds(nextWindow, commitmentDigest, payable(provider), 1e18);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be the 1e18 replaced with PERCENT constant?

@@ -269,7 +269,7 @@ contract BidderRegistryTest is Test {
vm.expectRevert(bytes(""));
bytes32 commitmentDigest = keccak256("1234");
bidderRegistry.openBid(commitmentDigest, 1 ether, bidder, blockNumber);
bidderRegistry.retrieveFunds(nextWindow, commitmentDigest, payable(provider),100);
bidderRegistry.retrieveFunds(nextWindow, commitmentDigest, payable(provider),1e18);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same as above.

@@ -287,7 +287,7 @@ contract BidderRegistryTest is Test {
vm.prank(address(this));
bytes32 commitmentDigest = keccak256("1234");
bidderRegistry.openBid(commitmentDigest, 3 ether, bidder, blockNumber);
bidderRegistry.retrieveFunds(nextWindow, commitmentDigest, payable(provider),100);
bidderRegistry.retrieveFunds(nextWindow, commitmentDigest, payable(provider),1e18);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same is here and also in several other places below.

@Mikelle Mikelle force-pushed the fix/492/precision-issue branch from 7bc1f95 to 1dc0fed Compare November 21, 2024 11:17
@Mikelle Mikelle force-pushed the fix/492/precision-issue branch from 1dc0fed to e7e2440 Compare November 21, 2024 11:47
@Mikelle Mikelle requested review from ckartik and mrekucci November 21, 2024 12:13
@Mikelle Mikelle merged commit a529292 into main Nov 21, 2024
6 checks passed
@Mikelle Mikelle deleted the fix/492/precision-issue branch November 21, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Loss of funds due to misplaced PRECISION() in residual bid calculations
3 participants