Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/__tests__/railgun-engine.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -522,16 +522,27 @@ describe('railgun-engine', function test() {
]);
expect(initialBalance).to.equal(undefined);

console.log('DEBUG: initialBalance', initialBalance)

const address = wallet.getAddress(chain);
const shield = await shieldTestTokens(address, BigInt(110000) * DECIMALS_18);



console.log('DEBUG: address and shield', shield)

const balance = await wallet.getBalanceERC20(txidVersion, chain, tokenAddress, [
WalletBalanceBucket.Spendable,
]);

console.log('DEBUG: balance: ', balance)

expect(balance).to.equal(BigInt('109725000000000000000000'));

const tokenData = getTokenDataERC20(tokenAddress);

console.log('DEBUG: tokendata: ', tokenData);

// Create transaction
const transactionBatch = new TransactionBatch(chain);
transactionBatch.addUnshieldData({
Expand All @@ -540,6 +551,8 @@ describe('railgun-engine', function test() {
tokenData,
});


console.log('DEBUG: transactionBatch: ', transactionBatch);
// Add output for mock Broadcaster
transactionBatch.addOutput(
TransactNote.createTransfer(
Expand All @@ -566,6 +579,9 @@ describe('railgun-engine', function test() {
true, // shouldGeneratePreTransactionPOIs
);


console.log('DEBUG: provedTransactions: preTransactionPOIsPerTxidLeafPerList ', provedTransactions, preTransactionPOIsPerTxidLeafPerList);

expect(Object.keys(preTransactionPOIsPerTxidLeafPerList).length).to.equal(1);
expect(Object.keys(preTransactionPOIsPerTxidLeafPerList[MOCK_LIST_KEY]).length).to.equal(1);

Expand All @@ -577,6 +593,10 @@ describe('railgun-engine', function test() {
provedTransactions,
);


console.log('DEBUG: transact ', transact);


const isValidPOI = await POIValidation.isValidSpendableTransaction(
txidVersion,
chain,
Expand All @@ -592,8 +612,13 @@ describe('railgun-engine', function test() {
expect(isValidPOI.isValid).to.equal(true, isValidPOI.error);

const transactTx = await sendTransactionWithLatestNonce(ethersWallet, transact);

console.log('transactTx: ', transactTx);

const transactReceipt = await transactTx.wait();

console.log('transactReceipt: ', transactReceipt);

if (!transactReceipt) {
throw new Error('Failed to get transact receipt');
}
Expand All @@ -617,6 +642,9 @@ describe('railgun-engine', function test() {
),
ByteLength.UINT_256,
);

console.log('shieldCommitment: ', shieldCommitment);

const blindedCommitmentIn = BlindedCommitment.getForShieldOrTransact(
shieldCommitment,
shield.notePublicKey,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ export class RailgunVersionedSmartContracts {
chain: Chain,
transactions: (TransactionStructV2 | TransactionStructV3)[],
): Promise<ContractTransaction> {
console.log('GENERATE TRANSACT: ', txidVersion, chain, transactions);

switch (txidVersion) {
case TXIDVersion.V2_PoseidonMerkle: {
const contractV2 = ContractStore.railgunSmartWalletContracts.getOrThrow(null, chain);
Expand Down
3 changes: 2 additions & 1 deletion src/contracts/relay-adapt/V2/relay-adapt-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,13 @@ export class RelayAdaptV2Contract {
unshieldAddress: string,
random31Bytes: string,
useDummyProof: boolean,
sendWithPublicWallet: boolean,
): Promise<ContractTransaction> {
const orderedCalls: ContractTransaction[] = await this.getOrderedCallsForUnshieldBaseToken(
unshieldAddress,
);

const requireSuccess = useDummyProof;
const requireSuccess = sendWithPublicWallet;
return this.populateRelay(transactions, random31Bytes, requireSuccess, orderedCalls, {});
}

Expand Down
4 changes: 3 additions & 1 deletion src/contracts/relay-adapt/__tests__/relay-adapt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ describe('relay-adapt', function test() {
ethersWallet.address,
random,
true, // useDummyProof
false, // sendWithPublicWallet
);

relayTransactionGasEstimate.from = DEAD_ADDRESS;
Expand Down Expand Up @@ -386,7 +387,8 @@ describe('relay-adapt', function test() {
provedTransactions,
ethersWallet.address,
random,
true,
true, // useDummyProof
false, // sendWithPublicWallet
);

// 6: Send relay transaction.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class RelayAdaptVersionedSmartContracts {
unshieldAddress: string,
random31Bytes: string,
useDummyProof: boolean,
sendWithPublicWallet: boolean,
): Promise<ContractTransaction> {
switch (txidVersion) {
case TXIDVersion.V2_PoseidonMerkle: {
Expand All @@ -44,6 +45,7 @@ export class RelayAdaptVersionedSmartContracts {
unshieldAddress,
random31Bytes,
useDummyProof,
sendWithPublicWallet,
);
}
case TXIDVersion.V3_PoseidonMerkle: {
Expand Down
2 changes: 2 additions & 0 deletions src/validation/__tests__/extract-transaction-data.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ describe('extract-transaction-data', () => {
MOCK_ETH_WALLET_ADDRESS,
RANDOM_RELAY_ADAPT,
false, // useDummyProof
false, // sendWithPublicWallet
);
const firstNoteERC20AmountMap = await extractFirstNoteERC20AmountMapFromTransactionRequest(
txidVersion,
Expand Down Expand Up @@ -344,6 +345,7 @@ describe('extract-transaction-data', () => {
MOCK_ETH_WALLET_ADDRESS,
RANDOM_RELAY_ADAPT,
false, // useDummyProof
false, // sendWithPublicWallet
);
const firstNoteERC20AmountMap = await extractFirstNoteERC20AmountMapFromTransactionRequest(
txidVersion,
Expand Down
Loading