Skip to content

Commit

Permalink
not exposing helpers in yarn-project
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Jan 17, 2024
1 parent 273f241 commit 47f53a0
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 158 deletions.
15 changes: 0 additions & 15 deletions docs/docs/dev_docs/getting_started/aztecjs-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@ A successful run should show something like this:
token },
token contractDeploymentEmitterAddress: EthAddress {
token buffer: <Buffer 5f c8 d3 26 90 cc 91 d4 c3 9d 9d 3a bc bd 16 98 9f 87 57 07>
token },
token decoderHelperAddress: EthAddress {
token buffer: <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>
token }
token }
token } +0ms
Expand Down Expand Up @@ -189,9 +186,6 @@ Now that we have our accounts loaded, let's move on to deploy our pre-compiled t
token },
token contractDeploymentEmitterAddress: EthAddress {
token buffer: <Buffer 5f c8 d3 26 90 cc 91 d4 c3 9d 9d 3a bc bd 16 98 9f 87 57 07>
token },
token decoderHelperAddress: EthAddress {
token buffer: <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>
token }
token }
token } +0ms
Expand Down Expand Up @@ -244,9 +238,6 @@ Running now should yield output:
token },
token contractDeploymentEmitterAddress: EthAddress {
token buffer: <Buffer 5f c8 d3 26 90 cc 91 d4 c3 9d 9d 3a bc bd 16 98 9f 87 57 07>
token },
token decoderHelperAddress: EthAddress {
token buffer: <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>
token }
token }
token } +0ms
Expand Down Expand Up @@ -309,9 +300,6 @@ Our output should now look like this:
token },
token contractDeploymentEmitterAddress: EthAddress {
token buffer: <Buffer 5f c8 d3 26 90 cc 91 d4 c3 9d 9d 3a bc bd 16 98 9f 87 57 07>
token },
token decoderHelperAddress: EthAddress {
token buffer: <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>
token }
token }
token } +0ms
Expand Down Expand Up @@ -369,9 +357,6 @@ Our complete output should now be something like:
token },
token contractDeploymentEmitterAddress: EthAddress {
token buffer: <Buffer 5f c8 d3 26 90 cc 91 d4 c3 9d 9d 3a bc bd 16 98 9f 87 57 07>
token },
token decoderHelperAddress: EthAddress {
token buffer: <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00>
token }
token }
token } +0ms
Expand Down
2 changes: 0 additions & 2 deletions yarn-project/archiver/src/archiver/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ export function getConfigEnvVars(): ArchiverConfig {
contractDeploymentEmitterAddress: CONTRACT_DEPLOYMENT_EMITTER_ADDRESS
? EthAddress.fromString(CONTRACT_DEPLOYMENT_EMITTER_ADDRESS)
: EthAddress.ZERO,
decoderHelperAddress: EthAddress.ZERO,
headerDecoderHelperAddress: EthAddress.ZERO,
};
return {
rpcUrl: ETHEREUM_HOST || 'http://127.0.0.1:8545/',
Expand Down
2 changes: 0 additions & 2 deletions yarn-project/aztec.js/src/contract/contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ describe('Contract Class', () => {
inboxAddress: EthAddress.random(),
outboxAddress: EthAddress.random(),
contractDeploymentEmitterAddress: EthAddress.random(),
decoderHelperAddress: EthAddress.random(),
headerDecoderHelperAddress: EthAddress.random(),
};
const mockNodeInfo: NodeInfo = {
nodeVersion: 'vx.x.x',
Expand Down
17 changes: 1 addition & 16 deletions yarn-project/end-to-end/src/fixtures/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,14 @@ import {
import {
ContractDeploymentEmitterAbi,
ContractDeploymentEmitterBytecode,
DecoderHelperAbi,
DecoderHelperBytecode,
HeaderDecoderHelperAbi,
HeaderDecoderHelperBytecode,
InboxAbi,
InboxBytecode,
OutboxAbi,
OutboxBytecode,
RegistryAbi,
RegistryBytecode,
RollupAbi,
RollupBytecode,
RollupBytecode
} from '@aztec/l1-artifacts';
import { PXEService, PXEServiceConfig, createPXEService, getPXEServiceConfig } from '@aztec/pxe';
import { SequencerClient } from '@aztec/sequencer-client';
Expand Down Expand Up @@ -73,7 +69,6 @@ export const setupL1Contracts = async (
l1RpcUrl: string,
account: HDAccount | PrivateKeyAccount,
logger: DebugLogger,
deployDecoderHelpers = false,
) => {
const l1Artifacts: L1ContractArtifactsForDeployment = {
contractDeploymentEmitter: {
Expand All @@ -97,16 +92,6 @@ export const setupL1Contracts = async (
contractBytecode: RollupBytecode,
},
};
if (deployDecoderHelpers) {
l1Artifacts.decoderHelper = {
contractAbi: DecoderHelperAbi,
contractBytecode: DecoderHelperBytecode,
};
l1Artifacts.headerDecoderHelper = {
contractAbi: HeaderDecoderHelperAbi,
contractBytecode: HeaderDecoderHelperBytecode,
};
}
return await deployL1Contracts(l1RpcUrl, account, localAnvil, logger, l1Artifacts);
};

Expand Down
76 changes: 1 addition & 75 deletions yarn-project/end-to-end/src/integration_l1_publisher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
} from '@aztec/circuits.js/factories';
import { createEthereumChain } from '@aztec/ethereum';
import { makeTuple, range } from '@aztec/foundation/array';
import { DecoderHelperAbi, HeaderDecoderHelperAbi, InboxAbi, OutboxAbi, RollupAbi } from '@aztec/l1-artifacts';
import { InboxAbi, OutboxAbi, RollupAbi } from '@aztec/l1-artifacts';
import {
EmptyRollupProver,
L1Publisher,
Expand Down Expand Up @@ -79,8 +79,6 @@ describe('L1Publisher integration', () => {
let rollupAddress: Address;
let inboxAddress: Address;
let outboxAddress: Address;
let decoderHelperAddress: Address;
let headerDecoderHelperAddress: Address;

let rollup: GetContractReturnType<typeof RollupAbi, PublicClient<HttpTransport, Chain>>;
let inbox: GetContractReturnType<
Expand All @@ -89,8 +87,6 @@ describe('L1Publisher integration', () => {
WalletClient<HttpTransport, Chain>
>;
let outbox: GetContractReturnType<typeof OutboxAbi, PublicClient<HttpTransport, Chain>>;
let decoderHelper: GetContractReturnType<typeof DecoderHelperAbi, PublicClient<HttpTransport, Chain>>;
let headerDecoderHelper: GetContractReturnType<typeof HeaderDecoderHelperAbi, PublicClient<HttpTransport, Chain>>;

let publisher: L1Publisher;
let l2Proof: Buffer;
Expand Down Expand Up @@ -118,8 +114,6 @@ describe('L1Publisher integration', () => {
rollupAddress = getAddress(l1ContractAddresses.rollupAddress.toString());
inboxAddress = getAddress(l1ContractAddresses.inboxAddress.toString());
outboxAddress = getAddress(l1ContractAddresses.outboxAddress.toString());
decoderHelperAddress = getAddress(l1ContractAddresses.decoderHelperAddress.toString());
headerDecoderHelperAddress = getAddress(l1ContractAddresses.headerDecoderHelperAddress.toString());

// Set up contract instances
rollup = getContract({
Expand All @@ -138,16 +132,6 @@ describe('L1Publisher integration', () => {
abi: OutboxAbi,
publicClient,
});
decoderHelper = getContract({
address: decoderHelperAddress!,
abi: DecoderHelperAbi,
publicClient,
});
headerDecoderHelper = getContract({
address: headerDecoderHelperAddress!,
abi: HeaderDecoderHelperAbi,
publicClient,
});

builderDb = await MerkleTrees.new(levelup((memdown as any)())).then(t => t.asLatest());
const vks = getVerificationKeys();
Expand Down Expand Up @@ -429,35 +413,6 @@ describe('L1Publisher integration', () => {
});
expect(ethTx.input).toEqual(expectedData);

const headerDecoderArgs = [`0x${block.header.toBuffer().toString('hex')}`] as const;
const decodedHeader = await headerDecoderHelper.read.decode(headerDecoderArgs);

expect(Number(block.header.globalVariables.chainId.toBigInt())).toEqual(
Number(decodedHeader.globalVariables.chainId),
);
expect(Number(block.header.globalVariables.version.toBigInt())).toEqual(
Number(decodedHeader.globalVariables.version),
);
expect(block.number).toEqual(Number(decodedHeader.globalVariables.blockNumber));
expect(Number(block.header.globalVariables.timestamp.toBigInt())).toEqual(
Number(decodedHeader.globalVariables.timestamp),
);

const receivedLastArchiveRoot = Fr.fromString(decodedHeader.lastArchiveRoot);
const expectedLastArchiveRoot = block.header.lastArchive.root;
expect(expectedLastArchiveRoot).toEqual(receivedLastArchiveRoot);

const archiveInRollup = Fr.fromString(await rollup.read.archive());
expect(block.archive.root).toEqual(archiveInRollup);

const decoderArgs = [`0x${block.bodyToBuffer().toString('hex')}`] as const;
const decodedConsumables = await decoderHelper.read.computeConsumables(decoderArgs);

// TODO(#4031): Re-enable these checks
// expect(block.getPublicInputsHash().toBuffer()).toEqual(hexStringToBuffer(decodedRes[3].toString()));
// expect(block.getCalldataHash()).toEqual(hexStringToBuffer(decodedHashes[0].toString()));
expect(block.getL1ToL2MessagesHash()).toEqual(hexStringToBuffer(decodedConsumables[1].toString()));

// check that values have been consumed from the inbox
for (let j = 0; j < l1ToL2Messages.length; j++) {
if (l1ToL2Messages[j].isZero()) {
Expand Down Expand Up @@ -525,35 +480,6 @@ describe('L1Publisher integration', () => {
],
});
expect(ethTx.input).toEqual(expectedData);

const headerDecoderArgs = [`0x${block.header.toBuffer().toString('hex')}`] as const;
const decodedHeader = await headerDecoderHelper.read.decode(headerDecoderArgs);

expect(Number(block.header.globalVariables.chainId.toBigInt())).toEqual(
Number(decodedHeader.globalVariables.chainId),
);
expect(Number(block.header.globalVariables.version.toBigInt())).toEqual(
Number(decodedHeader.globalVariables.version),
);
expect(block.number).toEqual(Number(decodedHeader.globalVariables.blockNumber));
expect(Number(block.header.globalVariables.timestamp.toBigInt())).toEqual(
Number(decodedHeader.globalVariables.timestamp),
);

const receivedLastArchiveRoot = Fr.fromString(decodedHeader.lastArchiveRoot);
const expectedLastArchiveRoot = block.header.lastArchive.root;
expect(expectedLastArchiveRoot).toEqual(receivedLastArchiveRoot);

const archiveInRollup = Fr.fromString(await rollup.read.archive());
expect(block.archive.root).toEqual(archiveInRollup);

const decoderArgs = [`0x${block.bodyToBuffer().toString('hex')}`] as const;
const decodedConsumables = await decoderHelper.read.computeConsumables(decoderArgs);

// TODO(#4031): Re-enable these checks
// expect(block.getPublicInputsHash().toBuffer()).toEqual(hexStringToBuffer(decodedRes[3].toString()));
// expect(block.getCalldataHash()).toEqual(hexStringToBuffer(decodedHashes[0].toString()));
expect(block.getL1ToL2MessagesHash()).toEqual(hexStringToBuffer(decodedConsumables[1].toString()));
}
}, 60_000);
});
Expand Down
32 changes: 0 additions & 32 deletions yarn-project/ethereum/src/deploy_l1_contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,6 @@ export interface L1ContractArtifactsForDeployment {
* Contract deployment emitter artifacts
*/
contractDeploymentEmitter: ContractArtifacts;
/**
* Decoder contract artifacts
*/
decoderHelper?: ContractArtifacts;
/**
* Header decoder contract artifacts
*/
headerDecoderHelper?: ContractArtifacts;
/**
* Inbox contract artifacts
*/
Expand Down Expand Up @@ -169,36 +161,12 @@ export const deployL1Contracts = async (
);
logger(`Deployed contract deployment emitter at ${contractDeploymentEmitterAddress}`);

let decoderHelperAddress: EthAddress | undefined;
if (contractsToDeploy.decoderHelper) {
decoderHelperAddress = await deployL1Contract(
walletClient,
publicClient,
contractsToDeploy.decoderHelper.contractAbi,
contractsToDeploy.decoderHelper.contractBytecode,
);
logger(`Deployed DecoderHelper at ${decoderHelperAddress}`);
}

let headerDecoderHelperAddress: EthAddress | undefined;
if (contractsToDeploy.headerDecoderHelper) {
headerDecoderHelperAddress = await deployL1Contract(
walletClient,
publicClient,
contractsToDeploy.headerDecoderHelper.contractAbi,
contractsToDeploy.headerDecoderHelper.contractBytecode,
);
logger(`Deployed HeaderDecoderHelper at ${headerDecoderHelperAddress}`);
}

const l1Contracts: L1ContractAddresses = {
rollupAddress,
registryAddress,
inboxAddress,
outboxAddress,
contractDeploymentEmitterAddress,
decoderHelperAddress: decoderHelperAddress ?? EthAddress.ZERO,
headerDecoderHelperAddress: headerDecoderHelperAddress ?? EthAddress.ZERO,
};

return {
Expand Down
8 changes: 0 additions & 8 deletions yarn-project/ethereum/src/l1_contract_addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,4 @@ export interface L1ContractAddresses {
* Data Emitter Address.
*/
contractDeploymentEmitterAddress: EthAddress;
/**
* Decoder Helper Address.
*/
decoderHelperAddress: EthAddress;
/**
* Header Decoder Helper Address.
*/
headerDecoderHelperAddress: EthAddress;
}
4 changes: 0 additions & 4 deletions yarn-project/l1-artifacts/scripts/generate-artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ target_dir=./generated
# - a .{CONTRACT_NAME}Abi.ts containing the contract ABI.

CONTRACTS=(
"l1-contracts:DecoderHelper"
"l1-contracts:HeaderDecoderHelper"
"l1-contracts:TxsDecoderHelper"
"l1-contracts:MessagesDecoderHelper"
"l1-contracts:Registry"
"l1-contracts:Inbox"
"l1-contracts:Outbox"
Expand Down
2 changes: 0 additions & 2 deletions yarn-project/pxe/src/pxe_service/test/pxe_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ async function createPXEService(): Promise<PXE> {
inboxAddress: EthAddress.random(),
outboxAddress: EthAddress.random(),
contractDeploymentEmitterAddress: EthAddress.random(),
decoderHelperAddress: EthAddress.random(),
headerDecoderHelperAddress: EthAddress.random(),
};
node.getL1ContractAddresses.mockResolvedValue(mockedContracts);

Expand Down
2 changes: 0 additions & 2 deletions yarn-project/sequencer-client/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ export function getConfigEnvVars(): SequencerClientConfig {
contractDeploymentEmitterAddress: CONTRACT_DEPLOYMENT_EMITTER_ADDRESS
? EthAddress.fromString(CONTRACT_DEPLOYMENT_EMITTER_ADDRESS)
: EthAddress.ZERO,
decoderHelperAddress: EthAddress.ZERO,
headerDecoderHelperAddress: EthAddress.ZERO,
};

return {
Expand Down

0 comments on commit 47f53a0

Please sign in to comment.