Skip to content

Commit

Permalink
multi: update test vectors to include new reveals
Browse files Browse the repository at this point in the history
  • Loading branch information
jharveyb committed Oct 3, 2023
1 parent 40100f8 commit 401f91d
Show file tree
Hide file tree
Showing 11 changed files with 752 additions and 519 deletions.
4 changes: 2 additions & 2 deletions address/testdata/address_tlv_encoding_generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@
"chain_params_hrp": "taptb",
"asset_version": 0,
"asset_id": "7f3a94b3048ecbce4f2b1686e2df89bde52d5ead1aed011f75fa6578dcab0839",
"group_key": "03f32d239904d1addae728d1917a94bc1d20455b12b251a9222d035e5014a9f759",
"group_key": "02cd028e8899c3324c75a41f6f34b0038fa640b96b93e421c9860c52a7efa9d395",
"script_key": "02a0afeb165f0ec36880b68e0baabd9ad9c62fd1a69aa998bc30e9a346202e078f",
"internal_key": "02a0afeb165f0ec36880b68e0baabd9ad9c62fd1a69aa998bc30e9a346202e078f",
"tapscript_sibling": "",
"amount": 1,
"proof_courier_addr": "hashmail://rand.hashmail.proof.courier:443"
},
"expected": "taptb1qqqsqqspqqzzqle6jjesfrktee8jk95xut0cn00994026xhdqy0ht7n90rw2kzpeq5ss8uedywvsf5ddmtnj35v3022tc8fqg4d39vj34y3z6q672q22na6eqcss9g90avt97rkrdzqtdrst427e4kwx9lg6dx4fnz7rp6drgcszupu0pqss9g90avt97rkrdzqtdrst427e4kwx9lg6dx4fnz7rp6drgcszupu0pgqszrp2dpshx6rdv95kcw309aexzmny9e5xzumgd4skjmpwwpex7mmx9e3k7atjd9jhyw35xseskkqklz",
"expected": "taptb1qqqsqqspqqzzqle6jjesfrktee8jk95xut0cn00994026xhdqy0ht7n90rw2kzpeq5ss9ngz36yfnsejf366g8m0xjcq8raxgzukhylyy8ycvrzj5lh6n5u4qcss9g90avt97rkrdzqtdrst427e4kwx9lg6dx4fnz7rp6drgcszupu0pqss9g90avt97rkrdzqtdrst427e4kwx9lg6dx4fnz7rp6drgcszupu0pgqszrp2dpshx6rdv95kcw309aexzmny9e5xzumgd4skjmpwwpex7mmx9e3k7atjd9jhyw35xses833965",
"comment": "signet group collectible"
},
{
Expand Down
63 changes: 63 additions & 0 deletions asset/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -645,3 +645,66 @@ type ValidBurnTestCase struct {
type BurnTestVectors struct {
ValidTestCases []*ValidBurnTestCase `json:"valid_test_cases"`
}

func NewTestFromGenesisReveal(t testing.TB, g *Genesis) *TestGenesisReveal {
t.Helper()

return &TestGenesisReveal{
FirstPrevOut: g.FirstPrevOut.String(),
Tag: g.Tag,
MetaHash: hex.EncodeToString(g.MetaHash[:]),
OutputIndex: g.OutputIndex,
Type: uint8(g.Type),
}
}

type TestGenesisReveal struct {
FirstPrevOut string `json:"first_prev_out"`
Tag string `json:"tag"`
MetaHash string `json:"meta_hash"`
OutputIndex uint32 `json:"output_index"`
Type uint8 `json:"type"`
}

func (tgr *TestGenesisReveal) ToGenesisReveal(t testing.TB) *Genesis {
t.Helper()

return &Genesis{
FirstPrevOut: test.ParseOutPoint(
t, tgr.FirstPrevOut,
),
Tag: tgr.Tag,
MetaHash: test.Parse32Byte(t, tgr.MetaHash),
OutputIndex: tgr.OutputIndex,
Type: Type(tgr.Type),
}
}

func NewTestFromGroupKeyReveal(t testing.TB,
gkr *GroupKeyReveal) *TestGroupKeyReveal {

t.Helper()

return &TestGroupKeyReveal{
RawKey: hex.EncodeToString(gkr.RawKey[:]),
TapscriptRoot: hex.EncodeToString(gkr.TapscriptRoot),
}
}

type TestGroupKeyReveal struct {
RawKey string `json:"raw_key"`
TapscriptRoot string `json:"tapscript_root"`
}

func (tgkr *TestGroupKeyReveal) ToGroupKeyReveal(t testing.TB) *GroupKeyReveal {
t.Helper()

rawKey := test.ParsePubKey(t, tgkr.RawKey)
tapscriptRoot, err := hex.DecodeString(tgkr.TapscriptRoot)
require.NoError(t, err)

return &GroupKeyReveal{
RawKey: ToSerialized(rawKey),
TapscriptRoot: tapscriptRoot,
}
}
46 changes: 34 additions & 12 deletions proof/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,36 @@ func NewTestFromProof(t testing.TB, p *Proof) *TestProof {
)
}

if p.GenesisReveal != nil {
tp.GenesisReveal = asset.NewTestFromGenesisReveal(
t, p.GenesisReveal,
)
}

if p.GroupKeyReveal != nil {
tp.GroupKeyReveal = asset.NewTestFromGroupKeyReveal(
t, p.GroupKeyReveal,
)
}

return tp
}

