-
Notifications
You must be signed in to change notification settings - Fork 13
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
[Code Health] Improve Claim settlement processing scalability #1013
Comments
@red-0ne A few followup quetions/comments:
Where/when would we be querying them? I don't fully understand the optimization here.
Same as above. If I were to pick up and implement this myself, I don't understand the direction and rationale.
We DO NOT want to do this for two reasons:
|
TL;DR; I think there's a confusion between Claim submission (that binds the supplier to the smt root) and Proof submission (that selects which branch to submit) It is possible to validate the proof correctness at submission time. Since closest path generation and validation uses the See: x/proof/keeper/proof_validation.go#L235-L250 This height comes before Note that it is unknown at More broadly, the supplier knows whether the proof it's submitting is valid or not and there's no (and should not be any) secret revealed at (or after) proof submission window closing.
This is why we have to minimize the time a supplier has to submit a proof after the seed hash is known.
Message submission responses are fast and do not wait for the tx to process (only basic verification is performed). The outcome of the transaction is only known if the tx gets included in a block that is committed. |
ACK. However, I don't want this to be a consideration / decision because whoever will manage the governance params 10 years from now will not have this thought process. We need the submission windows to function independently, safely and securely without these limitations. |
Noted and agreed with you approach. I concur that it is safe but am still worried about a potential Will keep thinking... |
For the purposes of this messages, let's remove the Can you confirm that this is what you expect the flow to be?
flowchart TD
A[Client submits proof] --> B[RPC Node receives proof submission request]
B --> C{Is 'greedy_validation' boolean field set?}
C -->|greedy_validation=false| D[Store proof onchain w/ field 'validated=false']
D --> E[[Return success]]
C -->|greedy_validation=true| F[Validate proof]
F --> G{Is proof valid?}
G -->|No| H[Don't store on chain]
H --> I[[Return error]]
G -->|Yes| J[Store proof onchain w/ field 'validated=tre']
J --> K[[Return success]]
|
@Olshansk, to describe the workflow more accurately, we should split it into two phases ( As per CosmosSDK Transaction Lifecycle's docs, the following is a simplification of the block production workflow: Proof tx submission (mempool inclusion)flowchart TD
A[Client submits proof tx] --> B[RPC Node receives proof submission tx]
B --> C{tx passes basic validation}
C -->|validated=true| D[tx added to mempool]
D --> E[[Return success]]
C -->|validated=false| F[tx rejected]
F --> K[[Return failure]]
Proof storing (block inclusion)flowchart TD
A[Proposer picks proof from mempool] --> B["Include proof into the proposed bloc<br>(produce block=>exec msg)"]
B --> C["Block is exchanged with other validators<br>(validate block=>exec msg)"]
C --> D[["Proposed block is broadcasted to full nodes<br>(apply block=>exec msg)"]]
Implications
|
@Olshansk , after rethinking proof submission scalability, I believe there's an optimal middle ground between "proof validation at submission" and "proof validation at settlement": Proof validation at the submission block's end blocker. TL;DR:
Proposed Flow: flowchart TD
subgraph MsgSubmitProof
B["Validate proof.SessionHeader"]
B --> C["Store proof"]
end
subgraph EndBlocker
C --> D["Execute EndBlocker"]
D --> E{"Validate proof.ClosestMerkleProof"}
E --> |is_valid_proof=true| F["Emit proof + validity events"]
F --> G["Delete/nullify proof.ClosestMerkleProof<br>(save block space)"]
E --> |is_valid_proof=false| H["Emit proof + non-validity events"]
H --> I["Delete the entire proof"]
end
subgraph ClaimSettlement
G --> J["Wait for claim settlement"]
I --> J
J --> K{"Check proof requirement"}
K --> |"is_proof_required=false"| L["Settle claim"]
K --> |"is_proof_required=true"| M{"Check proof presence"}
M --> |"valid_proof_exists=true"| L
M --> |"valid_proof_exists=false"| N["Slash supplier"]
end
Advantages of Validating Proofs in the Submission Block’s EndBlocker:
This approach balances scalability and efficiency while ensuring robustness in proof handling. |
@red-0ne In response to your last message: love the direction, plan and rationale!
💯 agreed
💯 agreed I'd add / modify:
(Note: this is setting us up for verifiable-compute/zero-knowledge in 2026+)
Really great idea! 💡 Here's an image I generated with Claude using some edits to make it easier on the eye: Syntax for context (it gets cut off a bit in github which is why I added the image)flowchart TD
classDef process fill:#e1f5fe,stroke:#01579b,color:#000
classDef decision fill:#fff3e0,stroke:#e65100,color:#000
classDef event fill:#f3e5f5,stroke:#4a148c,color:#000
classDef terminal fill:#e8f5e9,stroke:#1b5e20,color:#000
subgraph MsgSubmitProof["MsgSubmitProof (Height=X)"]
B[["Validate proof.SessionHeader"]]
B --> C[["Store proof"]]
end
subgraph EndBlocker["EndBlocker (Height=X)"]
C --> D[["Execute EndBlocker"]]
D --> E{{"Validate proof.ClosestMerkleProof"}}
E --> |"is_valid_proof=true"| F[["Emit proof + validity events"]]
F --> G[["Delete/nullify proof.ClosestMerkleProof\n(save block space)"]]
E --> |"is_valid_proof=false"| H[["Emit proof + non-validity events"]]
H --> I[["Delete the entire proof"]]
end
subgraph ClaimSettlement["ClaimSettlement (Height=SessionEnd(X))"]
G --> J[["Wait for claim settlement"]]
I --> J
J --> K{{"Check proof requirement"}}
K --> |"is_proof_required=false"| L[("Settle claim")]
K --> |"is_proof_required=true"| M{{"Check proof presence"}}
M --> |"valid_proof_exists=true"| L
M --> |"valid_proof_exists=false"| N[("Slash supplier")]
end
class B,C,D,F,G,H,I,J process
class E,K,M decision
class L,N terminal
|
Objective
Ensure that Claim settlement processing scales well with the increasing number of claims to process
Origin Document
Goals
Deliverables
A PR that
Non-goals / Non-deliverables
General deliverables
Creator: @red-0ne
Co-Owners: @okdas @bryanchriswhite
The text was updated successfully, but these errors were encountered: