Skip to content

Commit 5b6f7b0

Browse files
chore(abstract-utxo): wip test
TICKET: BTC-2118
1 parent fccdfe6 commit 5b6f7b0

File tree

4 files changed

+6
-86
lines changed

4 files changed

+6
-86
lines changed

modules/abstract-utxo/src/transaction/fixedScript/explainTransaction.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ export function explainPsbt<TNumber extends number | bigint, Tx extends bitgo.Ut
231231
payGoVerificationInfo.outputIndex,
232232
utxolib.bip32.fromBase58(payGoVerificationInfo.verificationPubkey, utxolib.networks.bitcoin).publicKey
233233
);
234-
console.log('verified');
235234
} catch (e) {
236235
console.log(e);
237236
}

modules/abstract-utxo/src/transaction/getPayGoVerificationPubkey.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { Networks } from '@bitgo/statics';
99
*/
1010
export function getPayGoVerificationPubkey(network: utxolib.Network): string | undefined {
1111
const networkName = utxolib.getNetworkName(network);
12-
console.log(network);
1312
console.log(networkName);
1413
if (utxolib.isTestnet(network)) {
1514
return Networks.test.bitcoin.paygoAddressAttestationPubkey;

modules/bitgo/test/v2/unit/coins/abstractUtxoCoin.ts

Lines changed: 1 addition & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import * as utxolib from '@bitgo/utxo-lib';
22
import * as utxocore from '@bitgo/utxo-core';
3-
import { bufferutils } from '@bitgo/utxo-lib';
4-
// import * as transactionModule from '@bitgo/abstract-utxo/src/transaction';
53
import * as should from 'should';
64
import * as sinon from 'sinon';
75
import { Wallet, UnexpectedAddressError, VerificationOptions } from '@bitgo/sdk-core';
@@ -590,23 +588,19 @@ describe('Abstract UTXO Coin:', () => {
590588
describe('Verify paygo output when explaining psbt transaction', function () {
591589
const bitgo: BitGo = TestBitGo.decorate(BitGo, { env: 'mock' });
592590
let coin: AbstractUtxoCoin;
593-
const NIL_UUID = '00000000-0000-0000-0000-000000000000';
594591

595592
// let getPayGoVerificationPubkeyStub: sinon.SinonStub;
596593
let verifyPayGoAddressProofStub: sinon.SinonStub;
597-
let psbtOutputIncludesPaygoAddressProofStub: sinon.SinonStub;
598594

599595
before(() => {
600596
coin = bitgo.coin('tbtc4') as AbstractUtxoCoin;
601597
// getPayGoVerificationPubkeyStub = sinon.stub(transactionModule, 'getPayGoVerificationPubkey').returns(xpub);
602598
verifyPayGoAddressProofStub = sinon.stub(utxocore.paygo, 'verifyPayGoAddressProof');
603-
psbtOutputIncludesPaygoAddressProofStub = sinon.stub(utxocore.paygo, 'psbtOutputIncludesPaygoAddressProof');
604599
});
605600

606601
after(() => {
607602
// getPayGoVerificationPubkeyStub.restore();
608603
verifyPayGoAddressProofStub.restore();
609-
psbtOutputIncludesPaygoAddressProofStub.restore();
610604
});
611605

612606
it('should detect and verify paygo address proof in PSBT', async function () {
@@ -644,84 +638,7 @@ describe('Abstract UTXO Coin:', () => {
644638
// Call explainTransaction
645639
const res = await coin.explainTransaction(mockParams);
646640
console.log(res);
647-
// verifyPayGoAddressProofStub.called.should.be.true();
641+
verifyPayGoAddressProofStub.called.should.be.true();
648642
});
649643
});
650644
});
651-
652-
// describe('test', function () {
653-
// it('should parse path', function () {
654-
// function parsePath(path: string): string {
655-
// if (path.startsWith('/')) {
656-
// console.log('parsing');
657-
// return path.slice(1);
658-
// }
659-
// return path;
660-
// }
661-
// const path = '/0/0';
662-
// const parsedPath = parsePath(path);
663-
// console.log(`parsed path: ${parsedPath}`);
664-
// console.log(`og path: ${path}`);
665-
// console.log(path ?? 'no path');
666-
// console.log(path === undefined ? 'no path' : parsedPath);
667-
// });
668-
669-
// it('should verify', function () {
670-
// // Proof core verification components
671-
// const proof =
672-
// '18426974636f696e205369676e6564204d6573736167653a0aa24e5058323943377469546f687346734c7932646265516e4d6567505a6a6b356b38684d6f616748537441653953596632756e796252516e334c664c3669383739746231706b3936636a683770336578656a323038713763367663757261797564663472397961673239376e6a356d377a32786730676d667371367733677830303030303030302d303030302d303030302d303030302d303030303030303030303030';
673-
// const { entropy, address, uuid } = utxocore.paygo.parsePayGoAttestation(Buffer.from(proof, 'hex'));
674-
// const msg = Buffer.concat([entropy, address, uuid]);
675-
// const sig = 'ICIe6pgTP1oU+CsoKwOgXKs4WrhtRejpapx+TAQEcPc2M3sXYgJaKOK4fHbE7Atto52/VTf6iMAk5hWjZY1NlCY=';
676-
// // const sig2 = Buffer.from(sig, 'base64').slice(1).toString('base64');
677-
// const xpub =
678-
// 'xpub661MyMwAqRbcFU2Qx7pvGmmiQpVj8NcR7dSVpgqNChMkQyobpVWWERcrTb47WicmXwkhAY2VrC3hb29s18FDQWJf5pLm3saN6uLXAXpw1GV';
679-
// const pubkey = utxolib.bip32.fromBase58(xpub, utxolib.networks.bitcoin).derivePath('0/0').publicKey;
680-
// // we are reconstructing this proof for verification purposes to see if we can deconstruct our proof properly
681-
// const prefixString = '\u0018Bitcoin Signed Message:\n';
682-
// const varuint = utxolib.bufferutils.varuint.encode(msg.length);
683-
// const prefixBuff = Buffer.from(prefixString, 'utf-8');
684-
// const reconstructedProof = Buffer.concat([prefixBuff, varuint, entropy, address, uuid]);
685-
// console.log(`reconstructed proof equals regular proof: ${reconstructedProof.toString('hex') === proof}`);
686-
687-
// const msgWithVaruint = Buffer.concat([varuint, msg]);
688-
// // also tried to verify msg without varuint, also returns false.
689-
// const verify = utxocore.bip32utils.verifyMessage(msg, pubkey, Buffer.from(sig, 'base64'), utxolib.networks.bitcoin);
690-
// console.log(`verified proof: ${verify}`); // false
691-
// });
692-
// });
693-
694-
// describe('test og', () => {
695-
// it('should ver #2', () => {
696-
// const xpub =
697-
// 'xpub661MyMwAqRbcFhYdi7qRCuHyYvBjnGQ9RuXoogM6iry2V6RoE8Cvq6yinrLsZQvjZQK8MKSsB5qzHpyGeKcnSZrtLkLYytaNRPR3TXtdfwY';
698-
// const vaspProof = {
699-
// proof:
700-
// '18426974636f696e205369676e6564204d6573736167653a0a85574a69503774774e7a46787251444231555578527636436d6b6d593142444d4d37683257395037447658765864726e677a336572534155566469553738477147316b6e52735266733958335772484433775461726f6236687565764e4c5933647930303030303030302d303030302d303030302d303030302d303030303030303030303030',
701-
// signature: 'IE7YQyLyrv0lFBo/0601EC3pvkXUIp/bN1V7gbyuLdkVciCZOa7HwMNKre+cAUWKPZ5Y59QBktt5x2gO6HS03Ww=',
702-
// };
703-
// console.log(
704-
// '===================================================================================================================================='
705-
// );
706-
// const { entropy, address, uuid } = utxocore.paygo.parsePayGoAttestation(Buffer.from(vaspProof.proof, 'hex'));
707-
// const msg = Buffer.concat([entropy, address, uuid]);
708-
// const verify = utxocore.bip32utils.verifyMessage(
709-
// msg,
710-
// utxolib.bip32.fromBase58(xpub).derivePath('/').publicKey,
711-
// Buffer.from(vaspProof.signature, 'base64'),
712-
// utxolib.networks.bitcoin
713-
// );
714-
// console.log(entropy.toString('hex'));
715-
// console.log(address.toString('hex'));
716-
// console.log(uuid.toString('hex'));
717-
// console.log(
718-
// '===================================================================================================================================='
719-
// );
720-
// console.log(verify);
721-
// });
722-
// });
723-
724-
// 70736274ff0100b4010000000176e65d40a648da1a3b9412d5b49cc309a37a6a7f3c9cd8b8f1f41a2fbbfd479f0100000000fdffffff03204e000000000000225120f7d56f65c3d028dc75a00bdd3c75cd3d4563f051d4f1fe4db8b925a7113df689eb0d1e0000000000225120a7dae2a654772a7b8fc760547e52eaa0224c152bd36c64d45d07d552f284544600127a000000000022002037f34405b83128e4cdecb64f44bff64d0d1b6188d2d656782b136e3488eab1f2000000004f010488b21e00000000000000000067b8325a2303718652d085e2bb65e4c84e8a51eaa4f4ea56e11542290bd27875037cb4cea965ae9d7846addc2a534318a377436864f90a38e2619ca51513cf7a7b0488f255714f010488b21e000000000000000000a5d5ff1d68596719baad5a209925b5edfdc7899ca460a071b3c84bd5bc76b99303f9dc3f6f974f2c90c6d0b7b7c50bc4de49bb8105bfa27223babc909720c6191a043d4b2b964f010488b21e000000000000000000dd32781f8dff65567d76ba1c9485014f7eb07d9527a502cbe0dafb64c20961cd028a55ce3f0c98964dfc6814b1b55b2b77cc31d33a5ae1a994476ce8b20b1618530435eabe8d0001012bd36e980000000000225120866e64ab95028afde6e42cd0dcbd6b38f8dec74d3f3a7648e11259f64075321b0103040000000021163024116333a45124af6141080383eea1b756c1983a07d71d50a2c62d774b7b64150088f25571000000000000000029000000000000002116e5a56ea96f692990ef584ebecaa55acf8d7d4e186db4c489e5498210cc2162df15003d4b2b96000000000000000029000000000000000117201263360542e6b356eaf5c4f03b4af4e0693e169ca7c44207209d3bcc2a3b8f620118208dca1a18f7db9002face5d00d8ebe62ecd0b557a6590b6a2f5686890926bdde548fc05424954474f01866e64ab95028afde6e42cd0dcbd6b38f8dec74d3f3a7648e11259f64075321b1263360542e6b356eaf5c4f03b4af4e0693e169ca7c44207209d3bcc2a3b8f6242033024116333a45124af6141080383eea1b756c1983a07d71d50a2c62d774b7b6402e5a56ea96f692990ef584ebecaa55acf8d7d4e186db4c489e5498210cc2162df0048fc05424954474f044b626348564c484a694557323978546b565a504b325a556e364b51733734445538416657387138595a70776e3736626359557255506b45774c5a724343765275411f4e27998b3b35db81b658d4fed87733b824f0179034b2648930bccf6618dfbb0168cce5776830545cd795ec958961a2ebd68c01ed51db23361b2de15a2aa6ce6300010520bc453383fa08ed074e185e7f5fb0c7ab71e70cf5098b27ca2dceff79288522f901068e01c04420905e79ce4a7441da4424d63a868c3ddae6a7aec1ba844bc357fa5b4e0d5ace34ad20c855c47419e53bc5f4f9a0164e19d1482b982e524508f9b1698afdf98e7a09b4ac01c04420c855c47419e53bc5f4f9a0164e19d1482b982e524508f9b1698afdf98e7a09b4ad20d5ff496ab0be92d7d746e5984e373aba59814638cddf8f5be41d9500f7bbf297ac2107905e79ce4a7441da4424d63a868c3ddae6a7aec1ba844bc357fa5b4e0d5ace343501aab282e9d0bb6d0c715da5290c9aec9f2e9ca2818d7c6a113e9a6a868a67d42088f255710000000000000000290000000c0000002107c855c47419e53bc5f4f9a0164e19d1482b982e524508f9b1698afdf98e7a09b45502aab282e9d0bb6d0c715da5290c9aec9f2e9ca2818d7c6a113e9a6a868a67d4207f5749648c8670cfe3928ef560a5c431054668468924d6ac0253bb34f3cac4f135eabe8d0000000000000000290000000c0000002107d5ff496ab0be92d7d746e5984e373aba59814638cddf8f5be41d9500f7bbf29735017f5749648c8670cfe3928ef560a5c431054668468924d6ac0253bb34f3cac4f13d4b2b960000000000000000290000000c0000000000
725-
726-
// new with log on path
727-
// 70736274ff0100b4010000000176e65d40a648da1a3b9412d5b49cc309a37a6a7f3c9cd8b8f1f41a2fbbfd479f0100000000fdffffff03204e000000000000225120e6e15f7f38c5fe23ae03a15c63298578be23466d5e0e85f43aff010cb029c0f7eb0d1e0000000000225120f66953aa201d3318db72c0660a7823a63f487f6610dd31eb3670b8e1c6cae66f00127a000000000022002037f34405b83128e4cdecb64f44bff64d0d1b6188d2d656782b136e3488eab1f2000000004f010488b21e00000000000000000067b8325a2303718652d085e2bb65e4c84e8a51eaa4f4ea56e11542290bd27875037cb4cea965ae9d7846addc2a534318a377436864f90a38e2619ca51513cf7a7b0488f255714f010488b21e000000000000000000a5d5ff1d68596719baad5a209925b5edfdc7899ca460a071b3c84bd5bc76b99303f9dc3f6f974f2c90c6d0b7b7c50bc4de49bb8105bfa27223babc909720c6191a043d4b2b964f010488b21e000000000000000000dd32781f8dff65567d76ba1c9485014f7eb07d9527a502cbe0dafb64c20961cd028a55ce3f0c98964dfc6814b1b55b2b77cc31d33a5ae1a994476ce8b20b1618530435eabe8d0001012bd36e980000000000225120866e64ab95028afde6e42cd0dcbd6b38f8dec74d3f3a7648e11259f64075321b0103040000000021163024116333a45124af6141080383eea1b756c1983a07d71d50a2c62d774b7b64150088f25571000000000000000029000000000000002116e5a56ea96f692990ef584ebecaa55acf8d7d4e186db4c489e5498210cc2162df15003d4b2b96000000000000000029000000000000000117201263360542e6b356eaf5c4f03b4af4e0693e169ca7c44207209d3bcc2a3b8f620118208dca1a18f7db9002face5d00d8ebe62ecd0b557a6590b6a2f5686890926bdde548fc05424954474f01866e64ab95028afde6e42cd0dcbd6b38f8dec74d3f3a7648e11259f64075321b1263360542e6b356eaf5c4f03b4af4e0693e169ca7c44207209d3bcc2a3b8f6242033024116333a45124af6141080383eea1b756c1983a07d71d50a2c62d774b7b6402e5a56ea96f692990ef584ebecaa55acf8d7d4e186db4c489e5498210cc2162df0048fc05424954474f0437313172754d43724a316a7a417445386353315839657a555a716459464c64356467344565516a4777584c37793261554435737a6659617252777a43586461564120ed892c3b8a6e7435639fadbbfe8753dd23775c7f74c3fe74526c2cd45eefb482580c6632d09e9ce41e0fa1f7cc09ea987684bf1178aad7443b3ac13797122f7e00010520a9acc8f054da7655049fa7d7d0c3edfddc87b51f324c35faa4b1499b3c2a561501068e01c04420cf402ab2e24d3d2e4c64c22be565df5fe0bba1b043ef4d839720bc6e19a83c5dad208e96301de69dd563d9698e847893a15f081328e6514c369b68569798c1f00432ac01c044208e96301de69dd563d9698e847893a15f081328e6514c369b68569798c1f00432ad20a89b6f2100e9c8e328774ce4d4aed2a880aaa4008baa67d8b3e602adf3aa820eac21078e96301de69dd563d9698e847893a15f081328e6514c369b68569798c1f004325502c8549519917a1fe7f2886e89c8b0cf98918dd8c0af661f840489495e509f381858d3b4ae16258aa28955fbe79a158211e7673fb1d0b096b9b5adbbdc5dddaba135eabe8d0000000000000000290000000d0000002107a89b6f2100e9c8e328774ce4d4aed2a880aaa4008baa67d8b3e602adf3aa820e350158d3b4ae16258aa28955fbe79a158211e7673fb1d0b096b9b5adbbdc5dddaba13d4b2b960000000000000000290000000d0000002107cf402ab2e24d3d2e4c64c22be565df5fe0bba1b043ef4d839720bc6e19a83c5d3501c8549519917a1fe7f2886e89c8b0cf98918dd8c0af661f840489495e509f381888f255710000000000000000290000000d0000000000

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,11 @@
899899
monocle-ts "^2.3.13"
900900
newtype-ts "^0.3.5"
901901

902+
"@bitgo/statics@^55.0.0":
903+
version "55.3.0"
904+
resolved "https://registry.npmjs.org/@bitgo/statics/-/statics-55.3.0.tgz#29be5fc64dc2b61d4695bb99e9e31774cdd4c615"
905+
integrity sha512-2W83jCXfndaCRqCOL13AQ2k3WXzs14PHx3a9/Giju/K4uJCgHP2S+pMGfrdErN/tEdfNdO693PeVQwUn6VEB7w==
906+
902907
903908
version "2.0.0-beta.7"
904909
resolved "https://registry.npmjs.org/@bitgo/wasm-miniscript/-/wasm-miniscript-2.0.0-beta.7.tgz#53eb0e87295ad5f2df0933c3b3b519e90bb4d2f1"

0 commit comments

Comments
 (0)