Repository navigation
Claim the reward on a mempool order the account won - #42
Open
kabla1696-ctrl wants to merge 1 commit into
Open
kabla1696-ctrl wants to merge 1 commit into
kabla1696-ctrl wants to merge 1 commit into
Conversation
The pallet does not pay a won order on its own. A solver submits a solution, the order waits out its block wait, and then the winner has to call `claim_reward` to collect the reward. The coordinator submits the solution and never claims, so a solver that wins an order is paid nothing and the proposer reclaims the order instead. On the Aglais testnet, decoding every order in `QuantumComputeMempool.JobOrders` at the head block gives 139 orders: none open, 96 expired and 43 closed. All ninety-six of the expired ones have a `first_solution_at`, so a solution was accepted on every one of them, and together they carry 1447 accepted solutions. Each was worth 1 AGLS, so ninety-six AGLS of reward was earned by solvers and never collected. The only orders that paid are the forty-three that closed. Those orders are not unusually hard either: their node counts run from 2 to 96, ninety-six of them have no energy gate at all, and all of them are `Open` mode, which admits any registered solver. The chain client now reads the order first and only submits the claim once the order's wait has elapsed. The order's own timing is on chain, so the coordinator does not have to guess when the wait is over, and a claim made too early is never submitted and costs no fee. The session records the order when a solution is accepted, and the feeder tries the claim on a later poll. A claim that is not ready yet comes back retryable and is tried again. All 541 of the coordinator's tests pass with the change, and the encoding has a test of its own.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The coordinator submits a solution for a mempool order and never claims the
reward, so a solver that wins an order is paid nothing.
What the pallet does
QuantumComputeMempoolpays a won order only when the winner asks for it:submit_solutionaccepts a solution. The order recordsfirst_solution_atand emitsBlockWaitStarted { first_solution_at, closes_at }.block_wait, which is a handful of blocks.claim_reward(order_id). That transfers the rewardfrom the proposer to the winner, credits
Solvers[account].rewards_earned, and closes the order.reclaim_orderand the rewardgoes back to the proposer.
So nothing is paid automatically. A solver that submits a solution and
stops there is paid nothing.
What the coordinator does
submit_mempool_resultsubmits the solution and logs it. There is noclaim_rewardanywhere in the coordinator: the call does not exist in thechain client, it is not encoded, and it is never made.
What it looks like on the chain
Decoding every order in
QuantumComputeMempool.JobOrdersat the headblock on Aglais:
All ninety-six of the expired orders have a
first_solution_at, so asolution was accepted on every one of them, and together they carry 1447
accepted solutions. Each was worth 1 AGLS, so ninety-six AGLS of reward
was earned by solvers and never collected. The only orders that paid are
the forty-three that closed.
The expired orders are not unusually hard either. Their node counts run
from 2 to 96, ninety-six of the hundred and thirty-nine have no energy
gate at all, and all of them are
Openmode, which admits any registeredsolver. The block wait on them is 5 or 10 blocks, so the reward became
claimable long before the orders expired.
The change
encode_claim_reward_callbuilds the call body: the pallet index, thecall index, and the order id.
claim_reward. It reads the order first andonly submits the call once the order's wait has elapsed. The order's
own timing is on chain, so the coordinator does not have to guess when
the wait is over, and a claim made too early is never submitted and
costs no fee.
feeder tries the claim on a later poll. A claim that is not ready yet
comes back retryable and is tried again.
All 541 of the coordinator's tests pass with the change, and the
encoding has a test of its own.
Worth
To a solver that wins an order, the whole reward. On the testnet that
is one AGLS per order, and the market is thin, but the difference is
between being paid and not being paid at all.