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 Sep 28, 2023
1 parent 5677745 commit ecb6e4c
Show file tree
Hide file tree
Showing 11 changed files with 753 additions and 520 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": "taptb1qqqsqq3q0uaffvcy3m9uunetz6rw9hufhhjj6h4drtksz8m4lfjh3h9tpqusxggr7vkj8xgy6xka4eeg6xgh499ur5sy2kcjkfg6jg3dqd09q99f7avsgggz5zh7k9jlpmpk3q9k3c9640v6m8rzl5dxn25e30psax35vgpwq78svggz5zh7k9jlpmpk3q9k3c9640v6m8rzl5dxn25e30psax35vgpwq78ssqgppg4xsctndpkkz6tv8ghj7unpdejzu6rpwd5x6ctfdsh8qun0danzucm0w4exjetj8g6rgvcvqyqq7z78w5",
"expected": "taptb1qqqsqq3q0uaffvcy3m9uunetz6rw9hufhhjj6h4drtksz8m4lfjh3h9tpqusxggze5pgazyecveycadyrahnfvqr37nypwttj0jzrjvxp3f20maf6w2sgggz5zh7k9jlpmpk3q9k3c9640v6m8rzl5dxn25e30psax35vgpwq78svggz5zh7k9jlpmpk3q9k3c9640v6m8rzl5dxn25e30psax35vgpwq78ssqgppg4xsctndpkkz6tv8ghj7unpdejzu6rpwd5x6ctfdsh8qun0danzucm0w4exjetj8g6rgvcvqyqqy2p3dg",
"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 @@ -560,3 +560,66 @@ func (tgk *TestGroupKey) ToGroupKey(t testing.TB) *GroupKey {

type TestScriptKey struct {
}

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
544150500004000000000124fe973d328fac3ecacc9b04a7bfc2e29a2bc8232b6405a97e1f252e718bdcf76600000001025000004020f4f5093901f10339d34269118d82b99f291e63238e439bdd48c54b398d24a01e8ce513b37edc9e4970dd8a05ded1ae73ea0fce7df54ecee2a8e0f0df7c163c626d821565ffff7f200300000003fd018d02000000000102005602a39099ec5fa5bb0c67508187ab0002eedb43ab53722da175227e5e0ca70000000000fffffffffe973d328fac3ecacc9b04a7bfc2e29a2bc8232b6405a97e1f252e718bdcf76601000000000000000003e8030000000000002251206aee1661e4bbc2b95d19b5af22fde167be2331ad99951471381da79df2d2b1b3e803000000000000225120b3ba03777fcf90ae68ae6cda7924687e9191df8cd25765aacd8d87652580b9d025d0f50500000000225120197261e4701cdcff2a99c382eb6494d004bd31808a0eb2746ca2c15a1e745a0102483045022100a60e0befd5f9d1ec67a94d3c1355bf9f84c002981f198e94657c79daf1ed5a6b02206ffaa5a616028dd14ffb4d22ae531ce11097c82d2b552b3094e4903fc2c73c4f01210388371803afc285c4459bedfd1b46afba963cce002cfa50877466494ef53f114b0140d9e6cb725f2239cc998d19adfa1974bc1b22492064407bb242d3fbbc53cb8874701e5731070f986c5aef8fb2c7ef74e080b81514fdc55cf020197b8d86ccdc2d00000000042201bbced66c046fc1f42d793831dd9699f6c9a808554402aaadf5128d0fb99602b10005fd02b40001000159021c8e32a6cf16bc629544ede8be09b28c662ec68aef235dd182316baca6f67e000000000f66697273742d69746573746275787872055b46e57b82693def0aab2e58eb4b78068238f3d62b84d89050b92fc2a6e500000000000201000303fd025806fd022301fd021f0065000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002fd01b44a00011225b4c20322f950f28d376d6246d029cc68504f57c02cab2d6b38db84df8f6c0000000000000258ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7ffd01660001000159021c8e32a6cf16bc629544ede8be09b28c662ec68aef235dd182316baca6f67e000000000f66697273742d69746573746275787872055b46e57b82693def0aab2e58eb4b78068238f3d62b84d89050b92fc2a6e500000000000201000303fd025806ad01ab0065fe973d328fac3ecacc9b04a7bfc2e29a2bc8232b6405a97e1f252e718bdcf766000000013507c8f6b5d856b85a4386e39ce9994cc15b31ecf71a30fce6efeeb18fcfd8b902407c1834d691a8f700a3c0fe8bbfbdb44f9988f922433c32fb21c85fc98e7bac014201403fc6ba4c750a0832312fa2ef91b6d11c13415ff9b315e8563aa97e00f14aa65e7d7e43aad0d6af725afe3087f50bf066bd47ad13d986ab6523420c4568fa6b420728fe76d78889ac7f07125ba4f641c287f6b07f23f7ceece4fb5d1e9be76828935f00000000000004b008020000092102bb9c08cfdff5702206eb0afc7d75f851b19655f942287531c2dc90b7b4ffdb31080200000921024b5960f0bac430167eb3ab5badea160f991eb9a21b105273572a78f4a0109e2c069f0004000000010121022fead17ed64aed4a6ccafa7e59ba8cc94c4c79221af779b11c9081d9e20c9c250274004900010001203507c8f6b5d856b85a4386e39ce9994cc15b31ecf71a30fce6efeeb18fcfd8b902220000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff012700010001220000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff07f802c70004000000000121021e90b0a7a5257534c769d2ce98804bbbf9dfd5c3fd50156ce5d7a4836f28e35d029c007100010001203507c8f6b5d856b85a4386e39ce9994cc15b31ecf71a30fce6efeeb18fcfd8b9024a0001e08754f9aa829184cd2f6d3119b42adf9fd9792457e3249c346ca79a83b6c9de0000000000000258ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f012700010001220000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff2e00040000000201210208dc14650c15034f8cd03923cefde08550d53d9bc2b33e3adaf0eb337efd6b000303020101089f0004000000000121021e90b0a7a5257534c769d2ce98804bbbf9dfd5c3fd50156ce5d7a4836f28e35d0274004900010001203507c8f6b5d856b85a4386e39ce9994cc15b31ecf71a30fce6efeeb18fcfd8b902220000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff012700010001220000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0b420140e5549ecb8bf114d5dff6d7198032031a8d0115b60a22854f865dc8c9f963d4fbd22e3d18b890ee8ba679f6b50dcdd2a2f2c612d0a6695f22da6d32fd21c1c3e40c04000001bc
Loading

0 comments on commit ecb6e4c

Please sign in to comment.