diff --git a/l1-contracts/src/core/FeeJuicePortal.sol b/l1-contracts/src/core/FeeJuicePortal.sol index 00e166a51477..d315a9f52977 100644 --- a/l1-contracts/src/core/FeeJuicePortal.sol +++ b/l1-contracts/src/core/FeeJuicePortal.sol @@ -79,7 +79,7 @@ contract FeeJuicePortal is IFeeJuicePortal, Ownable { // Hash the message content to be reconstructed in the receiving contract bytes32 contentHash = - Hash.sha256ToField(abi.encodeWithSignature("mint_public(bytes32,uint256)", _to, _amount)); + Hash.sha256ToField(abi.encodeWithSignature("claim(bytes32,uint256)", _to, _amount)); // Hold the tokens in the portal underlying.safeTransferFrom(msg.sender, address(this), _amount); diff --git a/noir-projects/noir-contracts/contracts/fee_juice_contract/src/lib.nr b/noir-projects/noir-contracts/contracts/fee_juice_contract/src/lib.nr index de5dce2b1edd..9eaea6550159 100644 --- a/noir-projects/noir-contracts/contracts/fee_juice_contract/src/lib.nr +++ b/noir-projects/noir-contracts/contracts/fee_juice_contract/src/lib.nr @@ -16,11 +16,11 @@ pub fn get_bridge_gas_msg_hash(owner: AztecAddress, amount: Field) -> Field { hash_bytes[i + 36] = amount_bytes[i]; } - // Function selector: 0x3e87b9be keccak256('mint_public(bytes32,uint256)') - hash_bytes[0] = 0x3e; - hash_bytes[1] = 0x87; - hash_bytes[2] = 0xb9; - hash_bytes[3] = 0xbe; + // Function selector: 0x63f44968 keccak256('claim(bytes32,uint256)') + hash_bytes[0] = 0x63; + hash_bytes[1] = 0xf4; + hash_bytes[2] = 0x49; + hash_bytes[3] = 0x68; let content_hash = sha256_to_field(hash_bytes); content_hash diff --git a/noir-projects/noir-contracts/contracts/fee_juice_contract/src/main.nr b/noir-projects/noir-contracts/contracts/fee_juice_contract/src/main.nr index c238e3f47361..af51fff943c1 100644 --- a/noir-projects/noir-contracts/contracts/fee_juice_contract/src/main.nr +++ b/noir-projects/noir-contracts/contracts/fee_juice_contract/src/main.nr @@ -99,20 +99,6 @@ contract FeeJuice { storage.balances.at(to).write(new_balance); } - // TODO(palla/gas) Remove this function and use the private claim flow only - #[aztec(public)] - fn claim_public(to: AztecAddress, amount: Field, secret: Field, leaf_index: Field) { - let content_hash = get_bridge_gas_msg_hash(to, amount); - let portal_address = storage.portal_address.read_public(); - assert(!portal_address.is_zero()); - - // Consume message and emit nullifier - context.consume_l1_to_l2_message(content_hash, secret, portal_address, leaf_index); - - let new_balance = storage.balances.at(to).read() + U128::from_integer(amount); - storage.balances.at(to).write(new_balance); - } - #[aztec(public)] #[aztec(view)] fn check_balance(fee_limit: Field) { diff --git a/yarn-project/end-to-end/src/shared/gas_portal_test_harness.ts b/yarn-project/end-to-end/src/shared/gas_portal_test_harness.ts index 0c77c98dc1c7..22fc7c779b6d 100644 --- a/yarn-project/end-to-end/src/shared/gas_portal_test_harness.ts +++ b/yarn-project/end-to-end/src/shared/gas_portal_test_harness.ts @@ -177,10 +177,10 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness { return Fr.fromString(messageHash); } - async consumeMessageOnAztecAndMintPublicly(bridgeAmount: bigint, owner: AztecAddress, secret: Fr, leafIndex: bigint) { - this.logger.info('Consuming messages on L2 Publicly'); - // Call the mint tokens function on the Aztec.nr contract - await this.l2Token.methods.claim_public(owner, bridgeAmount, secret, leafIndex).send().wait(); + async consumeMessageOnAztecAndMintPrivately(bridgeAmount: bigint, owner: AztecAddress, secret: Fr) { + this.logger.info('Consuming messages on L2 Privately'); + // Call the claim function on the Aztec.nr Fee Juice contract + await this.l2Token.methods.claim(owner, bridgeAmount, secret).send().wait(); } async getL2PublicBalanceOf(owner: AztecAddress) { @@ -211,15 +211,10 @@ export class GasBridgingTestHarness implements IGasBridgingTestHarness { async bridgeFromL1ToL2(l1TokenBalance: bigint, bridgeAmount: bigint, owner: AztecAddress) { // Prepare the tokens on the L1 side - const { secret, msgHash } = await this.prepareTokensOnL1(l1TokenBalance, bridgeAmount, owner); + const { secret } = await this.prepareTokensOnL1(l1TokenBalance, bridgeAmount, owner); - // Get message leaf index, needed for claiming in public - const maybeIndexAndPath = await this.aztecNode.getL1ToL2MessageMembershipWitness('latest', msgHash, 0n); - expect(maybeIndexAndPath).toBeDefined(); - const messageLeafIndex = maybeIndexAndPath![0]; - - // Consume L1-> L2 message and mint public tokens on L2 - await this.consumeMessageOnAztecAndMintPublicly(bridgeAmount, owner, secret, messageLeafIndex); + // Consume L1-> L2 message and mint tokens privately on L2 + await this.consumeMessageOnAztecAndMintPrivately(bridgeAmount, owner, secret); await this.expectPublicBalanceOnL2(owner, bridgeAmount); } }