Skip to content

Commit

Permalink
Moving publisher test to e2e and re-enabling it (#463)
Browse files Browse the repository at this point in the history
* chore: moved publisher test to e2e

* WIP

* test: better test name

* chore: enabled test in CI

* test: functional publisher test

* refactor: cleanup

* test: fixed deps

* test: fixed deps 2

* yarn prepare

* test: CI fix attempt 4

* chore: same TS version as in the rest

* chore: better naming + CI fix attempt

* deps cleanup

* CI fix attempt 5

* chore: deps cleanup 2
  • Loading branch information
benesjan authored May 5, 2023
1 parent e9916e4 commit 89547b9
Show file tree
Hide file tree
Showing 10 changed files with 186 additions and 99 deletions.
17 changes: 16 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,17 @@ jobs:
name: "Test"
command: cond_spot_run_tests end-to-end e2e_nested_contract.test.ts

integration-l1-publisher:
docker:
- image: aztecprotocol/alpine-build-image
resource_class: small
steps:
- *checkout
- *setup_env
- run:
name: "Test"
command: cond_spot_run_tests end-to-end integration_l1_publisher.test.ts

e2e-join:
docker:
- image: cimg/base:current
Expand Down Expand Up @@ -452,11 +463,15 @@ workflows:
- e2e-join:
requires:
- aztec-js
- circuits-js
- end-to-end
- noir-contracts
- foundation
- noir-contracts
- sequencer-client
- world-state
<<: *defaults
- e2e-deploy-contract: *e2e_test
- e2e-zk-token-contract: *e2e_test
- e2e-block-building: *e2e_test
- e2e-nested-contract: *e2e_test
- integration-l1-publisher: *e2e_test
5 changes: 4 additions & 1 deletion build_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,12 @@
"dependencies": [
"aztec-node",
"aztec.js",
"circuits.js",
"foundation",
"l1-artifacts",
"noir-contracts"
"noir-contracts",
"sequencer-client",
"world-state"
]
},
"foundation": {
Expand Down
23 changes: 12 additions & 11 deletions yarn-project/end-to-end/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,34 @@
"dependencies": {
"@aztec/aztec-node": "workspace:^",
"@aztec/aztec.js": "workspace:^",
"@aztec/circuits.js": "workspace:^",
"@aztec/foundation": "workspace:^",
"@aztec/l1-artifacts": "workspace:^",
"@aztec/noir-contracts": "workspace:^",
"@aztec/sequencer-client": "workspace:^",
"@aztec/world-state": "workspace:^",
"@jest/globals": "^29.5.0",
"@types/jest": "^29.5.0",
"@types/levelup": "^5.1.2",
"@types/lodash.times": "^4.3.7",
"@types/node": "^18.7.23",
"jest": "^29.5.0",
"levelup": "^5.1.1",
"lodash.times": "^4.3.2",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"tslib": "^2.4.0",
"typescript": "^4.9.5",
"typescript": "^5.0.4",
"viem": "^0.3.13"
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@rushstack/eslint-patch": "^1.1.4",
"@types/jest": "^29.5.0",
"@types/lodash.times": "^4.3.7",
"@types/node": "^18.7.23",
"concurrently": "^7.6.0",
"jest": "^29.5.0",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
"concurrently": "^7.6.0"
},
"files": [
"dest",
"src",
"!*.test.*"
],
"types": "./dest/index.d.ts"
}
}
24 changes: 19 additions & 5 deletions yarn-project/end-to-end/src/deploy_l1_contracts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { EthAddress } from '@aztec/foundation/eth-address';
import { DebugLogger } from '@aztec/foundation/log';
import {
DecoderHelperAbi,
DecoderHelperBytecode,
RollupAbi,
RollupBytecode,
UnverifiedDataEmitterAbi,
Expand All @@ -18,11 +20,16 @@ import {
createWalletClient,
http,
} from 'viem';
import { HDAccount } from 'viem/accounts';
import { HDAccount, PrivateKeyAccount } from 'viem/accounts';
import { foundry } from 'viem/chains';

export const deployL1Contracts = async (rpcUrl: string, account: HDAccount, logger: DebugLogger) => {
logger('Deploying contracts... (rpcURL: %s)', rpcUrl);
export const deployL1Contracts = async (
rpcUrl: string,
account: HDAccount | PrivateKeyAccount,
logger: DebugLogger,
deployDecoderHelper = false,
) => {
logger('Deploying contracts...');

const walletClient = createWalletClient({
account,
Expand All @@ -35,7 +42,7 @@ export const deployL1Contracts = async (rpcUrl: string, account: HDAccount, logg
});

const rollupAddress = await deployL1Contract(walletClient, publicClient, RollupAbi, RollupBytecode);
logger(`Deployed rollup contract at ${rollupAddress}`);
logger(`Deployed Rollup at ${rollupAddress}`);

const unverifiedDataEmitterAddress = await deployL1Contract(
walletClient,
Expand All @@ -45,9 +52,16 @@ export const deployL1Contracts = async (rpcUrl: string, account: HDAccount, logg
);
logger(`Deployed unverified data emitter at ${unverifiedDataEmitterAddress}`);

let decoderHelperAddress: EthAddress | undefined;
if (deployDecoderHelper) {
decoderHelperAddress = await deployL1Contract(walletClient, publicClient, DecoderHelperAbi, DecoderHelperBytecode);
logger(`Deployed DecoderHelper at ${decoderHelperAddress}`);
}

return {
rollupAddress,
unverifiedDataEmitterAddress,
decoderHelperAddress,
};
};

Expand All @@ -56,7 +70,7 @@ async function deployL1Contract(
publicClient: PublicClient<HttpTransport, Chain>,
abi: Narrow<Abi | readonly unknown[]>,
bytecode: Hex,
) {
): Promise<EthAddress> {
const hash = await walletClient.deployContract({
abi,
bytecode,
Expand Down
1 change: 0 additions & 1 deletion yarn-project/end-to-end/src/e2e_block_building.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ describe('e2e_block_building', () => {
beforeEach(async () => {
const account = mnemonicToAccount(MNEMONIC);
const privKey = account.getHdKey().privateKey;
console.log(config);
const { rollupAddress, unverifiedDataEmitterAddress } = await deployL1Contracts(config.rpcUrl, account, logger);

config.publisherPrivateKey = Buffer.from(privKey!);
Expand Down
Loading

0 comments on commit 89547b9

Please sign in to comment.