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

BM-606: Set price to zero after lock deadline #378

Merged
merged 14 commits into from
Mar 9, 2025

Conversation

nategraf
Copy link
Member

@nategraf nategraf commented Mar 7, 2025

In recent work, we split the request timeout into two parts: a lock timeout and a timeout. In particular, the lock timeout is the moment where any prover that has locked the request is considered to have failed their obligation, loses exclusivity, and is slashable.

On main right now, the price of a request continues to increase during the locked period, and so if the lock expires it is likely that the price has increased to maxPrice (and more generally, it is no less than the original lockin price). Because of exclusivity, if a prover submits their bid, there is no opportunity for other provers to indicate their bid until the lock has expired, and the price may have risen past where they would have bid. This impacts price discovery, and can cause the client to end up paying more than the "true" market price defined as the minimum price that a prover capable of filling the request would accept. Note that this "true" price is not directly observable.

Adding to this, since (unburned portion of) the stake is added to the reward to any prover that fulfills after the lock deadline, in the case that the locked prover fails, there is some notion that if the stake is high enough, the stake alone is sufficient to motivate a prover to fill the request. It is likely that this is the case for a large class of requests.

After much discussion, we've decided to address the issue above by setting the price paid by the client for a request delivered after the lock deadline and before the final request deadline to zero. As a reward, the prover will still obtain any unburned stake taken from a prover that failed the request, if another prover previously locked it.

As with most market mechanisms, it is impossible to tell whether this is the correct choice until we have data from a live market with funds flowing through it. When we have that data, we may revisit this.

Comment on lines 27 to 34
/// @dev Once locked, if a valid proof is not submitted before this deadline, the prover can
/// be "slashed", which refunds the price to the requester and takes the prover stake.
/// Additionally, the fee paid by the client is zero for proofs delivered after this time.
/// Note that after this time, and before `timeout` a proof can still be delivered to fulfill
/// the request.
uint32 lockTimeout;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should also note that if a never locked request is fulfilled before this deadline then they are eligible for payment, if after then not

Copy link
Contributor

Choose a reason for hiding this comment

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

paymentTimeout could be a better name? Though that may miss the nuance that you can still get stake if fulfilling a previously locked request.. naming is hard

Copy link
Member Author

Choose a reason for hiding this comment

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

I've clarified it a bit further in 0e83b9d

Comment on lines +34 to +37
/// @dev After this time the request is considered completely expired and can no longer be
/// fulfilled. After this time, the `slash` action can be completed to finalize the transaction
Copy link
Contributor

Choose a reason for hiding this comment

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

Caveat here is that for all intents and purposes a never locked request is completely expired at lockTimeout time (since there is no incentive to fulfill it after that point). Maybe not necessary to cover here though if we can explain it in the comment around lockTimeout

Copy link
Member Author

Choose a reason for hiding this comment

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

I've tried to make it more explicit in the comment on lock timeout, about no fee being transferred. It's hard to communicate it exactly right because its technical possible to deliver a proof still to have the request marked as fulfilled, and if you are either us (RISC Zero) or an application with strong interests in filling requests related to your protocol, there might be a reason to do so.

@nategraf nategraf force-pushed the victor/zero-price-after-lock-deadline branch from 66a1721 to 456263a Compare March 8, 2025 04:05
Copy link

github-actions bot commented Mar 8, 2025

🚀 Documentation Preview

Deployment URL: https://boundless-documentation-eyu7knuyl-risczero.vercel.app

Updated at: 2025-03-08 22:23:06 UTC

@nategraf nategraf force-pushed the victor/zero-price-after-lock-deadline branch 2 times, most recently from 0e83b9d to 424a15f Compare March 8, 2025 06:38
@willpote
Copy link
Contributor

willpote commented Mar 8, 2025

One thought, when we validate the offer should be check that that rampUpPeriod is <= lockTimeout? With the new design I don't see a reason to ever ramp up beyond that point

@nategraf nategraf force-pushed the victor/zero-price-after-lock-deadline branch from 46f9532 to cd3faf2 Compare March 8, 2025 22:10
Base automatically changed from victor/bm-416-use-timestamps-instead-of-block-numbers-for-request to main March 8, 2025 22:14
@nategraf nategraf marked this pull request as ready for review March 8, 2025 22:14
add more explicit comments on locktimeout

fix up balances in tests

update snapshots

some missed reference to blocks and constants

fix up issues with moving a function
@nategraf nategraf force-pushed the victor/zero-price-after-lock-deadline branch from b9eb323 to c1340b4 Compare March 8, 2025 22:20
@github-actions github-actions bot changed the title Set price to zero after lock deadline BM-606: Set price to zero after lock deadline Mar 8, 2025
@nategraf
Copy link
Member Author

nategraf commented Mar 9, 2025

This PR is finally ready for another look and to merge

@willpote willpote enabled auto-merge (squash) March 9, 2025 18:31
@willpote willpote merged commit c44c04f into main Mar 9, 2025
16 checks passed
@willpote willpote deleted the victor/zero-price-after-lock-deadline branch March 9, 2025 18:48
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.

2 participants