Skip to content

Commit

Permalink
fix: update deployment of the gas-token
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Apr 19, 2024
1 parent 991be67 commit 0f079b2
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 41 deletions.
6 changes: 3 additions & 3 deletions l1-contracts/src/core/libraries/ConstantsGen.sol
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ library Constants {
uint256 internal constant DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_MAGIC_VALUE =
0x85864497636cf755ae7bde03f267ce01a520981c21c3682aaf82a631;
uint256 internal constant DEPLOYER_CONTRACT_ADDRESS =
0x1f47133752dfcd9604f2d89c631797a84ed207c1c51d08533226dafcc8bd8548;
0x16fecaae197fc0ca96aad02591df0d4176681795b136155429cf2213b79405d3;
uint256 internal constant DEFAULT_GAS_LIMIT = 1_000_000_000;
uint256 internal constant DEFAULT_TEARDOWN_GAS_LIMIT = 100_000_000;
uint256 internal constant DEFAULT_MAX_FEE_PER_GAS = 10;
Expand All @@ -99,9 +99,9 @@ library Constants {
uint256 internal constant GAS_LENGTH = 3;
uint256 internal constant GAS_SETTINGS_LENGTH =
GAS_LENGTH * 2 + GAS_FEES_LENGTH /* inclusion_fee */ + 1;
uint256 internal constant CALL_CONTEXT_LENGTH = 7;
uint256 internal constant CALL_CONTEXT_LENGTH = 6;
uint256 internal constant CONTENT_COMMITMENT_LENGTH = 4;
uint256 internal constant CONTRACT_INSTANCE_LENGTH = 6;
uint256 internal constant CONTRACT_INSTANCE_LENGTH = 5;
uint256 internal constant CONTRACT_STORAGE_READ_LENGTH = 2;
uint256 internal constant CONTRACT_STORAGE_UPDATE_REQUEST_LENGTH = 2;
uint256 internal constant ETH_ADDRESS_LENGTH = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ global REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_MAGIC_VALUE = 0xe7af8166354
// CONTRACT INSTANCE CONSTANTS
// sha224sum 'struct ContractInstanceDeployed'
global DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_MAGIC_VALUE = 0x85864497636cf755ae7bde03f267ce01a520981c21c3682aaf82a631;
global DEPLOYER_CONTRACT_ADDRESS = 0x1f47133752dfcd9604f2d89c631797a84ed207c1c51d08533226dafcc8bd8548;
global DEPLOYER_CONTRACT_ADDRESS = 0x16fecaae197fc0ca96aad02591df0d4176681795b136155429cf2213b79405d3;

// GAS DEFAULTS
global DEFAULT_GAS_LIMIT: u32 = 1_000_000_000;
Expand Down
17 changes: 10 additions & 7 deletions yarn-project/aztec/src/sandbox.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env -S node --no-warnings
import { type AztecNodeConfig, AztecNodeService, getConfigEnvVars } from '@aztec/aztec-node';
import { type AztecAddress, BatchCall, SignerlessWallet, type Wallet } from '@aztec/aztec.js';
import { deployInstance, registerContractClass } from '@aztec/aztec.js/deployment';
import { type AztecAddress, SignerlessWallet, type Wallet } from '@aztec/aztec.js';
import { DefaultMultiCallEntrypoint } from '@aztec/aztec.js/entrypoint';
import { type AztecNode } from '@aztec/circuit-types';
import {
Expand Down Expand Up @@ -30,6 +29,7 @@ import {
RollupAbi,
RollupBytecode,
} from '@aztec/l1-artifacts';
import { GasTokenContract } from '@aztec/noir-contracts.js/GasToken';
import { getCanonicalGasToken } from '@aztec/protocol-contracts/gas-token';
import { type PXEServiceConfig, createPXEService, getPXEServiceConfig } from '@aztec/pxe';

Expand Down Expand Up @@ -172,12 +172,15 @@ async function deployCanonicalL2GasToken(deployer: Wallet, l1ContractAddresses:
return;
}

const batch = new BatchCall(deployer, [
(await registerContractClass(deployer, canonicalGasToken.artifact)).request(),
deployInstance(deployer, canonicalGasToken.instance).request(),
]);
const gasToken = await GasTokenContract.deploy(deployer, gasPortalAddress)
.send({ contractAddressSalt: canonicalGasToken.instance.salt, universalDeploy: true })
.deployed();

await batch.send().wait();
if (gasToken.address !== canonicalGasToken.address) {
throw new Error(
`Deployed Gas Token address ${gasToken.address} does not match expected address ${canonicalGasToken.address}`,
);
}

logger.info(`Deployed Gas Token on L2 at ${canonicalGasToken.address}`);
}
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/circuits.js/src/constants.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const REGISTERER_UNCONSTRAINED_FUNCTION_BROADCASTED_MAGIC_VALUE =
0xe7af816635466f128568edb04c9fa024f6c87fb9010fdbffa68b3d99n;
export const DEPLOYER_CONTRACT_INSTANCE_DEPLOYED_MAGIC_VALUE =
0x85864497636cf755ae7bde03f267ce01a520981c21c3682aaf82a631n;
export const DEPLOYER_CONTRACT_ADDRESS = 0x1f47133752dfcd9604f2d89c631797a84ed207c1c51d08533226dafcc8bd8548n;
export const DEPLOYER_CONTRACT_ADDRESS = 0x16fecaae197fc0ca96aad02591df0d4176681795b136155429cf2213b79405d3n;
export const DEFAULT_GAS_LIMIT = 1_000_000_000;
export const DEFAULT_TEARDOWN_GAS_LIMIT = 100_000_000;
export const DEFAULT_MAX_FEE_PER_GAS = 10;
Expand All @@ -83,7 +83,7 @@ export const AZTEC_ADDRESS_LENGTH = 1;
export const GAS_FEES_LENGTH = 3;
export const GAS_LENGTH = 3;
export const GAS_SETTINGS_LENGTH = GAS_LENGTH * 2 + GAS_FEES_LENGTH + /* inclusion_fee */ 1;
export const CALL_CONTEXT_LENGTH = 7;
export const CALL_CONTEXT_LENGTH = 6;
export const CONTENT_COMMITMENT_LENGTH = 4;
export const CONTRACT_INSTANCE_LENGTH = 5;
export const CONTRACT_STORAGE_READ_LENGTH = 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports[`ContractAddress Address from partial matches Noir 1`] = `"0x1b6ead051e7

exports[`ContractAddress Public key hash matches Noir 1`] = `"0x22d83a089d7650514c2de24cd30185a414d943eaa19817c67bffe2c3183006a3"`;

exports[`ContractAddress computeContractAddressFromInstance 1`] = `"0x1b61d59f21fcb9653c56b86f5e45f2d0b69dcbb7efebfbcda6f53eb7abaaa4eb"`;
exports[`ContractAddress computeContractAddressFromInstance 1`] = `"0x0bed63221d281713007bfb0c063e1f61d0646404fb3701b99bb92f41b6390604"`;

exports[`ContractAddress computeInitializationHash 1`] = `Fr<0x109865e4b959adba34b722e72a69baaf9ee78e31bb1042318f0d91006ed86780>`;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`PrivateCallStackItem computes empty item hash 1`] = `Fr<0x25d9c6ba3de2cf8baec904e5c1ba76e130c5181bc2d6c4f1ceea4663287ba9ba>`;
exports[`PrivateCallStackItem computes empty item hash 1`] = `Fr<0x138c6ad441864ce43487e99d5e1e122c38b4b55d893edec04a32f5aacecc856c>`;

exports[`PrivateCallStackItem computes hash 1`] = `Fr<0x1b183e4ba97199f9b205f7748e363d628a8624156f95ebf306c5da1925a79ddc>`;
exports[`PrivateCallStackItem computes hash 1`] = `Fr<0x05d108b08c41f27b8cd03753347993a77a0e7637ed2afdd03c3813ab92bfbb78>`;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`PrivateCircuitPublicInputs computes empty inputs hash 1`] = `Fr<0x0a61fd8a00a3d160e723b316437484bf643f8ed7952031e493717e1f0f1f9345>`;
exports[`PrivateCircuitPublicInputs computes empty inputs hash 1`] = `Fr<0x2517b9a84487bde68e18647e59530c6ffe4a7a88c5c556f013d09fd22b84ba35>`;

exports[`PrivateCircuitPublicInputs hash matches snapshot 1`] = `Fr<0x16cda30b8402ab87d4892f801a91868ec9571748441c6e4abc796d17418bd1cc>`;
exports[`PrivateCircuitPublicInputs hash matches snapshot 1`] = `Fr<0x0edeaf808ed3d5e61d2fffa2bf089f9e9109eba5c5d42d3523b5470734d56347>`;
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`PublicCallStackItem Computes a callstack item hash 1`] = `"0x2bf24099a6954a9bb9be6689fd765366fbb94fb25328d7e3942698ae891bbfad"`;
exports[`PublicCallStackItem Computes a callstack item hash 1`] = `"0x1f3f1902ca41ffd6fd7191fa5a52edd677444a9b6ae8f4448336fa71a4b2d5cc"`;

exports[`PublicCallStackItem Computes a callstack item request hash 1`] = `"0x18e440e4e58ed510c02062986f71ef37ed610fc300b8baab334fd543758b9f11"`;
exports[`PublicCallStackItem Computes a callstack item request hash 1`] = `"0x1b06f4a4960455e9f01c20d4cb01afbf8c8f39eb50094c5d1ad6725ced0f7d08"`;

exports[`PublicCallStackItem computes empty item hash 1`] = `Fr<0x14d45139af9cc8f9a5a8537de0615a093ec755974d3460ce921eb78f9a533863>`;
exports[`PublicCallStackItem computes empty item hash 1`] = `Fr<0x040c3667dd703bad4465ba5d12e7a422959395f76299794aa9eeaf5044d9e157>`;

exports[`PublicCallStackItem computes hash 1`] = `Fr<0x15fd7b945b88bba32060703eee30a4db98c35b291c5c0c211c03cd4a77436953>`;
exports[`PublicCallStackItem computes hash 1`] = `Fr<0x0f3fde3c615e9d95337fbbf3f835b3e26187de0de9f199320b53355f4089bb88>`;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`PublicCircuitPublicInputs computes empty inputs hash 1`] = `Fr<0x19eaa0a5aea3d131456d0daffc2d79fd27db9c201e91475ab620801b78504d79>`;
exports[`PublicCircuitPublicInputs computes empty inputs hash 1`] = `Fr<0x237c89f8b29c3fb169b889940a714b3c72017cb2941d0724d4668a030794d2fb>`;

exports[`PublicCircuitPublicInputs hash matches snapshot 1`] = `Fr<0x090fe4de8ca3cb2395490ef4e8e3ca0fc722168719726cdf7ee6999de3295767>`;
exports[`PublicCircuitPublicInputs hash matches snapshot 1`] = `Fr<0x0d22cf387fb73386318033d92d07d203ad5c3d1e332734fa58b9ec08fbf0ceac>`;
15 changes: 7 additions & 8 deletions yarn-project/end-to-end/src/fixtures/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
RollupAbi,
RollupBytecode,
} from '@aztec/l1-artifacts';
import { GasTokenContract } from '@aztec/noir-contracts.js/GasToken';
import { getCanonicalGasToken, getCanonicalGasTokenAddress } from '@aztec/protocol-contracts/gas-token';
import { PXEService, type PXEServiceConfig, createPXEService, getPXEServiceConfig } from '@aztec/pxe';
import { type SequencerClient } from '@aztec/sequencer-client';
Expand Down Expand Up @@ -577,13 +578,11 @@ export async function deployCanonicalGasToken(deployer: Wallet) {
return;
}

await new BatchCall(deployer, [
(await registerContractClass(deployer, canonicalGasToken.artifact)).request(),
deployInstance(deployer, canonicalGasToken.instance).request(),
])
.send()
.wait();
const gasToken = await GasTokenContract.deploy(deployer, gasPortalAddress)
.send({ contractAddressSalt: canonicalGasToken.instance.salt, universalDeploy: true })
.deployed();

await expect(deployer.isContractClassPubliclyRegistered(canonicalGasToken.contractClass.id)).resolves.toBe(true);
await expect(deployer.getContractInstance(canonicalGasToken.instance.address)).resolves.toBeDefined();
await expect(deployer.isContractClassPubliclyRegistered(gasToken.instance.contractClassId)).resolves.toBe(true);
await expect(deployer.getContractInstance(gasToken.address)).resolves.toBeDefined();
await expect(deployer.isContractPubliclyDeployed(gasToken.address)).resolves.toBe(true);
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ describe('e2e_deploy_contract private initialization', () => {
// Tests privately initializing multiple undeployed contracts on the same tx through an account contract.
it('initializes multiple undeployed contracts in a single tx', async () => {
const owner = await t.registerRandomAccount();
const initArgss: StatefulContractCtorArgs[] = [42, 52].map(value => [owner, value]);
const initArgs: StatefulContractCtorArgs[] = [42, 52].map(value => [owner, value]);
const contracts = await Promise.all(
initArgss.map(initArgs => t.registerContract(wallet, StatefulTestContract, { initArgs })),
initArgs.map(initArgs => t.registerContract(wallet, StatefulTestContract, { initArgs })),
);
const calls = contracts.map((c, i) => c.methods.constructor(...initArgss[i]).request());
const calls = contracts.map((c, i) => c.methods.constructor(...initArgs[i]).request());
await new BatchCall(wallet, calls).send().wait();
expect(await contracts[0].methods.summed_values(owner).simulate()).toEqual(42n);
expect(await contracts[1].methods.summed_values(owner).simulate()).toEqual(52n);
Expand Down
1 change: 1 addition & 0 deletions yarn-project/end-to-end/src/skip_e2e_fees.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,7 @@ describe('e2e_fees', () => {
// Mint bananas privately
const secret = Fr.random();
const secretHash = computeMessageSecretHash(secret);
logger.debug(`Minting ${amount} bananas privately for ${address} with secret ${secretHash.toString()}`);
const receipt = await bananaCoin.methods.mint_private(amount, secretHash).send().wait();

// Setup auth wit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4366,9 +4366,8 @@ exports[`Data generation for noir tests Computes contract info for defaultContra
artifact_hash: 0x0000000000000000000000000000000000000000000000000000000000003039,
public_bytecode_commitment: 0x129a3438653fe147133b2c274757920e37896305e7664c8c1eb380be3efd5fed,
private_functions_root: 0x19a3cc0b714976fb35d58b684ba36e86f82bac8b87517904a2727e5113fb4cba,
address: AztecAddress { inner: 0x2d941148ee5adeece35991d32acbcf4200742991c61990dee965bedf729d21a9 },
partial_address: PartialAddress { inner: 0x23a6933a485200a8d34b9929d61868c9635793f878d67ce86a1b1355c0ab0d47 },
portal_contract_address: EthAddress { inner: 0x0000000000000000000000000000000000005ba0 },
address: AztecAddress { inner: 0x0efbcdd92da9729c276193e01399cd12a30c2ea0774feec95de486cb3986c0a0 },
partial_address: PartialAddress { inner: 0x30248868d815221789c5f173462ee99637ac9748000d31c5f311dbc3d996eb71 },
contract_class_id: ContractClassId { inner: 0x0ce2a998337b1e6da1ac1d802a8bb9e10b7d705d210e61efb9642855009814a6 },
public_keys_hash: PublicKeysHash { inner: 0x000000000000000000000000000000000000000000000000000000000000b26e },
salted_initialization_hash: SaltedInitializationHash { inner: 0x25765504545d2cdaaa6544eb24bc78a3e20384452f2525669f196a1a42f45906 },
Expand All @@ -4382,9 +4381,8 @@ exports[`Data generation for noir tests Computes contract info for parentContrac
artifact_hash: 0x00000000000000000000000000000000000000000000000000000000000004bc,
public_bytecode_commitment: 0x1435ed970b275bebf95de3df53f23f3d2e97c9b54cf442bb03a3fa17a0ee3cd7,
private_functions_root: 0x2c1c949cb226995de94b7b8b5aeaab440739f2dfeb06d358441f60932cf243a7,
address: AztecAddress { inner: 0x24692d7dbb532557c7466e8782d1fe99077e4787570414bd1a5e8fa5300caad8 },
partial_address: PartialAddress { inner: 0x127bbd73a3cf497fb2d85342571695d894985b449a9343eec55485e9cbc514f8 },
portal_contract_address: EthAddress { inner: 0x0000000000000000000000000000000000000913 },
address: AztecAddress { inner: 0x2dbb8c3db287eef6758cc13b1702ff6c5a4b534a8d0f08d76106e28aa0f4bd3c },
partial_address: PartialAddress { inner: 0x20ac96f5da24137797077661d4222c8caf97d2d3fdeadbf4cad8f529a96eb610 },
contract_class_id: ContractClassId { inner: 0x1f1f963a350e2c883cc6730c19fc5d5b47a40694d805cbb0720fa76fe295df90 },
public_keys_hash: PublicKeysHash { inner: 0x00000000000000000000000000000000000000000000000000000000000011c1 },
salted_initialization_hash: SaltedInitializationHash { inner: 0x0b1d457cdacb66e76eccb29a4e34dff5ae10b9d3d2f0d85b59aa8cf68bd1cf86 },
Expand Down

0 comments on commit 0f079b2

Please sign in to comment.