-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: fixing broken sample-dapp tests #9597
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
// docs:start:imports | ||
import { getInitialTestAccountsWallets } from '@aztec/accounts/testing'; | ||
import { createPXEClient, waitForPXE } from '@aztec/aztec.js'; | ||
import { BatchCall, createPXEClient, waitForPXE } from '@aztec/aztec.js'; | ||
import { fileURLToPath } from '@aztec/foundation/url'; | ||
|
||
import { getToken } from './contracts.mjs'; | ||
|
@@ -33,13 +33,20 @@ async function showPrivateBalances(pxe) { | |
|
||
// docs:start:mintPrivateFunds | ||
async function mintPrivateFunds(pxe) { | ||
const [owner] = await getInitialTestAccountsWallets(pxe); | ||
const token = await getToken(owner); | ||
const [ownerWallet] = await getInitialTestAccountsWallets(pxe); | ||
const token = await getToken(ownerWallet); | ||
|
||
await showPrivateBalances(pxe); | ||
|
||
const mintAmount = 20n; | ||
await mintTokensToPrivate(token, owner, owner.getAddress(), mintAmount); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The issue here was missing import of |
||
// We don't have the functionality to mint to private so we mint to the owner address in public and transfer | ||
// the tokens to the recipient in private. We use BatchCall to speed the process up. | ||
await new BatchCall(ownerWallet, [ | ||
token.methods.mint_public(ownerWallet.getAddress(), mintAmount).request(), | ||
token.methods.transfer_to_private(ownerWallet.getAddress(), mintAmount).request(), | ||
]) | ||
.send() | ||
.wait(); | ||
|
||
await showPrivateBalances(pxe); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ import { deployToken } from '../fixtures/token_utils'; | |
|
||
const { PXE_URL = 'http://localhost:8080', ETHEREUM_HOST = 'http://localhost:8545' } = process.env; | ||
|
||
// Note: To run this test you need to spin up Aztec sandbox. Build the aztec image (or pull it with aztec-up if on | ||
// master) and then run this test as usual (yarn test src/sample-dapp/index.test.mjs). | ||
describe('token', () => { | ||
// docs:start:setup | ||
let owner, recipient, token; | ||
|
@@ -16,7 +18,7 @@ describe('token', () => { | |
recipient = await createAccount(pxe); | ||
|
||
const initialBalance = 69; | ||
await deployToken(owner, initialBalance, createDebugLogger('sample_dapp')); | ||
token = await deployToken(owner, initialBalance, createDebugLogger('sample_dapp')); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the fix. Forgot to assign to the variable. Not having this checked by the build process does not help. |
||
}, 120_000); | ||
// docs:end:setup | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,14 +50,14 @@ export const ProtocolContractAddress: Record<ProtocolContractName, AztecAddress> | |
}; | ||
|
||
export const ProtocolContractLeaf = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This got randomly included. |
||
AuthRegistry: Fr.fromString('0x13794ed6c957a68bc852fe4c2a161019a53011b08331d8eb0287483a7845d334'), | ||
AuthRegistry: Fr.fromString('0x16f00633c07cb18f29a819d16a8b5140dea24787ca2a030dc54379a8e6896e3e'), | ||
ContractInstanceDeployer: Fr.fromString('0x04a661c9d4d295fc485a7e0f3de40c09b35366343bce8ad229106a8ef4076fe5'), | ||
ContractClassRegisterer: Fr.fromString('0x147ba3294403576dbad10f86d3ffd4eb83fb230ffbcd5c8b153dd02942d0611f'), | ||
MultiCallEntrypoint: Fr.fromString('0x154b701b41d6cf6da7204fef36b2ee9578b449d21b3792a9287bf45eba48fd26'), | ||
FeeJuice: Fr.fromString('0x146cb9b7cda808b4d5e066773e2fe0131d4ac4f7238bc0f093dce70f7c0f3421'), | ||
Router: Fr.fromString('0x19e9ec99aedfe3ea69ba91b862b815df7d1796fa802985a154159cd739fe4817'), | ||
FeeJuice: Fr.fromString('0x2422b0101aba5f5050e8c086a6bdd62b185b188acfba58c77b0016769b96efd6'), | ||
Router: Fr.fromString('0x1cedd0ce59239cb4d55408257d8942bdbd1ac6f0ddab9980157255391dbaa596'), | ||
}; | ||
|
||
export const protocolContractTreeRoot = Fr.fromString( | ||
'0x149eb7ca5c1f23580f2449edfbb65ec70160e5d4b6f8313f061b8a8d73d014ab', | ||
'0x21fb5ab0a0a9b4f282d47d379ec7b5fdf59457a19a593c17f7c29954e1e88dec', | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sneaked these changes in as the naming was stale and confusing. This is of type Wallet and is called Wallet everywhere else.