Skip to content

Commit

Permalink
tapchannelmsg: add routines for chunking and unchunking a proof file
Browse files Browse the repository at this point in the history
In this commit, we add functions to chunk and unchunk a proof file.
Given a chunk size, we'll split up the proof into smaller components,
along with a hash digest for authentication verification and tracking.
On the other side, we'll collect all the chunks, check the digest, and
finally decode the chunk itself.

Property based tests are also added for both the positive and the
negative cases.
  • Loading branch information
Roasbeef committed Dec 17, 2024
1 parent be9578a commit 41de444
Show file tree
Hide file tree
Showing 3 changed files with 702 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,390 @@
# 2024/12/17 20:47:19.611791 [TestProofChunkRoundTripProperty] [rapid] draw randGen: asset.Genesis{FirstPrevOut:wire.OutPoint{Hash:chainhash.Hash{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, Index:0x0}, Tag:"À᪾𐐀᪾AAႠAAAA\ufeffᾈAAAA\ufeffAÀAÀ᪾AA𐄷DžAAᾈA𞤡ᛮA", MetaHash:[32]uint8{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, OutputIndex:0x0, Type:0x0}
# 2024/12/17 20:47:19.611811 [TestProofChunkRoundTripProperty] [rapid] draw assetType: 0
# 2024/12/17 20:47:19.611823 [TestProofChunkRoundTripProperty] [rapid] draw scriptKey: &secp256k1.PublicKey{x:secp256k1.FieldVal{n:[10]uint32{0x2f81798, 0xa056c5, 0x28d959f, 0x36cb738, 0x3029bfc, 0x3a1c2c1, 0x206295c, 0x2eeb156, 0x27ef9dc, 0x1e6f99}}, y:secp256k1.FieldVal{n:[10]uint32{0x310d4b8, 0x1f423fe, 0x14199c4, 0x1229a15, 0xfd17b4, 0x384422a, 0x24fbfc0, 0x3119576, 0x27726a3, 0x120eb6}}}
# 2024/12/17 20:47:19.612743 [TestProofChunkRoundTripProperty] [rapid] draw chunkSize: 1
# 2024/12/17 20:47:19.612983 [TestProofChunkRoundTripProperty]
# Error Trace: /Users/roasbeef/gocode/src/github.com/lightninglabs/taproot-assets/tapchannelmsg/wire_msgs_test.go:160
# /Users/roasbeef/gocode/pkg/mod/pgregory.net/[email protected]/engine.go:368
# /Users/roasbeef/gocode/pkg/mod/pgregory.net/[email protected]/engine.go:377
# /Users/roasbeef/gocode/pkg/mod/pgregory.net/[email protected]/engine.go:203
# /Users/roasbeef/gocode/pkg/mod/pgregory.net/[email protected]/engine.go:118
# /Users/roasbeef/gocode/src/github.com/lightninglabs/taproot-assets/tapchannelmsg/wire_msgs_test.go:129
# Error: Received unexpected error:
# unable to decode full proof: bytes: too large: 65
# Test: TestProofChunkRoundTripProperty
#
v0.4.8#8254848599916273006
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x5555555555555
0x14
0xb908c4741e25e
0x1a
0x5555555555555
0x22
0x38e38e38e38e4
0x2
0x5555555555555
0x14
0x15923fd3e7c085
0x467
0x5555555555555
0x22
0x38e38e38e38e4
0x2
0x5555555555555
0x0
0x0
0x0
0x5555555555555
0x0
0x0
0x0
0x5555555555555
0x14
0x12f32b2c9e3807
0x1d4
0x5555555555555
0x0
0x0
0x0
0x5555555555555
0x0
0x0
0x0
0x5555555555555
0x0
0x0
0x0
0x5555555555555
0x0
0x0
0x0
0x5555555555555
0x0
0xe3e05a098777c
0x26
0x5555555555555
0x16
0x6b74f03291620
0x4
0x5555555555555
0x0
0x0
0x0
0x5555555555555
0x0
0x0
0x0
0x5555555555555
0x0
0x0
0x0
0x5555555555555
0x0
0x0
0x0
0x5555555555555
0x0
0xe3e05a098777c
0x26
0x5555555555555
0x0
0x0
0x0
0x5555555555555
0x14
0xb908c4741e25e
0x1a
0x5555555555555
0x0
0x0
0x0
0x5555555555555
0x14
0xb908c4741e25e
0x1a
0x5555555555555
0x22
0x38e38e38e38e4
0x2
0x5555555555555
0x0
0x0
0x0
0x5555555555555
0x0
0x0
0x0
0x5555555555555
0x20
0x16502e2e6c40bf
0xaab
0x5555555555555
0x16
0x0
0x0
0x5555555555555
0x0
0x0
0x0
0x5555555555555
0x0
0x0
0x0
0x5555555555555
0x16
0x6b74f03291620
0x4
0x5555555555555
0x0
0x0
0x0
0x5555555555555
0x14
0x1f0285a09b9d2d
0x0
0x5555555555555
0x1a
0x0
0x0
0x5555555555555
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x0
0x1
0x0
0x0
0x0
0x0
Loading

0 comments on commit 41de444

Please sign in to comment.