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

feat!: enforce fees #11480

Merged
merged 61 commits into from
Feb 17, 2025
Merged

feat!: enforce fees #11480

merged 61 commits into from
Feb 17, 2025

Conversation

LeilaWang
Copy link
Contributor

@LeilaWang LeilaWang commented Jan 24, 2025

Circuits

  • Private kernels ensure that fee payer is not empty.
  • Private base rollup and the avm check that the fee payer must have enough balance to pay the fee.

Aztec.js/cli

  • Default payment method is FeeJuicePaymentMethod, the fee payer is the wallet owner.
  • NoFeePaymentMethod is no longer available.

End-to-end/Sandbox

  • Some public data leaves are created for funding the initial test accounts with fee juice. The genesis archive root and block hash are generated with these public data leaves.
    • For the e2e tests, the test accounts are generated randomly.
    • For the sandbox, the test accounts are defined in @aztec/accounts/testing.
  • These funded test accounts can deploy their own account contract and pay the fee for the deployment themselves.
  • These funded test accounts can be used to deploy another account without pre-funded fee juice.
    • By calling someAccountManager.deploy({ deployWallet: fundedWallet })
  • BananaCoin and BananaFPC are deployed in sandbox by default. Users can use the funded accounts to mint banana coin for a new account.
    • The new account can then submit transactions and pay the fees using PrivateFeePaymentMethod.
    • See example in end-to-end/src/composed/e2e_sandbox_example.test.ts

@LeilaWang LeilaWang added the e2e-all CI: Deprecated, use ci-full. Enable all master checks. label Jan 24, 2025
@LeilaWang LeilaWang requested a review from dbanks12 as a code owner January 31, 2025 15:53
@LeilaWang LeilaWang added the network-all CI: Deprecated, use ci-full. Runs all CI master checks. label Feb 12, 2025
return this.db.loadCapsule(this.contractAddress, slot);
return (
this.capsules.find(c => c.contractAddress.equals(contractAddress) && c.storageSlot.equals(slot))?.data ??
(await this.db.loadCapsule(this.contractAddress, slot))
Copy link
Contributor

@benesjan benesjan Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine to me but I would do 3 chagnes:

  1. Rename the capsules passed via constructor here as ephemeralCapsules to make it clear that it's different data from the ones stored in the DB.
  2. Here check that there is no pertinent capsule under the storage slot of the ephemeral one - if it turns out that there is throw an error. I don't like the idea of ephemeral capsules overshadowing the pertinent ones.
  3. Please update the docs of the load oracle of capsules.nr.

I will also tag Nico here since I feel like he might disagree with me 😆

@nventuro Leila is passing here an ephemeral capsule to the context that live only during tx simulation and the data is being served via the same loadCapsule oracle. Do you think it's fine? (please ignore this until you come back from vacation)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking all capsules are ephemeral. The pertinent data is only available when it's stored by the contract itself. So the previous names, dbStore, dbLoad, etc, make more sense in this case!

Copy link
Contributor

@benesjan benesjan Feb 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking all capsules are ephemeral.

We've decided to update the meaning of what are capsules to not be ephemeral by default. So capsules 2.0 are basically a totally different thing from capsules 1.0. Here is the relevant issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we still separate the apis so that it's clear to the contract users how the data is being retrieved : it could be the data that's previously stored by the contract itself so the users don't have to do anything, or ephemeral data that needs to be provided by the users for the simulation.

And I assume it's the wallet's responsibility to sync the stored capsules across devices?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean by creating a separate oracle handler for the ephemeral capsules and leave the capsules 2.0 intact?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! For the ephemeral capsules there will just be one load api. And when users see this in the contract, it's clear to them that they need to prepare the data themselves for building the tx request.
And for capsules 2.0, nothing needs to be done on users' side, as long as the pxe has all the data previously stored by the contract.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That indeed seems cleaner.

Then in the contract we could have capsules::load(...) or ephemeral_capsules::load(...) with the function args being the same.

@sirasistant sirasistant merged commit 0c93723 into master Feb 17, 2025
12 checks passed
@sirasistant sirasistant deleted the lw/fee_payer branch February 17, 2025 08:00
TomAFrench added a commit that referenced this pull request Feb 17, 2025
* master: (207 commits)
  chore(docs): acir formal verification final report (#12040)
  feat(avm): packed field in bytecode decomposition (#12015)
  feat: Contract updates (#11514)
  feat!: enforce fees (#11480)
  chore: redo typo PR by maximevtush (#12033)
  git subrepo push --branch=master noir-projects/aztec-nr
  git_subrepo.sh: Fix parent in .gitrepo file. [skip ci]
  chore: replace relative paths to noir-protocol-circuits
  git subrepo push --branch=master barretenberg
  fix: unexposing test fr from vkey struct ts (#12028)
  chore: structured polys in Translator (#12003)
  fix(ci3): fix ./bootstrap.sh fast in noir-projects (#12026)
  feat: new op queue logic (#11999)
  git subrepo push --branch=master noir-projects/aztec-nr
  git_subrepo.sh: Fix parent in .gitrepo file. [skip ci]
  chore: replace relative paths to noir-protocol-circuits
  git subrepo push --branch=master barretenberg
  chore: skip flakey p2p (#12021)
  chore(ci3): label handling (#12020)
  feat: Sync from noir (#12002)
  ...
spalladino added a commit that referenced this pull request Feb 20, 2025
Adds a missing guard to flush txs that caused the bot to fail setup in
public networks, accidentally introduced in #11480.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e-all CI: Deprecated, use ci-full. Enable all master checks. network-all CI: Deprecated, use ci-full. Runs all CI master checks.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants