Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export abstract class EcdsaKBaseAccountContract extends DefaultAccountContract {
const signingPublicKey = await new Ecdsa().computePublicKey(this.signingPrivateKey);
return {
constructorName: 'constructor',
constructorArgs: [signingPublicKey.subarray(0, 32), signingPublicKey.subarray(32, 64)],
constructorArgs: [[...signingPublicKey.subarray(0, 32)], [...signingPublicKey.subarray(32, 64)]],
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export abstract class EcdsaRBaseAccountContract extends DefaultAccountContract {
const signingPublicKey = await new Ecdsa('secp256r1').computePublicKey(this.signingPrivateKey);
return {
constructorName: 'constructor',
constructorArgs: [signingPublicKey.subarray(0, 32), signingPublicKey.subarray(32, 64)],
constructorArgs: [[...signingPublicKey.subarray(0, 32)], [...signingPublicKey.subarray(32, 64)]],
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export abstract class EcdsaRSSHBaseAccountContract extends DefaultAccountContrac
getInitializationFunctionAndArgs() {
return Promise.resolve({
constructorName: 'constructor',
constructorArgs: [this.signingPublicKey.subarray(0, 32), this.signingPublicKey.subarray(32, 64)],
constructorArgs: [[...this.signingPublicKey.subarray(0, 32)], [...this.signingPublicKey.subarray(32, 64)]],
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe.skip('AVM proven gadgets test', () => {
{
address: avmGadgetsTestContract.address,
fnName: 'keccak_hash_1400',
args: [/*input=*/ Array.from({ length: 2400 }, () => randomInt(2 ** 8))],
args: [/*input=*/ Array.from({ length: 1400 }, () => randomInt(2 ** 8))],
},
],
);
Expand Down
10 changes: 4 additions & 6 deletions yarn-project/end-to-end/src/composed/ha/e2e_ha_full.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,8 @@ describe('HA Full Setup', () => {

// Deploy a contract to trigger block building
const deployer = new ContractDeployer(StatefulTestContractArtifact, wallet);
const sender = ownerAddress;

logger.info(`Deploying contract from ${sender}`);
const { receipt } = await deployer.deploy(ownerAddress, sender, 1).send({
logger.info(`Deploying contract from ${ownerAddress}`);
const { receipt } = await deployer.deploy(ownerAddress, 1).send({
from: ownerAddress,
contractAddressSalt: new Fr(BigInt(1)),
wait: { returnReceipt: true },
Expand Down Expand Up @@ -399,7 +397,7 @@ describe('HA Full Setup', () => {
// Send a transaction to trigger block building which will also trigger voting
logger.info('Sending transaction to trigger block building...');
const deployer = new ContractDeployer(StatefulTestContractArtifact, wallet);
const { receipt } = await deployer.deploy(ownerAddress, ownerAddress, 42).send({
const { receipt } = await deployer.deploy(ownerAddress, 42).send({
from: ownerAddress,
contractAddressSalt: Fr.random(),
wait: { returnReceipt: true },
Expand Down Expand Up @@ -515,7 +513,7 @@ describe('HA Full Setup', () => {
logger.info(`Active nodes: ${haNodeServices.length - killedNodes.length}/${NODE_COUNT}`);

const deployer = new ContractDeployer(StatefulTestContractArtifact, wallet);
const { receipt } = await deployer.deploy(ownerAddress, ownerAddress, i + 100).send({
const { receipt } = await deployer.deploy(ownerAddress, i + 100).send({
from: ownerAddress,
contractAddressSalt: new Fr(BigInt(i + 100)),
wait: { returnReceipt: true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,9 @@ describe('e2e_multi_validator_node', () => {
await rmdir(keyStoreDirectory, { recursive: true });
});

const sendTx = (sender: AztecAddress, contractAddressSalt: Fr) => {
const sendTx = (contractAddressSalt: Fr) => {
const deployer = new ContractDeployer(artifact, wallet);
return deployer.deploy(ownerAddress, sender, 1).send({
return deployer.deploy(ownerAddress, 1).send({
from: ownerAddress,
contractAddressSalt,
skipClassPublication: true,
Expand Down Expand Up @@ -398,7 +398,7 @@ describe('e2e_multi_validator_node', () => {
// Then we check the results captured above
const sentTransactionPromises = Array.from({ length: BLOCK_COUNT }, (_, i) => {
const contractAddressSalt = new Fr(i + 1);
return sendTx(ownerAddress, contractAddressSalt);
return sendTx(contractAddressSalt);
});

const settledTransactions = await Promise.all(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { computeSecretHash } from '@aztec/aztec.js/crypto';
import { Fr } from '@aztec/aztec.js/fields';
import type { TxHash } from '@aztec/aztec.js/tx';

import { BITSIZE_TOO_BIG_ERROR, U128_OVERFLOW_ERROR } from '../fixtures/index.js';
import { U128_OVERFLOW_ERROR } from '../fixtures/index.js';
import { BlacklistTokenContractTest } from './blacklist_token_contract_test.js';

describe('e2e_blacklist_token_contract mint', () => {
Expand Down Expand Up @@ -44,14 +44,6 @@ describe('e2e_blacklist_token_contract mint', () => {
);
});

// TODO(#12221): re-enable this test once we have proper unsigned integer overflow checks
it.skip('mint >u128 tokens to overflow', async () => {
const amount = 2n ** 128n; // u128::max() + 1;
await expect(asset.methods.mint_public(adminAddress, amount).simulate({ from: adminAddress })).rejects.toThrow(
BITSIZE_TOO_BIG_ERROR,
);
});

it('mint <u128 but recipient balance >u128', async () => {
const amount = 2n ** 128n - tokenSim.balanceOfPublic(adminAddress);
await expect(asset.methods.mint_public(adminAddress, amount).simulate({ from: adminAddress })).rejects.toThrow(
Expand Down Expand Up @@ -124,14 +116,6 @@ describe('e2e_blacklist_token_contract mint', () => {
);
});

// TODO(#12221): re-enable this test once we have proper unsigned integer overflow checks
it.skip('mint >u128 tokens to overflow', async () => {
const amount = 2n ** 128n; // u128::max() + 1;
await expect(asset.methods.mint_private(amount, secretHash).simulate({ from: adminAddress })).rejects.toThrow(
BITSIZE_TOO_BIG_ERROR,
);
});

it('mint <u128 but recipient balance >u128', async () => {
const amount = 2n ** 128n - tokenSim.balanceOfPrivate(adminAddress);
expect(amount).toBeLessThan(2n ** 128n);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ describe('e2e_deploy_contract contract class registration', () => {
describe('error scenarios in deployment', () => {
it('app logic call to an undeployed contract reverts, but can be included', async () => {
const whom = defaultAccountAddress;
const sender = whom;
const instance = await t.registerContract(wallet, StatefulTestContract, { initArgs: [whom, sender, 42] });
const instance = await t.registerContract(wallet, StatefulTestContract, { initArgs: [whom, 42] });
// Confirm that the tx reverts with the expected message
await expect(
instance.methods.increment_public_value_no_init_check(whom, 10).simulate({ from: defaultAccountAddress }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,8 @@ describe('e2e_multi_validator_node', () => {
it('should build blocks & attest with multiple validator keys', async () => {
const deployer = new ContractDeployer(artifact, wallet);

const sender = ownerAddress;
logger.info(`Deploying contract from ${sender}`);
const { receipt: tx } = await deployer.deploy(ownerAddress, sender, 1).send({
logger.info(`Deploying contract from ${ownerAddress}`);
const { receipt: tx } = await deployer.deploy(ownerAddress, 1).send({
from: ownerAddress,
contractAddressSalt: new Fr(BigInt(1)),
wait: { returnReceipt: true },
Expand Down Expand Up @@ -171,11 +170,9 @@ describe('e2e_multi_validator_node', () => {
expect(committee?.length).toBe(COMMITTEE_SIZE);

// new aztec transaction
const sender = ownerAddress;

logger.info(`Deploying contract from ${sender}`);
logger.info(`Deploying contract from ${ownerAddress}`);
const deployer = new ContractDeployer(artifact, wallet);
const { receipt: tx } = await deployer.deploy(ownerAddress, sender, 1).send({
const { receipt: tx } = await deployer.deploy(ownerAddress, 1).send({
from: ownerAddress,
contractAddressSalt: new Fr(BigInt(1)),
wait: { returnReceipt: true },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ describe('e2e_reload_keystore', () => {

// Send a tx and verify the block uses the initial coinbase
const deployer = new ContractDeployer(artifact, wallet);
const { txHash: sentTx1 } = await deployer.deploy(ownerAddress, ownerAddress, 1).send({
const { txHash: sentTx1 } = await deployer.deploy(ownerAddress, 1).send({
from: ownerAddress,
contractAddressSalt: new Fr(1),
wait: NO_WAIT,
Expand Down Expand Up @@ -195,7 +195,7 @@ describe('e2e_reload_keystore', () => {
// Whichever validator is the proposer, its coinbase must be from the reloaded keystore.
const allNewCoinbasesLower = newCoinbases.map(c => c.toString().toLowerCase());

const { txHash: sentTx2 } = await deployer.deploy(ownerAddress, ownerAddress, 2).send({
const { txHash: sentTx2 } = await deployer.deploy(ownerAddress, 2).send({
from: ownerAddress,
contractAddressSalt: new Fr(2),
wait: NO_WAIT,
Expand Down
3 changes: 1 addition & 2 deletions yarn-project/end-to-end/src/e2e_simple.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ describe('e2e_simple', () => {
it('deploys a contract', async () => {
const deployer = new ContractDeployer(artifact, wallet);

const sender = ownerAddress;
const { receipt: txReceipt } = await deployer.deploy(ownerAddress, sender, 1).send({
const { receipt: txReceipt } = await deployer.deploy(ownerAddress, 1).send({
from: ownerAddress,
contractAddressSalt: new Fr(BigInt(1)),
wait: { returnReceipt: true },
Expand Down
5 changes: 1 addition & 4 deletions yarn-project/end-to-end/src/e2e_static_calls.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,7 @@ describe('e2e_static_calls', () => {
it('fails when performing non-static enqueue calls to poorly written public static functions', async () => {
await expect(
parentContract.methods
.enqueue_call(childContract.address, await childContract.methods.pub_illegal_inc_value.selector(), [
42n,
owner,
])
.enqueue_call(childContract.address, await childContract.methods.pub_illegal_inc_value.selector(), [42n])
.simulate({ from: owner }),
).rejects.toThrow(STATIC_CONTEXT_ASSERTION_ERROR);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,13 @@ describe('e2e_token_contract minting', () => {
).rejects.toThrow('Assertion failed: caller is not minter');
});

// This test is expected to fail at the ABI encoder rather than during contract logic.
// We keep the test to be defensive as it is the only e2e test with overflowed inputs.
it('mint >u128 tokens to overflow', async () => {
const overflowAmount = 2n ** 128n;

await expect(
asset.methods.mint_to_private(adminAddress, overflowAmount).simulate({ from: adminAddress }),
).rejects.toThrow('Cannot satisfy constraint');
).rejects.toThrow('does not fit in u128');
});

it('mint <u128 but recipient balance >u128', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ describe('Private Execution test suite', () => {
});

it('should have a constructor with arguments that inserts notes', async () => {
const initArgs = [owner, owner, 140];
const initArgs = [owner, 140];
const instance = await getContractInstanceFromInstantiationParams(StatefulTestContractArtifact, {
constructorArgs: initArgs,
salt: Fr.random(),
Expand Down Expand Up @@ -594,7 +594,7 @@ describe('Private Execution test suite', () => {

it('should run the create_note function', async () => {
const { entrypoint: result } = await runSimulator({
args: [owner, owner, 140],
args: [owner, 140],
artifact: StatefulTestContractArtifact,
anchorBlockHeader,
functionName: 'create_note_no_init_check',
Expand Down
6 changes: 2 additions & 4 deletions yarn-project/simulator/src/public/fixtures/bulk_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ export async function bulkTest(
// for it to use as "expected" values when testing contract instance retrieval.
const expectContractInstance = avmTestContract;
const argsField = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(x => new Fr(x));
const argsU8 = [1, 2, 3, 4, 5, 6, 7, 8].map(x => new Fr(x));
argsU8.push(new Fr(2n ** 128n + 9n)); // Trigger truncation from large (> 128 bits) value (canonical decomposition event)
argsU8.push(new Fr(2n ** 125n + 10n)); // Trigger truncation from small (< 128 bits) value (no canonical decomposition event)
const argsU8 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(x => new Fr(x));
const args = [
argsField,
argsU8,
Expand Down Expand Up @@ -62,7 +60,7 @@ export async function bulkTest(
{
address: avmTestContract.address,
fnName: 'assert_calldata_copy',
args: [argsField.slice(3), /* with_selector: */ true],
args: [argsField.slice(0, 3), /* with_selector: */ true],
},
{
address: avmTestContract.address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('Public TX simulator apps tests: gadgets', () => {
{
address: avmGadgetsTestContract.address,
fnName: 'keccak_hash_1400',
args: [/*input=*/ Array.from({ length: 2400 }, () => randomInt(2 ** 8))],
args: [/*input=*/ Array.from({ length: 1400 }, () => randomInt(2 ** 8))],
},
],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ describe('Public TX simulator apps tests: benchmarks', () => {
{
address: avmGadgetsTestContract.address,
fnName: 'keccak_hash_1400',
args: [/*input=*/ Array.from({ length: 2400 }, () => randomInt(2 ** 8))],
args: [/*input=*/ Array.from({ length: 1400 }, () => randomInt(2 ** 8))],
},
],
);
Expand Down
Loading
Loading