diff --git a/.circleci/config.yml b/.circleci/config.yml index 3fd9543ffa5..3155dcb7586 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -711,7 +711,6 @@ jobs: command: cond_spot_run_compose end-to-end 4 ./scripts/docker-compose.yml TEST=e2e_authwit.test.ts aztec_manifest_key: end-to-end - e2e-blacklist-token-contract: docker: - image: aztecprotocol/alpine-build-image @@ -1025,6 +1024,18 @@ jobs: command: cond_spot_run_compose end-to-end 4 ./scripts/docker-compose.yml TEST=e2e_fees.test.ts aztec_manifest_key: end-to-end + e2e-dapp-subscription: + docker: + - image: aztecprotocol/alpine-build-image + resource_class: small + steps: + - *checkout + - *setup_env + - run: + name: "Test" + command: cond_spot_run_compose end-to-end 4 ./scripts/docker-compose.yml TEST=e2e_dapp_subscription.test.ts + aztec_manifest_key: end-to-end + pxe: docker: - image: aztecprotocol/alpine-build-image @@ -1496,6 +1507,7 @@ workflows: - e2e-card-game: *e2e_test - e2e-avm-simulator: *e2e_test - e2e-fees: *e2e_test + - e2e-dapp-subscription: *e2e_test - pxe: *e2e_test - cli-docs-sandbox: *e2e_test - e2e-docs-examples: *e2e_test @@ -1542,6 +1554,7 @@ workflows: - e2e-card-game - e2e-avm-simulator - e2e-fees + - e2e-dapp-subscription - pxe - boxes-vanilla - boxes-react diff --git a/yarn-project/aztec.js/src/fee/public_fee_payment_method.ts b/yarn-project/aztec.js/src/fee/public_fee_payment_method.ts index da4fe354ef1..9a367f565d4 100644 --- a/yarn-project/aztec.js/src/fee/public_fee_payment_method.ts +++ b/yarn-project/aztec.js/src/fee/public_fee_payment_method.ts @@ -5,7 +5,7 @@ import { AztecAddress } from '@aztec/foundation/aztec-address'; import { Fr } from '@aztec/foundation/fields'; import { computeAuthWitMessageHash } from '../utils/authwit.js'; -import { AccountWalletWithPrivateKey } from '../wallet/account_wallet_with_private_key.js'; +import { AccountWallet } from '../wallet/account_wallet.js'; import { FeePaymentMethod } from './fee_payment_method.js'; /** @@ -25,7 +25,7 @@ export class PublicFeePaymentMethod implements FeePaymentMethod { /** * An auth witness provider to authorize fee payments */ - private wallet: AccountWalletWithPrivateKey, + private wallet: AccountWallet, ) {} /** diff --git a/yarn-project/end-to-end/src/e2e_dapp_subscription.test.ts b/yarn-project/end-to-end/src/e2e_dapp_subscription.test.ts index 0f3af47c88f..0bd639aae32 100644 --- a/yarn-project/end-to-end/src/e2e_dapp_subscription.test.ts +++ b/yarn-project/end-to-end/src/e2e_dapp_subscription.test.ts @@ -19,7 +19,14 @@ import { import { jest } from '@jest/globals'; -import { BalancesFn, EndToEndContext, expectMapping, getBalancesFn, setup } from './fixtures/utils.js'; +import { + BalancesFn, + EndToEndContext, + expectMapping, + getBalancesFn, + publicDeployAccounts, + setup, +} from './fixtures/utils.js'; import { GasPortalTestingHarnessFactory, IGasBridgingTestHarness } from './shared/gas_portal_test_harness.js'; jest.setTimeout(1_000_000); @@ -118,6 +125,8 @@ describe('e2e_dapp_subscription', () => { [aliceAddress, sequencerAddress, subscriptionContract.address, bananaFPC.address], [0n, 0n, BRIDGED_GAS_BALANCE, BRIDGED_GAS_BALANCE], ); + + await publicDeployAccounts(e2eContext.wallet, e2eContext.accounts); }); it('should allow Alice to subscribe by paying privately with bananas', async () => { diff --git a/yarn-project/entrypoints/src/dapp_entrypoint.ts b/yarn-project/entrypoints/src/dapp_entrypoint.ts index 66a7b0c0aff..810b25e6ae2 100644 --- a/yarn-project/entrypoints/src/dapp_entrypoint.ts +++ b/yarn-project/entrypoints/src/dapp_entrypoint.ts @@ -1,8 +1,8 @@ +import { computeInnerAuthWitHash, computeOuterAuthWitHash } from '@aztec/aztec.js'; import { AuthWitnessProvider, EntrypointInterface } from '@aztec/aztec.js/account'; import { FunctionCall, PackedArguments, TxExecutionRequest } from '@aztec/circuit-types'; -import { AztecAddress, Fr, FunctionData, GeneratorIndex, TxContext } from '@aztec/circuits.js'; +import { AztecAddress, Fr, FunctionData, TxContext } from '@aztec/circuits.js'; import { FunctionAbi, encodeArguments } from '@aztec/foundation/abi'; -import { pedersenHash } from '@aztec/foundation/crypto'; import { DEFAULT_CHAIN_ID, DEFAULT_VERSION } from './constants.js'; import { buildDappPayload } from './entrypoint_payload.js'; @@ -30,17 +30,11 @@ export class DefaultDappEntrypoint implements EntrypointInterface { const entrypointPackedArgs = PackedArguments.fromArgs(encodeArguments(abi, [payload, this.userAddress])); const functionData = FunctionData.fromAbi(abi); - const hash = pedersenHash( - [ - Fr.ZERO.toBuffer(), - this.dappEntrypointAddress.toBuffer(), - functionData.selector.toBuffer(), - entrypointPackedArgs.hash.toBuffer(), - ], - GeneratorIndex.SIGNATURE_PAYLOAD, - ); - const authWitness = await this.userAuthWitnessProvider.createAuthWitness(hash); + const innerHash = computeInnerAuthWitHash([Fr.ZERO, functionData.selector.toField(), entrypointPackedArgs.hash]); + const outerHash = computeOuterAuthWitHash(this.dappEntrypointAddress, innerHash); + + const authWitness = await this.userAuthWitnessProvider.createAuthWitness(outerHash); const txRequest = TxExecutionRequest.from({ argsHash: entrypointPackedArgs.hash,