Skip to main content

Handle Valid Proof

When a valid proof is routed to a domain via a domainId provided in submitProof the proof is just added to the next aggregation in the given domain and some money are put on hold in the submitter's wallet till the aggregation is published. The submitter's held money will be used to pay the aggregation's publisher: see Publish Attestation to learn more about the aggregation costs. The proof insertion in the aggregation emits a NewProof{statement, domainId, aggregationId} event. The proof submitter should listen to a NewAggregationReceipt{domainId, aggregationId, receipt} event containing his domain and aggregation: this step is important because the user can compute the Merkle path of its proof in the attestation only by providing the block where this event was emitted: the path can be computed by the aggregate_statementPath RPC call.

That's the happy path, let's now take a look to what happens in the other situtations. If something goes wrong, the submitProof extrisic doesn't fail, but just emits a CannotAggregate{statement, cause} event with one of the following causes:

  • DomainNotRegistered{domainId}: if the submitter has provided an invalid domainId.
  • InvalidDomainState{domainId, state}: the domain is not ready to accept any other proof.
  • DomainStorageFull{domainId}: if the domain queue is full, in this case no proof can be added to that domain till at least an aggregation is published.
  • InsufficientFunds: if the submitter account hasn’t enough funds to cover for its contribution to the aggregation's publication.

So, to summarize, the submitter should listen the events generated by submitProof call and catch both:

  • NewProof that is emitted if everything is ok and contains the aggregation coordinates
  • CannotAggregate that is emitted if something has gone wrong and contains the cause of the failure

Proof Submission Costs

Every proof submitter in a given domain DD puts the following money amount AA on hold:

A(a)=Estimate(a)+Tip(a)size(a)A(a) = \frac{Estimate(a) + Tip(a)}{size(a)}

Where

  • aa is the aggregation where the proof is inserted
  • Estimate(a)Estimate(a) is a price estimation for generating the aggregation at the time of the submission
  • Tip(a)Tip(a) is the amount of the tip for the publisher
  • size(a)size(a) the maximum size aggregation that is defined in the domain

Currently

Tip(a)=0.1+0.1Estimate(a)Tip(a) = 0.1 + 0.1 * Estimate(a)