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

Verify payload gas limit against validator setting #17

Open
ckoopmann opened this issue Nov 16, 2023 · 1 comment
Open

Verify payload gas limit against validator setting #17

ckoopmann opened this issue Nov 16, 2023 · 1 comment

Comments

@ckoopmann
Copy link
Collaborator

ckoopmann commented Nov 16, 2023

Currently we are not checking if the gas limit in the payload concurrs with the gas limit registered by the validator.

Special Case: If the requested gas limit is 0, validate the block as if it was 30 million (default)

@ckoopmann
Copy link
Collaborator Author

Reference implementation:


if registeredGasLimit == 0 && header.GasLimit == utils.CalcGasLimit(parent.GasLimit, 30_000_000) {
  // Prysm has a bug where it registers validators with a desired gas limit
  // of 0. Some builders treat these as desiring gas limit 30_000_000. As a
  // workaround, whenever the desired gas limit is 0, we accept both the
  // limit as calculated with a desired limit of 0, and builders which fall
  // back to calculating with the default 30_000_000.
} else {
  calculatedGasLimit := utils.CalcGasLimit(parent.GasLimit, registeredGasLimit)
  if calculatedGasLimit != header.GasLimit {
    return fmt.Errorf("incorrect gas limit set, expected: %d, got: %d", calculatedGasLimit, header.GasLimit)
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant