Skip to content

Commit

Permalink
refactor: assert admin is non-zero in token contract
Browse files Browse the repository at this point in the history
  • Loading branch information
alexghr committed Oct 12, 2023
1 parent b9d0624 commit 7690719
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 33 deletions.
1 change: 0 additions & 1 deletion yarn-project/end-to-end/src/cli_docs_sandbox.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ SchnorrAccountContractArtifact
SchnorrHardcodedAccountContractArtifact
SchnorrSingleKeyAccountContractArtifact
StatefulTestContractArtifact
TestAssertContractArtifact
TestContractArtifact
TokenBridgeContractArtifact
TokenContractArtifact
Expand Down
6 changes: 3 additions & 3 deletions yarn-project/end-to-end/src/e2e_deploy_contract.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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 { TestAssertContractArtifact, TestContractArtifact } from '@aztec/noir-contracts/artifacts';
import { TestContractArtifact, TokenContractArtifact } from '@aztec/noir-contracts/artifacts';
import { PXE, TxStatus } from '@aztec/types';

import { setup } from './fixtures/utils.js';
Expand Down Expand Up @@ -132,8 +132,8 @@ describe('e2e_deploy_contract', () => {
it('it should not deploy a contract which failed the public part of the execution', async () => {
// This test requires at least another good transaction to go through in the same block as the bad one.
// I deployed the same contract again but it could really be any valid transaction here.
const goodDeploy = new ContractDeployer(TestAssertContractArtifact, wallet).deploy(0);
const badDeploy = new ContractDeployer(TestAssertContractArtifact, wallet).deploy(1);
const goodDeploy = new ContractDeployer(TokenContractArtifact, wallet).deploy(AztecAddress.random());
const badDeploy = new ContractDeployer(TokenContractArtifact, wallet).deploy(AztecAddress.ZERO);

await Promise.all([
goodDeploy.simulate({ skipPublicSimulation: true }),
Expand Down
7 changes: 3 additions & 4 deletions yarn-project/noir-contracts/Nargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[workspace]
members = [
"src/contracts/benchmarking_contract",
"src/contracts/card_game_contract",
"src/contracts/child_contract",
"src/contracts/benchmarking_contract",
"src/contracts/card_game_contract",
"src/contracts/child_contract",
"src/contracts/docs_example_contract",
"src/contracts/easy_private_token_contract",
"src/contracts/ecdsa_account_contract",
Expand All @@ -23,7 +23,6 @@ members = [
"src/contracts/schnorr_single_key_account_contract",
"src/contracts/stateful_test_contract",
"src/contracts/test_contract",
"src/contracts/test_assert_contract",
"src/contracts/token_contract",
"src/contracts/token_bridge_contract",
"src/contracts/uniswap_contract",
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ contract Token {
// docs:start:import_authwit
use dep::authwit::{
auth::{
assert_current_call_valid_authwit,
assert_current_call_valid_authwit_public,
assert_current_call_valid_authwit,
assert_current_call_valid_authwit_public,
},
};
// docs:end:import_authwit
Expand Down Expand Up @@ -359,6 +359,7 @@ contract Token {
internal fn _initialize(
new_admin: AztecAddress,
) {
assert(new_admin.address != 0, "invalid admin");
storage.admin.write(new_admin);
storage.minters.at(new_admin.address).write(true);
}
Expand Down

0 comments on commit 7690719

Please sign in to comment.