Skip to content

Commit

Permalink
test: check that portal address is saved (#2641)
Browse files Browse the repository at this point in the history
This PR adds a test for a change made in
64d5e87
to check that after a contract is deployed with a portal contract
address the portal is saved both in `ContractData` and
`ExtendedContractData` by the Archiver.

# Checklist:
Remove the checklist to signal you've completed it. Enable auto-merge if
the PR is ready to merge.
- [ ] If the pull request requires a cryptography review (e.g.
cryptographic algorithm implementations) I have added the 'crypto' tag.
- [x] I have reviewed my diff in github, line by line and removed
unexpected formatting changes, testing logs, or commented-out code.
- [x] Every change is related to the PR description.
- [ ] I have
[linked](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)
this pull request to relevant issues (if any exist).
  • Loading branch information
alexghr authored Oct 4, 2023
1 parent 027f7ec commit 9ebef6e
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion yarn-project/end-to-end/src/e2e_deploy_contract.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AztecAddress, Contract, ContractDeployer, Fr, Wallet, isContractDeployed } from '@aztec/aztec.js';
import { AztecAddress, Contract, ContractDeployer, EthAddress, Fr, Wallet, isContractDeployed } from '@aztec/aztec.js';
import { CompleteAddress, getContractDeploymentInfo } from '@aztec/circuits.js';
import { DebugLogger } from '@aztec/foundation/log';
import { TestContractAbi } from '@aztec/noir-contracts/artifacts';
Expand Down Expand Up @@ -111,4 +111,21 @@ describe('e2e_deploy_contract', () => {
);
}
}, 30_000);

it('should deploy a contract connected to a portal contract', async () => {
const deployer = new ContractDeployer(TestContractAbi, wallet);
const portalContract = EthAddress.random();

const txReceipt = await deployer.deploy().send({ portalContract }).wait();

expect(txReceipt.status).toBe(TxStatus.MINED);
const contractAddress = txReceipt.contractAddress!;

expect((await pxe.getContractData(contractAddress))?.portalContractAddress.toString()).toEqual(
portalContract.toString(),
);
expect((await pxe.getExtendedContractData(contractAddress))?.contractData.portalContractAddress.toString()).toEqual(
portalContract.toString(),
);
});
});

0 comments on commit 9ebef6e

Please sign in to comment.