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

Implements Pre-Confirmations Decay Handling for Smart Contracts #85

Merged
merged 21 commits into from
Mar 10, 2024

Conversation

ckartik
Copy link
Contributor

@ckartik ckartik commented Mar 3, 2024

New Mechanism: Decay Funds Movement (Part 2 of 3)

This PR introduces the 'Decayed Pre-confirmations Reward Logic' Into the smart-contracts workflow
(See Part 1 in mev-commit for backgound)

  • Commitment from the provider will now store the following details:
  • The Decay Timeline Parameters
  • The Block in which the decayed commitment was stored on mev-commit-chain

Funds movement details:

  • The slashing amount will now correspond to the decayed amount of the bid. This is to avoid incentives for the bidder to manipulate the decay timeline and ensure the protocol handles the decayed bid uniformly across modes of fund movement.
  • The reward will now be decayed based on the Oracle driven Decay Percentage, provided in the processBuilderCommitmentForBlockNumber trigger
  • The fee to the protocol will be on the decayed bid amount, not the genesis bid amount (amount specified in bid field)

Rationale for keeping decay computation in the Oracle

  • The long term vision of the mev-commit-chain may involve us moving away from using block timestamps to detect fulfilment of commitments. As such, externalizing the recognition of when a commitment is "recognized allows us to build in extensibility for the future
  • Due to timestamps currently being encoded in Seconds, the granularity of on-chain computation of decay would be lacking, unless we introduce ms timestamps.
  • Given both above considerations, the decision was made to keep decay computation in the Oracle.

Please refer to the diagram below for a visual representation of the process:

Additional Changes Made

  • Revamping of portions of the test suite for simplicity of open-source contribution.

@ckartik ckartik requested a review from shaspitz March 5, 2024 17:47
Copy link
Contributor

@shaspitz shaspitz left a comment

Choose a reason for hiding this comment

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

Nice work!

.github/workflows/node.js.yml Show resolved Hide resolved
contracts/BidderRegistry.sol Outdated Show resolved Hide resolved
contracts/BidderRegistry.sol Outdated Show resolved Hide resolved
contracts/BidderRegistry.sol Outdated Show resolved Hide resolved
contracts/Oracle.sol Outdated Show resolved Hide resolved
contracts/PreConfirmations.sol Show resolved Hide resolved
contracts/PreConfirmations.sol Outdated Show resolved Hide resolved
test/BidderRegistryTest.sol Show resolved Hide resolved
@ckartik ckartik requested review from shaspitz and Mikelle March 7, 2024 18:49
@ckartik ckartik merged commit d2fa528 into main Mar 10, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants