-
Notifications
You must be signed in to change notification settings - Fork 240
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
docs: making private refunds smooth-brain friendly #7343
docs: making private refunds smooth-brain friendly #7343
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Benchmark resultsMetrics with a significant change:
Detailed resultsAll benchmarks are run on txs on the This benchmark source data is available in JSON format on S3 here. Proof generationEach column represents the number of threads used in proof generation.
L2 block published to L1Each column represents the number of txs on an L2 block published to L1.
L2 chain processingEach column represents the number of blocks on the L2 chain where each block has 8 txs.
Circuits statsStats on running time and I/O sizes collected for every kernel circuit run across all benchmarks.
Stats on running time collected for app circuits
AVM SimulationTime to simulate various public functions in the AVM.
Public DB AccessTime to access various public DBs.
Tree insertion statsThe duration to insert a fixed batch of leaves into each tree type.
MiscellaneousTransaction sizes based on how many contract classes are registered in the tx.
Transaction size based on fee payment method | Metric | | |
noir-projects/noir-contracts/contracts/private_token_contract/src/types/token_note.nr
Show resolved
Hide resolved
c2c0ee4
to
ac14883
Compare
52d3694
to
1413db5
Compare
Changes to circuit sizes
🧾 Summary (100% most significant diffs)
Full diff report 👇
|
1413db5
to
18c5d22
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The maths are super broken 😬
It is not ok to use generators as they are used here. But can see that #7320 exists for that, so this seem to more be description, but description needs to be updated along with the changes to make it understandable and not as broken as it is currently (#7319).
Based on this PR not trying to fix any of the brokenness but add more description I think it in itself is ok, but looking forward to see it being fixed 😭
@@ -9,14 +9,18 @@ use dep::protocol_types::{ | |||
utils::arr_copy_slice | |||
}; | |||
|
|||
pub fn compute_inner_note_hash_from_preimage(storage_slot: Field, note_content_hash: Field) -> Field { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name here is slightly odd to me as it is always a pre-image, but here I would think it would be the note preimage 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how else to call this but I am open to suggestions 😜
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe silo_note_content_hash_to_storage_slot
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't tell you that the return value is what we call inner_note_hash in our terminology and I think it's important to emphasize these terms to not get lost in all the hashing.
@@ -3,13 +3,13 @@ use dep::aztec::oracle::logs::emit_unencrypted_log_private_internal; | |||
use dep::aztec::hash::compute_unencrypted_log_hash; | |||
use dep::aztec::context::PrivateContext; | |||
|
|||
fn emit_nonce_as_unencrypted_log(context: &mut PrivateContext, nonce: Field) { | |||
fn emit_randomness_as_unencrypted_log(context: &mut PrivateContext, randomness: Field) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👁️ 🥄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a consequence of the function being nuked from private context in your PR 😬 Not really sure what to do about this. Maybe we could move the original function to a danger.nr file in aztec-nr?
noir-projects/noir-contracts/contracts/private_token_contract/src/main.nr
Show resolved
Hide resolved
noir-projects/noir-contracts/contracts/private_token_contract/src/main.nr
Show resolved
Hide resolved
); | ||
|
||
// 5. Set the public teardown function to `complete_refund(...)`. Public teardown is the only time when a public |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me being slightly ignorant around fees. Is anything stopping me from calling set_public_teardown_function
multiple times? Is there a point wherein it must have been set? @just-mitch.
Namely here thinking about the case where it is updated in a later call 👀 Would the complete_refund
then simply not be executed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there is a check in noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_validator.nr
that ensures you cannot overwrite the teardown function; attempts to do so will cause the kernel to fail.
user_point_x: Field, | ||
user_point_y: Field | ||
) { | ||
let fpc_point = EmbeddedCurvePoint { x: fpc_point_x, y: fpc_point_y, is_infinite: false }; | ||
// 1. We get the final note content hashes by calling the `complete_refund` on the note. | ||
let fee_payer_point = EmbeddedCurvePoint { x: fee_payer_point_x, y: fee_payer_point_y, is_infinite: false }; | ||
let user_point = EmbeddedCurvePoint { x: user_point_x, y: user_point_y, is_infinite: false }; | ||
let tx_fee = context.transaction_fee(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More ignorance from my side. But when computing the fee at this point, you will not include the insertions that happen later here or any of the compute. Does the FPC end up paying for those and then the user underpays here, or 👀? @just-mitch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The teardown phase is special in that the user pre-pays for the gas consumed. So the user specifies:
- DA/L2 gas limit
- teardown DA/L2 gas limit (which is a subset of the above)
Then the AVM starts teardown with the teardown limits set as start gas. So really the FPC needs to be checking in setup that the amount specified for teardown is sufficient to make sure it doesn't run OOG, but regardless context.transaction_fee()
is always exclusive of what is actually done in teardown, as long as we don't run out of gas.
So yes, in effect, the FPC could overpay if the teardown limit is too high, but they ought to be charging the user for that overpayment.
noir-projects/noir-contracts/contracts/private_token_contract/src/types/token_note.nr
Show resolved
Hide resolved
noir-projects/noir-contracts/contracts/private_token_contract/src/types/token_note.nr
Show resolved
Hide resolved
@LHerskind will address your comments in a PR on top of the stack to avoid conflicts. |
* master: (176 commits) refactor: counters (#7342) chore: notify Noir team on changes to the stdlib (#7387) chore(bb): do not instantiate Relation (#7389) chore(avm): avoid including flavor where possible (#7361) chore(avm): better log_derivative_inverse_round (#7360) chore(avm): smaller prover (#7359) chore(avm): smaller transcript (#7357) feat: Sync from noir (#7352) feat: VK tree (#6914) chore(docs): Update token tutorial (#7241) chore: sync external contributions (#6984) fix: privacy leak in private refund (#7358) fix: included argshash computation in public call_interfaces and cleanup (#7354) docs: making private refunds smooth-brain friendly (#7343) refactor: optimize public call stack item hashing (#7330) fix: Allow importing notes from other contracts and inject them in the macros (#7349) refactor: Optimize private call stack item hash for gate count (#7285) 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 ...
🤖 I have created a release *beep* *boop* --- <details><summary>aztec-package: 0.46.0</summary> ## [0.46.0](aztec-package-v0.45.1...aztec-package-v0.46.0) (2024-07-09) ### Features * VK tree ([#6914](#6914)) ([8631237](8631237)) </details> <details><summary>barretenberg.js: 0.46.0</summary> ## [0.46.0](barretenberg.js-v0.45.1...barretenberg.js-v0.46.0) (2024-07-09) ### Miscellaneous * **barretenberg.js:** Synchronize aztec-packages versions </details> <details><summary>aztec-packages: 0.46.0</summary> ## [0.46.0](aztec-packages-v0.45.1...aztec-packages-v0.46.0) (2024-07-09) ### ⚠ BREAKING CHANGES * constant inputs for blackbox ([#7222](#7222)) ### Features * Add more slice methods to the stdlib (noir-lang/noir#5424) ([6137a10](6137a10)) * Constant inputs for blackbox ([#7222](#7222)) ([9f9ded2](9f9ded2)) * Detect subgraphs that are completely independent from inputs or outputs (noir-lang/noir#5402) ([c7b1ae4](c7b1ae4)) * Lsp "go to definition" for modules (noir-lang/noir#5406) ([c7b1ae4](c7b1ae4)) * Lsp rename/find-all-references for traits (noir-lang/noir#5409) ([c7b1ae4](c7b1ae4)) * Lsp rename/find-all-references for type aliases (noir-lang/noir#5414) ([6137a10](6137a10)) * Sync from aztec-packages (noir-lang/noir#5408) ([c7b1ae4](c7b1ae4)) * Sync from aztec-packages (noir-lang/noir#5432) ([6137a10](6137a10)) * TXE docs and usability ([#7305](#7305)) ([6b2a351](6b2a351)) * Unquote multiple items from annotations (noir-lang/noir#5441) ([6137a10](6137a10)) * VK tree ([#6914](#6914)) ([8631237](8631237)) ### Bug Fixes * Allow importing notes from other contracts and inject them in the macros ([#7349](#7349)) ([586c0b0](586c0b0)) * Change panic to error in interpreter (noir-lang/noir#5446) ([6137a10](6137a10)) * Complete call stacks with no_predicates (noir-lang/noir#5418) ([c7b1ae4](c7b1ae4)) * Correct range for overlfowing/underflowing integer assignment (noir-lang/noir#5416) ([c7b1ae4](c7b1ae4)) * Included argshash computation in public call_interfaces and cleanup ([#7354](#7354)) ([13e9b94](13e9b94)) * Lsp find struct reference in return locations and paths (noir-lang/noir#5404) ([c7b1ae4](c7b1ae4)) * Lsp struct rename/reference difference (noir-lang/noir#5411) ([6137a10](6137a10)) * Privacy leak in private refund ([#7358](#7358)) ([e05f6f0](e05f6f0)), closes [#7321](#7321) ### Miscellaneous * Add remaining slice methods to the interpreter (noir-lang/noir#5422) ([c7b1ae4](c7b1ae4)) * Add test and benchmarks for poseidon2 (noir-lang/noir#5386) ([c7b1ae4](c7b1ae4)) * **avm:** Avoid including flavor where possible ([#7361](#7361)) ([dbdffd6](dbdffd6)) * **avm:** Better log_derivative_inverse_round ([#7360](#7360)) ([6329833](6329833)) * **avm:** Smaller prover ([#7359](#7359)) ([7d8c833](7d8c833)) * **avm:** Smaller transcript ([#7357](#7357)) ([3952a44](3952a44)) * **bb:** Do not instantiate Relation ([#7389](#7389)) ([d9cbf4c](d9cbf4c)) * Counters ([#7342](#7342)) ([819f370](819f370)) * **docs:** Fix link to docker ([#7395](#7395)) ([ad4a401](ad4a401)) * **docs:** Update token tutorial ([#7241](#7241)) ([0414eb5](0414eb5)) * Dummy workflow (noir-lang/noir#5438) ([6137a10](6137a10)) * Extracts refactoring of reading error payloads from [#5403](#5403) (noir-lang/noir#5413) ([6137a10](6137a10)) * Generate declaration files for VKs ([#7391](#7391)) ([7c96636](7c96636)) * Merge `BarretenbergVerifierBackend` and `BarretenbergBackend` (noir-lang/noir#5399) ([6137a10](6137a10)) * Move SSA checks to a new folder (noir-lang/noir#5434) ([6137a10](6137a10)) * Notify Noir team on changes to the stdlib ([#7387](#7387)) ([061aac3](061aac3)) * Optimize private call stack item hash for gate count ([#7285](#7285)) ([783d9b6](783d9b6)) * Optimize public call stack item hashing ([#7330](#7330)) ([4a5093c](4a5093c)) * Refactor logic around inlining `no_predicates` functions (noir-lang/noir#5433) ([6137a10](6137a10)) * Replace relative paths to noir-protocol-circuits ([8510269](8510269)) * Replace relative paths to noir-protocol-circuits ([9eb8d1c](9eb8d1c)) * Sync external contributions ([#6984](#6984)) ([a265b29](a265b29)) ### Documentation * Making private refunds smooth-brain friendly ([#7343](#7343)) ([533c937](533c937)) * Update overview.md (fix link text) ([#7344](#7344)) ([79e5856](79e5856)) </details> <details><summary>barretenberg: 0.46.0</summary> ## [0.46.0](barretenberg-v0.45.1...barretenberg-v0.46.0) (2024-07-09) ### ⚠ BREAKING CHANGES * constant inputs for blackbox ([#7222](#7222)) ### Features * Constant inputs for blackbox ([#7222](#7222)) ([9f9ded2](9f9ded2)) ### Miscellaneous * **avm:** Avoid including flavor where possible ([#7361](#7361)) ([dbdffd6](dbdffd6)) * **avm:** Better log_derivative_inverse_round ([#7360](#7360)) ([6329833](6329833)) * **avm:** Smaller prover ([#7359](#7359)) ([7d8c833](7d8c833)) * **avm:** Smaller transcript ([#7357](#7357)) ([3952a44](3952a44)) * **bb:** Do not instantiate Relation ([#7389](#7389)) ([d9cbf4c](d9cbf4c)) * Counters ([#7342](#7342)) ([819f370](819f370)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
🤖 I have created a release *beep* *boop* --- <details><summary>aztec-package: 0.46.0</summary> ## [0.46.0](AztecProtocol/aztec-packages@aztec-package-v0.45.1...aztec-package-v0.46.0) (2024-07-09) ### Features * VK tree ([#6914](AztecProtocol/aztec-packages#6914)) ([8631237](AztecProtocol/aztec-packages@8631237)) </details> <details><summary>barretenberg.js: 0.46.0</summary> ## [0.46.0](AztecProtocol/aztec-packages@barretenberg.js-v0.45.1...barretenberg.js-v0.46.0) (2024-07-09) ### Miscellaneous * **barretenberg.js:** Synchronize aztec-packages versions </details> <details><summary>aztec-packages: 0.46.0</summary> ## [0.46.0](AztecProtocol/aztec-packages@aztec-packages-v0.45.1...aztec-packages-v0.46.0) (2024-07-09) ### ⚠ BREAKING CHANGES * constant inputs for blackbox ([#7222](AztecProtocol/aztec-packages#7222)) ### Features * Add more slice methods to the stdlib (noir-lang/noir#5424) ([6137a10](AztecProtocol/aztec-packages@6137a10)) * Constant inputs for blackbox ([#7222](AztecProtocol/aztec-packages#7222)) ([9f9ded2](AztecProtocol/aztec-packages@9f9ded2)) * Detect subgraphs that are completely independent from inputs or outputs (noir-lang/noir#5402) ([c7b1ae4](AztecProtocol/aztec-packages@c7b1ae4)) * Lsp "go to definition" for modules (noir-lang/noir#5406) ([c7b1ae4](AztecProtocol/aztec-packages@c7b1ae4)) * Lsp rename/find-all-references for traits (noir-lang/noir#5409) ([c7b1ae4](AztecProtocol/aztec-packages@c7b1ae4)) * Lsp rename/find-all-references for type aliases (noir-lang/noir#5414) ([6137a10](AztecProtocol/aztec-packages@6137a10)) * Sync from aztec-packages (noir-lang/noir#5408) ([c7b1ae4](AztecProtocol/aztec-packages@c7b1ae4)) * Sync from aztec-packages (noir-lang/noir#5432) ([6137a10](AztecProtocol/aztec-packages@6137a10)) * TXE docs and usability ([#7305](AztecProtocol/aztec-packages#7305)) ([6b2a351](AztecProtocol/aztec-packages@6b2a351)) * Unquote multiple items from annotations (noir-lang/noir#5441) ([6137a10](AztecProtocol/aztec-packages@6137a10)) * VK tree ([#6914](AztecProtocol/aztec-packages#6914)) ([8631237](AztecProtocol/aztec-packages@8631237)) ### Bug Fixes * Allow importing notes from other contracts and inject them in the macros ([#7349](AztecProtocol/aztec-packages#7349)) ([586c0b0](AztecProtocol/aztec-packages@586c0b0)) * Change panic to error in interpreter (noir-lang/noir#5446) ([6137a10](AztecProtocol/aztec-packages@6137a10)) * Complete call stacks with no_predicates (noir-lang/noir#5418) ([c7b1ae4](AztecProtocol/aztec-packages@c7b1ae4)) * Correct range for overlfowing/underflowing integer assignment (noir-lang/noir#5416) ([c7b1ae4](AztecProtocol/aztec-packages@c7b1ae4)) * Included argshash computation in public call_interfaces and cleanup ([#7354](AztecProtocol/aztec-packages#7354)) ([13e9b94](AztecProtocol/aztec-packages@13e9b94)) * Lsp find struct reference in return locations and paths (noir-lang/noir#5404) ([c7b1ae4](AztecProtocol/aztec-packages@c7b1ae4)) * Lsp struct rename/reference difference (noir-lang/noir#5411) ([6137a10](AztecProtocol/aztec-packages@6137a10)) * Privacy leak in private refund ([#7358](AztecProtocol/aztec-packages#7358)) ([e05f6f0](AztecProtocol/aztec-packages@e05f6f0)), closes [#7321](AztecProtocol/aztec-packages#7321) ### Miscellaneous * Add remaining slice methods to the interpreter (noir-lang/noir#5422) ([c7b1ae4](AztecProtocol/aztec-packages@c7b1ae4)) * Add test and benchmarks for poseidon2 (noir-lang/noir#5386) ([c7b1ae4](AztecProtocol/aztec-packages@c7b1ae4)) * **avm:** Avoid including flavor where possible ([#7361](AztecProtocol/aztec-packages#7361)) ([dbdffd6](AztecProtocol/aztec-packages@dbdffd6)) * **avm:** Better log_derivative_inverse_round ([#7360](AztecProtocol/aztec-packages#7360)) ([6329833](AztecProtocol/aztec-packages@6329833)) * **avm:** Smaller prover ([#7359](AztecProtocol/aztec-packages#7359)) ([7d8c833](AztecProtocol/aztec-packages@7d8c833)) * **avm:** Smaller transcript ([#7357](AztecProtocol/aztec-packages#7357)) ([3952a44](AztecProtocol/aztec-packages@3952a44)) * **bb:** Do not instantiate Relation ([#7389](AztecProtocol/aztec-packages#7389)) ([d9cbf4c](AztecProtocol/aztec-packages@d9cbf4c)) * Counters ([#7342](AztecProtocol/aztec-packages#7342)) ([819f370](AztecProtocol/aztec-packages@819f370)) * **docs:** Fix link to docker ([#7395](AztecProtocol/aztec-packages#7395)) ([ad4a401](AztecProtocol/aztec-packages@ad4a401)) * **docs:** Update token tutorial ([#7241](AztecProtocol/aztec-packages#7241)) ([0414eb5](AztecProtocol/aztec-packages@0414eb5)) * Dummy workflow (noir-lang/noir#5438) ([6137a10](AztecProtocol/aztec-packages@6137a10)) * Extracts refactoring of reading error payloads from [#5403](AztecProtocol/aztec-packages#5403) (noir-lang/noir#5413) ([6137a10](AztecProtocol/aztec-packages@6137a10)) * Generate declaration files for VKs ([#7391](AztecProtocol/aztec-packages#7391)) ([7c96636](AztecProtocol/aztec-packages@7c96636)) * Merge `BarretenbergVerifierBackend` and `BarretenbergBackend` (noir-lang/noir#5399) ([6137a10](AztecProtocol/aztec-packages@6137a10)) * Move SSA checks to a new folder (noir-lang/noir#5434) ([6137a10](AztecProtocol/aztec-packages@6137a10)) * Notify Noir team on changes to the stdlib ([#7387](AztecProtocol/aztec-packages#7387)) ([061aac3](AztecProtocol/aztec-packages@061aac3)) * Optimize private call stack item hash for gate count ([#7285](AztecProtocol/aztec-packages#7285)) ([783d9b6](AztecProtocol/aztec-packages@783d9b6)) * Optimize public call stack item hashing ([#7330](AztecProtocol/aztec-packages#7330)) ([4a5093c](AztecProtocol/aztec-packages@4a5093c)) * Refactor logic around inlining `no_predicates` functions (noir-lang/noir#5433) ([6137a10](AztecProtocol/aztec-packages@6137a10)) * Replace relative paths to noir-protocol-circuits ([8510269](AztecProtocol/aztec-packages@8510269)) * Replace relative paths to noir-protocol-circuits ([9eb8d1c](AztecProtocol/aztec-packages@9eb8d1c)) * Sync external contributions ([#6984](AztecProtocol/aztec-packages#6984)) ([a265b29](AztecProtocol/aztec-packages@a265b29)) ### Documentation * Making private refunds smooth-brain friendly ([#7343](AztecProtocol/aztec-packages#7343)) ([533c937](AztecProtocol/aztec-packages@533c937)) * Update overview.md (fix link text) ([#7344](AztecProtocol/aztec-packages#7344)) ([79e5856](AztecProtocol/aztec-packages@79e5856)) </details> <details><summary>barretenberg: 0.46.0</summary> ## [0.46.0](AztecProtocol/aztec-packages@barretenberg-v0.45.1...barretenberg-v0.46.0) (2024-07-09) ### ⚠ BREAKING CHANGES * constant inputs for blackbox ([#7222](AztecProtocol/aztec-packages#7222)) ### Features * Constant inputs for blackbox ([#7222](AztecProtocol/aztec-packages#7222)) ([9f9ded2](AztecProtocol/aztec-packages@9f9ded2)) ### Miscellaneous * **avm:** Avoid including flavor where possible ([#7361](AztecProtocol/aztec-packages#7361)) ([dbdffd6](AztecProtocol/aztec-packages@dbdffd6)) * **avm:** Better log_derivative_inverse_round ([#7360](AztecProtocol/aztec-packages#7360)) ([6329833](AztecProtocol/aztec-packages@6329833)) * **avm:** Smaller prover ([#7359](AztecProtocol/aztec-packages#7359)) ([7d8c833](AztecProtocol/aztec-packages@7d8c833)) * **avm:** Smaller transcript ([#7357](AztecProtocol/aztec-packages#7357)) ([3952a44](AztecProtocol/aztec-packages@3952a44)) * **bb:** Do not instantiate Relation ([#7389](AztecProtocol/aztec-packages#7389)) ([d9cbf4c](AztecProtocol/aztec-packages@d9cbf4c)) * Counters ([#7342](AztecProtocol/aztec-packages#7342)) ([819f370](AztecProtocol/aztec-packages@819f370)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the cleanup @benesjan !
@@ -9,14 +9,18 @@ use dep::protocol_types::{ | |||
utils::arr_copy_slice | |||
}; | |||
|
|||
pub fn compute_inner_note_hash_from_preimage(storage_slot: Field, note_content_hash: Field) -> Field { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe silo_note_content_hash_to_storage_slot
?
); | ||
|
||
// 5. Set the public teardown function to `complete_refund(...)`. Public teardown is the only time when a public |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there is a check in noir-projects/noir-protocol-circuits/crates/private-kernel-lib/src/components/private_kernel_circuit_output_validator.nr
that ensures you cannot overwrite the teardown function; attempts to do so will cause the kernel to fail.
user_point_x: Field, | ||
user_point_y: Field | ||
) { | ||
let fpc_point = EmbeddedCurvePoint { x: fpc_point_x, y: fpc_point_y, is_infinite: false }; | ||
// 1. We get the final note content hashes by calling the `complete_refund` on the note. | ||
let fee_payer_point = EmbeddedCurvePoint { x: fee_payer_point_x, y: fee_payer_point_y, is_infinite: false }; | ||
let user_point = EmbeddedCurvePoint { x: user_point_x, y: user_point_y, is_infinite: false }; | ||
let tx_fee = context.transaction_fee(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The teardown phase is special in that the user pre-pays for the gas consumed. So the user specifies:
- DA/L2 gas limit
- teardown DA/L2 gas limit (which is a subset of the above)
Then the AVM starts teardown with the teardown limits set as start gas. So really the FPC needs to be checking in setup that the amount specified for teardown is sufficient to make sure it doesn't run OOG, but regardless context.transaction_fee()
is always exclusive of what is actually done in teardown, as long as we don't run out of gas.
So yes, in effect, the FPC could overpay if the teardown limit is too high, but they ought to be charging the user for that overpayment.
I've been going through the private refunds today and since it's all quite complex I decided to add more comments and clean that up