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

[Proof] Implement scalable proof validation #1031

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
759 changes: 723 additions & 36 deletions api/poktroll/proof/event.pulsar.go

Large diffs are not rendered by default.

165 changes: 142 additions & 23 deletions api/poktroll/proof/types.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions proto/poktroll/proof/event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@ message EventProofUpdated {
uint64 num_estimated_compute_units = 5 [(gogoproto.jsontag) = "num_estimated_compute_units"];
cosmos.base.v1beta1.Coin claimed_upokt = 6 [(gogoproto.jsontag) = "claimed_upokt"];
}

// Event emitted after a proof has been checked for validity.
Copy link
Member

Choose a reason for hiding this comment

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

Can you #PUC on when/where this is happening (i.e. end blocker)

message EventProofValidityChecked {
Copy link
Member

Choose a reason for hiding this comment

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

Thoughts on EventProofValidated?

poktroll.proof.Proof proof = 1 [(gogoproto.jsontag) = "proof"];
uint64 block_height = 2 [(gogoproto.jsontag) = "block_height"];
poktroll.proof.ClaimProofStatus proof_status = 3 [(gogoproto.jsontag) = "proof_status"];
string reason = 4 [(gogoproto.jsontag) = "reason"];
Copy link
Member

Choose a reason for hiding this comment

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

#PUC what kind of values reason could hold

}
11 changes: 11 additions & 0 deletions proto/poktroll/proof/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ message Claim {
poktroll.session.SessionHeader session_header = 2;
// Root hash returned from smt.SMST#Root().
bytes root_hash = 3;
// Claim proof status captures the status of the proof for this claim.
// WARNING: This field MUST only be set by proofKeeper#EnsureValidProofSignaturesAndClosestPath
ClaimProofStatus proof_status = 4;
}
Copy link
Member

Choose a reason for hiding this comment

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

message Claim {
 // Address of the supplier's operator that submitted this claim
 string supplier_operator_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

 // Session header this claim is for
 poktroll.session.SessionHeader session_header = 2;

 // Root hash from smt.SMST#Root()
 bytes root_hash = 3;

 // IMPORTANT: This field MUST only be set by proofKeeper#EnsureValidProofSignaturesAndClosestPath
 ProofValidationState proof_validation_state = 4;
}


enum ProofRequirementReason {
Expand All @@ -43,3 +46,11 @@ enum ClaimProofStage {
SETTLED = 2;
EXPIRED = 3;
}

// ClaimProofStatus defines the status of the proof for a claim.
// The default value is NOT_FOUND, whether the proof is required or not.
enum ClaimProofStatus {
NOT_FOUND = 0;
VALID = 1;
INVALID = 2;
}
Comment on lines +50 to +56
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// ClaimProofStatus defines the status of the proof for a claim.
// The default value is NOT_FOUND, whether the proof is required or not.
enum ClaimProofStatus {
NOT_FOUND = 0;
VALID = 1;
INVALID = 2;
}
// Status of proof validation for a claim
// Default is PENDING_VALIDATION regardless of proof requirement
enum ProofValidationState {
PENDING_VALIDATION = 0;
VALIDATED = 1;
INVALID = 2;
}

1 change: 1 addition & 0 deletions testutil/testtree/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,6 @@ func NewClaim(
SupplierOperatorAddress: supplierOperatorAddr,
SessionHeader: sessionHeader,
RootHash: rootHash,
ProofStatus: prooftypes.ClaimProofStatus_NOT_FOUND,
}
}
Loading
Loading