@@ -10,7 +10,6 @@ import (
1010 "github.com/btcsuite/btcd/chaincfg"
1111 "github.com/btcsuite/btcd/txscript"
1212 "github.com/btcsuite/btcd/wire"
13- "github.com/decred/dcrd/dcrec/secp256k1/v4"
1413 "github.com/lightninglabs/taproot-assets/asset"
1514 "github.com/lightninglabs/taproot-assets/commitment"
1615 "github.com/lightninglabs/taproot-assets/fn"
@@ -502,64 +501,6 @@ func TestBIPTestVectors(t *testing.T) {
502501 }
503502}
504503
505- // TestGenChallengeNUMS tests the generation of NUMS challenges.
506- func TestGenChallengeNUMS (t * testing.T ) {
507- t .Parallel ()
508-
509- gx , gy := secp256k1 .Params ().Gx , secp256k1 .Params ().Gy
510-
511- // addG is a helper function that adds G to the given public key.
512- addG := func (p * btcec.PublicKey ) * btcec.PublicKey {
513- x , y := secp256k1 .S256 ().Add (p .X (), p .Y (), gx , gy )
514- var xFieldVal , yFieldVal secp256k1.FieldVal
515- xFieldVal .SetByteSlice (x .Bytes ())
516- yFieldVal .SetByteSlice (y .Bytes ())
517- return btcec .NewPublicKey (& xFieldVal , & yFieldVal )
518- }
519-
520- testCases := []struct {
521- name string
522- challenge fn.Option [[32 ]byte ]
523- expectedKey asset.ScriptKey
524- }{
525- {
526- name : "no challenge" ,
527- challenge : fn .None [[32 ]byte ](),
528- expectedKey : asset .NUMSScriptKey ,
529- },
530- {
531- name : "challenge is scalar 1" ,
532- challenge : fn .Some ([32 ]byte {
533- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
534- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
535- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
536- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x01 ,
537- }),
538- expectedKey : asset .NewScriptKey (addG (asset .NUMSPubKey )),
539- },
540- {
541- name : "challenge is scalar 2" ,
542- challenge : fn .Some ([32 ]byte {
543- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
544- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
545- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
546- 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x02 ,
547- }),
548- expectedKey : asset .NewScriptKey (
549- addG (addG (asset .NUMSPubKey )),
550- ),
551- },
552- }
553-
554- for _ , tc := range testCases {
555- result := GenChallengeNUMS (tc .challenge )
556- require .Equal (
557- t , tc .expectedKey .PubKey .SerializeCompressed (),
558- result .PubKey .SerializeCompressed (),
559- )
560- }
561- }
562-
563504// runBIPTestVector runs the tests in a single BIP test vector file.
564505func runBIPTestVector (t * testing.T , testVectors * TestVectors ) {
565506 for _ , validCase := range testVectors .ValidTestCases {
0 commit comments