Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: make coinbase and fee_recipient inaccessible #6375

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions noir-projects/aztec-nr/aztec/src/context/public_context.nr
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,13 @@ impl PublicContextInterface for PublicContext {
}

fn coinbase(self) -> EthAddress {
self.inputs.public_global_variables.coinbase
assert(false, "'coinbase' not implemented!");
EthAddress::zero()
}

fn fee_recipient(self) -> AztecAddress {
self.inputs.public_global_variables.fee_recipient
assert(false, "'fee_recipient' not implemented!");
AztecAddress::zero()
}

fn fee_per_da_gas(self) -> Field {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ contract GasToken {
let sender_new_balance = storage.balances.at(context.msg_sender()).read() - fee;
storage.balances.at(context.msg_sender()).write(sender_new_balance);

let recipient_new_balance = storage.balances.at(context.fee_recipient()).read() + fee;
storage.balances.at(context.fee_recipient()).write(recipient_new_balance);

let rebate = fee_limit_u128 - fee;
rebate.to_field()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,17 +375,13 @@ contract Test {
version: Field,
block_number: Field,
timestamp: u64,
coinbase: EthAddress,
fee_recipient: AztecAddress,
fee_per_da_gas: Field,
fee_per_l2_gas: Field
) {
assert(context.chain_id() == chain_id, "Invalid chain id");
assert(context.version() == version, "Invalid version");
assert(context.block_number() == block_number, "Invalid block number");
assert(context.timestamp() == timestamp, "Invalid timestamp");
assert(context.coinbase() == coinbase, "Invalid coinbase");
assert(context.fee_recipient() == fee_recipient, "Invalid fee recipient");
assert(context.fee_per_da_gas() == fee_per_da_gas, "Invalid fee per da gas");
assert(context.fee_per_l2_gas() == fee_per_l2_gas, "Invalid fee per l2 gas");
}
Expand Down
13 changes: 4 additions & 9 deletions yarn-project/end-to-end/src/e2e_fees/dapp_subscription.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('e2e_fees dapp_subscription', () => {
await expectMapping(
t.gasBalances,
[sequencerAddress, bananaFPC.address],
[initialSequencerGasBalance + transactionFee!, initialFPCGasBalance - transactionFee!],
[initialSequencerGasBalance, initialFPCGasBalance - transactionFee!],
);

// alice, bob, fpc
Expand Down Expand Up @@ -143,7 +143,7 @@ describe('e2e_fees dapp_subscription', () => {
await expectMapping(
t.gasBalances,
[sequencerAddress, bananaFPC.address],
[initialSequencerGasBalance + transactionFee!, initialFPCGasBalance - transactionFee!],
[initialSequencerGasBalance, initialFPCGasBalance - transactionFee!],
);

// alice, bob, fpc
Expand All @@ -156,9 +156,7 @@ describe('e2e_fees dapp_subscription', () => {

it('should call dapp subscription entrypoint', async () => {
// Subscribe again, so this test does not depend on the previous ones being run.
const { transactionFee: subscriptionTxFee } = await subscribe(
new PrivateFeePaymentMethod(bananaCoin.address, bananaFPC.address, aliceWallet),
);
await subscribe(new PrivateFeePaymentMethod(bananaCoin.address, bananaFPC.address, aliceWallet));

expect(await subscriptionContract.methods.is_initialized(aliceAddress).simulate()).toBe(true);

Expand All @@ -174,10 +172,7 @@ describe('e2e_fees dapp_subscription', () => {
await expectMapping(
t.gasBalances,
[sequencerAddress, subscriptionContract.address],
[
initialSequencerGasBalance + transactionFee! + subscriptionTxFee!,
initialSubscriptionContractGasBalance - transactionFee!,
],
[initialSequencerGasBalance, initialSubscriptionContractGasBalance - transactionFee!],
);
});

Expand Down
8 changes: 4 additions & 4 deletions yarn-project/end-to-end/src/e2e_fees/private_payments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ describe('e2e_fees private_payment', () => {
await expectMapping(
t.gasBalances,
[aliceAddress, bananaFPC.address, sequencerAddress],
[InitialAliceGas, InitialFPCGas - feeAmount, InitialSequencerGas + feeAmount],
[InitialAliceGas, InitialFPCGas - feeAmount, InitialSequencerGas],
);

await expect(
Expand Down Expand Up @@ -207,7 +207,7 @@ describe('e2e_fees private_payment', () => {
await expectMapping(
t.gasBalances,
[aliceAddress, bananaFPC.address, sequencerAddress],
[InitialAliceGas, InitialFPCGas - feeAmount, InitialSequencerGas + feeAmount],
[InitialAliceGas, InitialFPCGas - feeAmount, InitialSequencerGas],
);

await expect(
Expand Down Expand Up @@ -270,7 +270,7 @@ describe('e2e_fees private_payment', () => {
await expectMapping(
t.gasBalances,
[aliceAddress, bananaFPC.address, sequencerAddress],
[InitialAliceGas, InitialFPCGas - feeAmount, InitialSequencerGas + feeAmount],
[InitialAliceGas, InitialFPCGas - feeAmount, InitialSequencerGas],
);

await expect(
Expand Down Expand Up @@ -346,7 +346,7 @@ describe('e2e_fees private_payment', () => {
await expectMapping(
t.gasBalances,
[aliceAddress, bananaFPC.address, sequencerAddress],
[InitialAliceGas, InitialFPCGas - feeAmount, InitialSequencerGas + feeAmount],
[InitialAliceGas, InitialFPCGas - feeAmount, InitialSequencerGas],
);

await expect(
Expand Down
6 changes: 0 additions & 6 deletions yarn-project/simulator/src/public/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -674,12 +674,6 @@ describe('ACIR public execution simulator', () => {
{ value: new Fr(1), invalidValue: Fr.random(), description: 'Version' },
{ value: new Fr(1), invalidValue: Fr.random(), description: 'Block number' },
{ value: new Fr(1), invalidValue: Fr.random(), description: 'Timestamp' },
{ value: EthAddress.random(), invalidValue: EthAddress.random(), description: 'Coinbase' },
{
value: AztecAddress.random(),
invalidValue: AztecAddress.random(),
description: 'Fee recipient',
},
{ value: new Fr(1), invalidValue: Fr.random(), description: 'Fee per DA gas' },
{ value: new Fr(1), invalidValue: Fr.random(), description: 'Fee per L2 gas' },
];
Expand Down
Loading