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

Inconsistency between deducted L1-fee and calculated L1-fee in receipts #255

Open
ezdac opened this issue Oct 10, 2024 · 0 comments
Open
Labels
type:bug Something isn't working

Comments

@ezdac
Copy link

ezdac commented Oct 10, 2024

Currently we short-circuit the l1-fee calculation within the STF and the mempool so that the L1CostFunc that is used in the BlockContext or mempool environment just returns 0 without any considerations for the SystemConfig blobbasefeeScalar and basefeeScalar parameters:

if config.IsCel2(blockTime) {
return func(rcd RollupCostData) (fee, gasUsed *big.Int) { return new(big.Int), new(big.Int) }
}

In comparison to that, the l1 cost function that is used for calculating fields in transaction receipts does not include the short-circuit cost function. It thus returns e.g. Ecotone based values for the fees in the receipt:

// extractL1GasParams extracts the gas parameters necessary to compute gas costs from L1 block info
func extractL1GasParams(config *params.ChainConfig, time uint64, data []byte) (gasParams, error) {
// edge case: for the very first Ecotone block we still need to use the Bedrock
// function. We detect this edge case by seeing if the function selector is the old one
// If so, fall through to the pre-ecotone format
// Both Ecotone and Fjord use the same function selector
if config.IsEcotone(time) && len(data) >= 4 && !bytes.Equal(data[0:4], BedrockL1AttributesSelector) {
p, err := extractL1GasParamsPostEcotone(data)
if err != nil {
return gasParams{}, err
}

This can be verified by querying a random Alfajores transaction:

 cast rpc -r https://alfajores-forno.celo-testnet.org "eth_getTransactionReceipt" 0xb436b9b8c7eda68de4efeaa4907326fd3e207ce361e80d133d075472239716fd | jq
{
  ...
  "l1BaseFeeScalar": "0x558",
  "l1BlobBaseFee": "0x1",
  "l1BlobBaseFeeScalar": "0xc5fc5",
  "l1Fee": "0x304b58869",
  "l1GasPrice": "0x161075592",
  "l1GasUsed": "0x640",
 ...
}

This is not compatible and results in confusion from an end-user perspective.

We should set the l1 fees to zero via the SystemConfig scalar mechanism and remove the short circuit function.
That way, we achieve code-parity with upstream, a consistency between fee-deduction and receipt values and zero l1 fee.

Related: celo-org/optimism#225

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants