-
Notifications
You must be signed in to change notification settings - Fork 23
KIP 0041: SPV Expiration Window #73
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| --- | ||
| KIP: "0041" | ||
| Title: SPV Proof Expiration for Cross-Chain Transfers | ||
| Author: chessai @chessai | ||
| Status: Draft | ||
| Type: Standard | ||
| Category: Chainweb | ||
| Created: 2025-07-16 | ||
| --- | ||
|
|
||
| # Motivation | ||
|
|
||
| Chainweb's cross-chain transfers are facilitated through SPV proofs. To briefly summarise, these proofs allow verification that the funds were burned on the source chain, thereby allowing the funds to be minted on the target chain. | ||
|
|
||
| Currently, SPV proofs have no expiration. This requires chainweb-node to retain certain block history indefinitely to validate cross-chain transfers, leading to one source of unbounded storage growth. As the network ages, storage requirements for maintaining complete block header history grow linearly with time, creating scalability concerns for node operators. Allowing the pruning of old state is especially important given the long-term goals of shallow Chainweb nodes, which will run with minimal chain history. Currently, the block state that needs to be retained indefinitely is on the order of tens of gigabytes. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
How much of this is related to information needed to verify SPV proofs? My guess is that it is only a fraction of the total state space. |
||
|
|
||
| # Design | ||
|
|
||
| We propose defining a constant `SPV_PROOF_EXPIRATION_BLOCKS`, the "SPV proof expiration window", which defines the maximum age of a valid SPV proof, in a number of block heights. An SPV proof is created at a certain blockheight, and will be valid for the expiration window after its creation. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Can you specify what exactly this block height is? There are at least block heights involved in an SPV proof:
In theory, these two block heights can be arbitrary far apart, although, in practice, this is limited by the proof size and gas costs for verifying the proof. Typically proofs are of minimal size such that they only span the graph diameter in block height. ZK compressed proofs make proofs across much larger block ranges feasible at constant cost size and verification costs. |
||
|
|
||
| This constant is *not* configurable and as such will be adhered to by the entire network. The constant could be changed at a later date if necessary. | ||
|
|
||
| ## Proposed constant | ||
| 23_040 (blocks). | ||
|
|
||
| The current default max TTL of a transaction is 2 days, which is 172_800 seconds. The minimum safe amount of block history for Chainweb to maintain is 2x the default max TTL. In an effort to be conservative, we propose an expiration window of 4x the default max TTL, 8 days, or about 23_040 blocks (172_800 seconds * 4 / 30 seconds per block). | ||
|
|
||
| # Implementation | ||
|
|
||
| SPV proof validation will include an expiration check: a proof is valid if `current_block_height - proof_block_height <= SPV_PROOF_EXPIRATION_BLOCKS` (note that this is simplified; there are some details missing, such as accounting for arithmetic underflow or the diameter of the chain graph). The expiration check uses the target chain's current block height, as this is where the proof is being validated. | ||
|
|
||
| An implementation of SPV proof expiration (pending approval of a constant) is available at: https://github.com/kadena-io/chainweb-node/pull/2050 | ||
|
|
||
| # User Impact | ||
|
|
||
| There will be no change to how users interact with cross-chain transfers, other than the need to complete them within the expiration window. The larger impact will be that in the future we can trim a significant portion of the block state (tens of gigabytes). | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, this title could use some clarification. It is not clear to me whether it is the SPV proof that is supposed to expire or rather the event that is proven. If it is the former, would it be possible to regenerate a new (valid) SPV proof for the same event, possibly with a more recent proof root?