From 7d804287889164873c5fdec452a9af0144bbe183 Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Fri, 3 May 2024 17:15:33 -0300 Subject: [PATCH] docs: Update fees kernel tracking docs (#6151) Adds a few lines explaining how global variables are propagated. --- docs/docs/protocol-specs/gas-and-fees/kernel-tracking.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/docs/protocol-specs/gas-and-fees/kernel-tracking.md b/docs/docs/protocol-specs/gas-and-fees/kernel-tracking.md index b5031b0ecf5..b80bc71f5b2 100644 --- a/docs/docs/protocol-specs/gas-and-fees/kernel-tracking.md +++ b/docs/docs/protocol-specs/gas-and-fees/kernel-tracking.md @@ -165,6 +165,7 @@ It must: - set the min_revertible_side_effect_counter if it is present in the `PrivateCallData` - set the `fee_payer` if the `is_fee_payer` flag is set in the `PrivateCircuitPublicInputs` - set the `public_teardown_function_hash` if it is present in the `PrivateCircuitPublicInputs` +- set the `combined_constant_data.global_variables` to zero, since these are not yet known during private execution ## Private Kernel Inner @@ -421,6 +422,8 @@ Therefore, once we verify that the `start_gas_left` which the sequencer provided Further, we can trust that the `transaction_fee` the public VM reported is the one which was made available to the public functions during teardown (though we must verify that the sequencer provided the correct value). +The `PublicCircuitPublicInputs` include the `global_variables` as injected via the `PublicContextInputs`. The first public kernel circuit to run, regardless of whether it is a setup, app, or teardown kernel, is responsible for setting its `constant_data.global_variables` equal to these. All subsequent public kernel circuit runs must verify that the `global_variables` from the `PublicCircuitPublicInputs` match the ones from the previously set `constant_data.global_variables`. + ## Public Kernel Setup The PublicKernelSetup circuit takes in a `PublicKernelData` and a `PublicCallData` and outputs a `PublicKernelCircuitPublicInputs`. @@ -538,6 +541,6 @@ The interplay between these two `revert_code`s is as follows: The base rollup kernel circuit takes in a `KernelData`, which contains a `KernelCircuitPublicInputs`, which it uses to compute the `transaction_fee`. -Additionally, it verifies that the max fees per gas specified by the user are greater than the current block's fees per gas. +Additionally, it verifies that the max fees per gas specified by the user are greater than the current block's fees per gas. It also verifies the `constant_data.global_variables.gas_fees` are correct. After the public data writes specific to this transaction have been processed, and a new tree root is produced, the kernel circuit injects an additional public data write based upon that root which deducts the transaction fee from the `fee_payer`'s balance.