Skip to content

Commit 6baccce

Browse files
Merge pull request #22 from yangby-cryptape/docs/add-limits-and-known-issues
docs: add limits and known issues to the docs of Bitcoin SPV contract
2 parents 09b90c6 + 39ba1ab commit 6baccce

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Diff for: contracts/ckb-bitcoin-spv-type-lock/README.md

+33
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,13 @@ When you want to verify a transaction with Bitcoin SPV Client cell:
197197

198198
A simple example could be found in [this test](https://github.com/ckb-cell/ckb-bitcoin-spv/blob/2464c8f/prover/src/tests/service.rs#L132-L181).
199199

200+
### Limits
201+
202+
- The lower limit of SPV client cells count is 3.
203+
204+
- The upper limit of SPV client cells count is not set, but base on the data type, `u8`,
205+
any number larger than `250` is not recommended.
206+
200207
### Known Issues
201208

202209
- `VM Internal Error: MemWriteOnExecutablePage`
@@ -205,6 +212,32 @@ When you want to verify a transaction with Bitcoin SPV Client cell:
205212

206213
`Data1` is introduced from [CKB RFC 0032], and `Data2` is introduced from [CKB RFC 0051].
207214

215+
- Failed to reorg when there is only 1 stale SPV client.
216+
217+
When only 1 SPV client is stale, in the normal case, the reorg transaction
218+
contains 1 input SPV client cell and 1 output SPV client cell is enough.
219+
220+
But, the structure of this transaction is totally the same as an update
221+
transaction, this leads to ambiguity.
222+
223+
So, we define a rule to resolve this case:
224+
225+
- When there is only 1 SPV client is stale, the reorg transaction has to
226+
rebuild 2 SPV client.
227+
228+
That means, the reorg transaction for 1 stale SPV client should contain 2
229+
output SPV client cells and 2 output SPV client cells.
230+
231+
Since the reorg rarely happens in Bitcoin mainnet, the cost is acceptable.
232+
233+
- Throw "arithmetic operation overflow" when update a Bitcoin SPV instance for
234+
a Bitcoin dev chain.
235+
236+
The bitcoin dev chain doesn't follow the rule of difficulty change.
237+
238+
So, calculate the next target and partial chain work may lead to an
239+
arithmetic operation overflow.
240+
208241
[^1]: [Section "Code Locating"] in "CKB RFC 0022: CKB Transaction Structure".
209242

210243
[Bitcoin]: https://bitcoin.org/

0 commit comments

Comments
 (0)