type TestProof struct {
PrevOut string `json:"prev_out"`
BlockHeader *TestBlockHeader `json:"block_header"`
BlockHeight uint32 `json:"block_height"`
AnchorTx string `json:"anchor_tx"`
TxMerkleProof *TestTxMerkleProof `json:"tx_merkle_proof"`
Asset *asset.TestAsset `json:"asset"`
InclusionProof *TestTaprootProof `json:"inclusion_proof"`
ExclusionProofs []*TestTaprootProof `json:"exclusion_proofs"`
SplitRootProof *TestTaprootProof `json:"split_root_proof"`
MetaReveal *TestMetaReveal `json:"meta_reveal"`
AdditionalInputs []string `json:"additional_inputs"`
ChallengeWitness []string `json:"challenge_witness"`
PrevOut string `json:"prev_out"`
BlockHeader *TestBlockHeader `json:"block_header"`
BlockHeight uint32 `json:"block_height"`
AnchorTx string `json:"anchor_tx"`
TxMerkleProof *TestTxMerkleProof `json:"tx_merkle_proof"`
Asset *asset.TestAsset `json:"asset"`
InclusionProof *TestTaprootProof `json:"inclusion_proof"`
ExclusionProofs []*TestTaprootProof `json:"exclusion_proofs"`
SplitRootProof *TestTaprootProof `json:"split_root_proof"`
MetaReveal *TestMetaReveal `json:"meta_reveal"`
AdditionalInputs []string `json:"additional_inputs"`
ChallengeWitness []string `json:"challenge_witness"`
GenesisReveal *asset.TestGenesisReveal `json:"genesis_reveal"`
GroupKeyReveal *asset.TestGroupKeyReveal `json:"group_key_reveal"`
}

func (tp *TestProof) ToProof(t testing.TB) *Proof {
Expand Down Expand Up @@ -200,6 +214,14 @@ func (tp *TestProof) ToProof(t testing.TB) *Proof {
p.ChallengeWitness = append(p.ChallengeWitness, b)
}

if tp.GenesisReveal != nil {
p.GenesisReveal = tp.GenesisReveal.ToGenesisReveal(t)
}

if tp.GroupKeyReveal != nil {
p.GroupKeyReveal = tp.GroupKeyReveal.ToGroupKeyReveal(t)
}

return p
}

Expand Down
2 changes: 1 addition & 1 deletion proof/testdata/ownership-proof.hex
Original file line number Diff line number Diff line change
@@ -1 +1 @@
54415050000400000000012407381c1ad9d4abbf3d4664a80dc13df3a271f73621a4c476d5faa099093d5f08000000010250000040205c9c7f10746d49a143742948cacb2edc063481a6f1fa5492a9f0299346fce325629fa06a4bdb830586733e8351911235692d1fad7664894793de4d223017583a016a0865ffff7f200000000003fd018c0200000000010203f8ac0fa47f7eaf42dbf8ec9b135849dcd49b69ffe980b6ecf88293a0b143ba0000000000ffffffff07381c1ad9d4abbf3d4664a80dc13df3a271f73621a4c476d5faa099093d5f0801000000000000000003e803000000000000225120a914766a8a19bb8cc1fe8c17f411aae5fc6841fea6b807ce73d66ebdabf08d52e80300000000000022512087a21c8d7a5d3d0bea676166a83bfcf12ae3c92b7f14bc1fff7d54820eda441a25d0f50500000000225120fe19c6b74a18eccd85988ed33b3d3204e4ccc8f43c2a10b3958d0a9cf6d95f1a02473044022023174c06060685d720e6c711922a07245083222df195fb75524c89b14a30606d02203eea3947bb6bdc65dae743823ee358817a688b9d39271f149c770777933793b401210357ef09bf2d5c536341f759d7d2825e64a9f5954a750250e7cd1fe4d2cf92b3d501403b17cc53283398a529d534a70835d6fe22f45e30d48d9c87e2d3d83b9173670a5280636b53724dd7822692826274c7058a58016038e1a690c7e6366d69d9a6d900000000042201612328b275fe8b89ec246b5ea9f1ce906e512795cfbfb00132c14243dbbfaabd0005fd02b40001000159026aeb6852b9e126728173b095a689ef6d6b94bd3d9d61fec3b1047269bda94a000000000f66697273742d697465737462757878dedfcaf730cec72f6dbea97c64d4a4f3489edc3c2ff8413ad169e9717a3b058d00000000000201000303fd025806fd022301fd021f0065000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002fd01b44a000176db3c90a94d1d88883b15f2ea49cea0db1a6b99df666bdb2f4717cc259d3c310000000000000258ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7ffd01660001000159026aeb6852b9e126728173b095a689ef6d6b94bd3d9d61fec3b1047269bda94a000000000f66697273742d697465737462757878dedfcaf730cec72f6dbea97c64d4a4f3489edc3c2ff8413ad169e9717a3b058d00000000000201000303fd025806ad01ab006507381c1ad9d4abbf3d4664a80dc13df3a271f73621a4c476d5faa099093d5f0800000001ea7d47abcbf3935868eb78ecfa55bcee3b1baa50554582770b85cf94184de99c025dc1551a12879e464751c5d58adc47170366eec5ea474d4f08069faf0ec4a8460142014030a59f8083dbf0f9a2cecb670fdaeede2c8f7162cdf016d9125fd5826ac5f13e64b587ba9c9224c71af999d495388ef16a9c8f00c28c8487ed84d30c676ca9920728fcf3a9d2bf6a83827c22662bfa10d095aa5dbc8d0ec54f3bd6e2ee3ab23d211d00000000000004b008020000092102ada2da3880c78b716154464311235543576a4a25519c6d7408f16562706a4d6c08020000092102b16a1dabf41be280943e505ee522d4c349250ef1b7c4a0cb197516659eb72709069f00040000000101210205bd63c9712513e6b573490780fcaecbc9c3fe29807cf6eb9b65067415c77f3d027400490001000120ea7d47abcbf3935868eb78ecfa55bcee3b1baa50554582770b85cf94184de99c02220000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff012700010001220000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff07f802c70004000000000121030e0b3b55c02f39e7c4c9ab09ffc94a3329c64fff6ebae8848936dce9526e30fc029c00710001000120ea7d47abcbf3935868eb78ecfa55bcee3b1baa50554582770b85cf94184de99c024a000126d95df7e2348c05a2e1b0d7a48473f4dba9128a1b948ec8c885ed667f1e95eb0000000000000258ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf012700010001220000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff2e000400000002012102649b305eb6b54187ff5acccc35bce9e47feea1bf3adbfcdc1be38d4c55cf249a0303020101089f0004000000000121030e0b3b55c02f39e7c4c9ab09ffc94a3329c64fff6ebae8848936dce9526e30fc027400490001000120ea7d47abcbf3935868eb78ecfa55bcee3b1baa50554582770b85cf94184de99c02220000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff012700010001220000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0b42014065c422d0fee12eeccef954a2a9cad87b75eaedce45bd09af98a0a16d073b748740effa361e055bb28344a0a1523665dc10442ef9847208d7ab33b26eeff616c50c04000001bc
54415050000400000000012461ee8f0acfbfd5f6493a5caeb2d8394560384b2b0ec17d4e0990406cc6e3e75b0000000102500000402092a9256d4b85021548627deb2c43f36af17910072d708295b778f5ad3f5bb87dd83ea06c46664e4315f7de9ee8d3506c71d82b40200cfc2541e68b86c4146a67c21c1b65ffff7f200600000003fd018c0200000000010204478bc55a872d647f4b68a48f6d8d2240d18d03b9370a7f38743f4827cd99430000000000ffffffff61ee8f0acfbfd5f6493a5caeb2d8394560384b2b0ec17d4e0990406cc6e3e75b01000000000000000003e80300000000000022512028fb02ae7f93d46f673d798597985b2e26f3caeba668be40eb215e7e3b4583c7e80300000000000022512032b6eeb107b144586f1134b285d9f0dcb432233188851829e131aa4478264ef325d0f50500000000225120dec8af6483c79fa7ea39bea834b92024acfe5c1b6ccdd66889048c2ca0a206600247304402207820ce964c23db5429446ea89d666b45d1b3c4fae30aec6894d34214ad0ed089022044d895c3ba0b30babbe5f927795ab186e5384bb25596e2623caeb94029ee64af0121032cbea8ed49a89ee5c69276349fb9fa4a98613ced896cacc4019c02c97314e77001403aff7a5dc8b6501541c36ad1500c5dd84f59f0c3d732e0417fe7bc28371704a5981b0a8bdfd57c592efaad8e0913b29b43ff97a0822d7ee6b65d3d4fdb1d3f9f000000000422015aa0323cf2cc7f34962f63618b77c9bb44c26c7d69fb7b25c9774e36b914f1890005fd02b40001000159000edf94014e8e647be631dc8f23a1a2ac762babf95e2110a04cc6d11c9039ff000000000f66697273742d69746573746275787872055b46e57b82693def0aab2e58eb4b78068238f3d62b84d89050b92fc2a6e500000000000201000303fd025806fd022301fd021f0065000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002fd01b44a0001e829447f0dd17d26880ba56a672caa4de2859a5d732799f39077d1ee48595d7b0000000000000258ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdffd01660001000159000edf94014e8e647be631dc8f23a1a2ac762babf95e2110a04cc6d11c9039ff000000000f66697273742d69746573746275787872055b46e57b82693def0aab2e58eb4b78068238f3d62b84d89050b92fc2a6e500000000000201000303fd025806ad01ab006561ee8f0acfbfd5f6493a5caeb2d8394560384b2b0ec17d4e0990406cc6e3e75b00000001e304927a992c3a1d81f50586301c1f055f59923c236b93704097d02fdcd9eb7802aee2739664013a7de5c6c324f520af0dda900e53fdde79d97caae61f53b8634b01420140cc16977679b45a50b64c03b363b95ca3389590495ca742018735f531d5ce3fe6b88dfda0637e06e6eba86e1cdd9f2df4e4cb96ff7c36effd1b50a73334674bd607281c6319db0fc74f357d435e6efd4406c54d6473fa35face18d29b47ecdf63a8c200000000000004b00802000009210294aab4886e65569873d588d86dbbb9a8785576b251261170a378a30b2af2d3d208020000092102995eefdf358055573f2f70106f09c208f86277e7ab7038edfe52a7e2003c06d9069f000400000001012103cdff2a9995874b27e2dc83ae878b7753c925d996339455982250d6c237adecba027400490001000120e304927a992c3a1d81f50586301c1f055f59923c236b93704097d02fdcd9eb7802220000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff012700010001220000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff07f802c700040000000001210260037c3b9987798745c48397b4651f2ee73d433f27aa3bb33f96744a6607b9f5029c00710001000120e304927a992c3a1d81f50586301c1f055f59923c236b93704097d02fdcd9eb78024a000111bf752ef14c9095b14932062e5be15755cecbcd8cd5f26473dbb0a6db1373630000000000000258ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f012700010001220000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff2e000400000002012102ff7b62b0ada51df1a354f19f71dd957868b062515f7c1ae5f6e63a4643f4170b0303020101089f00040000000001210260037c3b9987798745c48397b4651f2ee73d433f27aa3bb33f96744a6607b9f5027400490001000120e304927a992c3a1d81f50586301c1f055f59923c236b93704097d02fdcd9eb7802220000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff012700010001220000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0b4201400e5788a6d685c0aae69e29cc1178411d42e86d846505eec1b945c4ad24b88707b1fff685d69243efb70054852398881a4775c3fcd6178cda5347a60e84d3bd760c04000001bc
Loading

0 comments on commit 401f91d

Please sign in to comment.