-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Inject fee payment update in base rollup (#6403)
Implements the [fee payment update spec](https://hackmd.io/HXPDMgHxRFGmt856JKRfPg) by charging the user's fee in the base rollup circuit. Involves the following changes: - Transactions now have a set of `protocol-public-data-writes`, which are data writes triggered by the protocol and not the user. We populate this in the base rollup circuit to charge the `fee_payer`. Note that if no `fee_payer` is sent, the tx goes through without paying (this will change once we enforce fees). - The base rollup circuit now needs a public data read hint to be able to read the `fee_payer`'s current balance. - The `GasToken` contract now has no `pay_fee` function anymore. The `pay_fee` functions in the FPC are now renamed to `pay_refund` - The `GasToken` address is now a constant, since the base rollup circuit needs to know it to derive the slot for users balances. Because of this, the `portal_address` is removed from the `GasToken` constructor, so the address of the GasToken does not depend on its L1 counterpart, which would have made deployments more cumbersome. - Added an `ACVM_FORCE_WASM` flag to tests to force using acvm wasm instead of binary, since the binary failed to report the assertion failed messages. - The sequencer now validates that the `fee_payer` (if set) has enough balance to pay for the tx before picking it up, assuming it consumes all its gas limits. Coming up on future PRs: - Reenable the native fee payment method and set up a non-bench test for it - Handle fee payments and gas token claims on the same tx (#6562)
- Loading branch information
1 parent
f912ba3
commit 4991188
Showing
73 changed files
with
928 additions
and
422 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
noir-projects/noir-contracts/contracts/fpc_contract/src/fee.nr
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
noir-projects/noir-contracts/contracts/fpc_contract/src/lib.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
use dep::aztec::context::interface::PublicContextInterface; | ||
|
||
pub fn compute_rebate<TPublicContext>( | ||
context: TPublicContext, | ||
initial_amount: Field | ||
) -> Field where TPublicContext: PublicContextInterface { | ||
let actual_fee = context.transaction_fee(); | ||
assert(!initial_amount.lt(actual_fee), "Initial amount paid to the paymaster does not cover actual fee"); | ||
initial_amount - actual_fee | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
noir-projects/noir-protocol-circuits/crates/public-kernel-lib/src/lib.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.