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

fix(bolt-sidecar): correctly get preconf gas limit from env #656

Open
wants to merge 4 commits into
base: unstable
Choose a base branch
from

Conversation

estensen
Copy link
Contributor

Currently we get BOLT_SIDECAR_GAS_LIMIT which is the gas limit for a single tx. It defaults to DEFAULT_GAS_LIMIT which is 30M. That means pricing input validation will not fail when trying to use more gas than what's left for preconfs in a block. Other valdiation might reject this earlier, but I'd like it to be rejected here as well.

I think it's confusing to have to ENV vars that do the same, so removed BOLT_SIDECAR_GAS_LIMIT and replace it with BOLT_SIDECAR_MAX_COMMITTED_GAS

Copy link
Contributor

@thedevbirb thedevbirb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! A couple of minor questions

@@ -229,8 +225,8 @@ impl<C: StateFetcher> ExecutionState<C> {
// Load the default KZG settings
kzg_settings: EnvKzgSettings::default(),
// TODO: add a way to configure these values from CLI
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment still relevant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, currently only preconf_gas_limit is configurable

/// Other values used for validation.
#[derive(Debug)]
pub struct ValidationParams {
    pub preconf_gas_limit: u64,
    pub max_tx_input_bytes: usize,
    pub max_init_code_byte_size: usize,
}

impl ValidationParams {
    pub fn new(gas_limit: u64) -> Self {
        Self {
            preconf_gas_limit: gas_limit,
            max_tx_input_bytes: 4 * 32 * 1024,
            max_init_code_byte_size: 2 * 24576,
        }
    }
}

Haven't been able to review the usefulnes of the others yet, so will leave the TODO for now

@@ -286,7 +282,7 @@ impl<C: StateFetcher> ExecutionState<C> {
return Err(ValidationError::TransactionSizeTooHigh);
}

// Check if the gas limit is higher than the maximum block gas limit
// Check if the gas limit is higher than the preconf block gas limit
if req.gas_limit() > self.validation_params.block_gas_limit {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think renaming the property block_gas_limit of validation_params to preconf_gas_limit enhances clarity?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, good idea
9cd5b9c

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about nitpicking the naming here, but can we change this to inclusion_gas_limit? If introduce new commitment types, or execution preconfs, the naming is less ambiguous. In general let's try to use inclusion commitment or something similar instead of preconf in the codebase

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpicking is good 👑👑

Copy link
Contributor

@thedevbirb thedevbirb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last nit

bolt-sidecar/src/state/execution.rs Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

3 participants