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

bug: gas type #102

Open
jbcaron opened this issue Nov 20, 2024 · 0 comments
Open

bug: gas type #102

jbcaron opened this issue Nov 20, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jbcaron
Copy link
Collaborator

jbcaron commented Nov 20, 2024

Bug Report

types-rs version:

Current behavior:

The 'EXECUTION_RESOURCES' schema in the specification defines gas-related fields (l1_gas and l1_data_gas) as type integer. However, there is a discrepancy with the implementation in blockifier (v0.8.0), which returns these values as u128. Internally, the types used for gas values in the types-rs crate are u64, leading to inconsistency and potential type errors.

  • specification: integer (undefined bit width).
  • blockifier output: u128.
  • types-rs internal representation: u64.

This misalignment can cause unexpected behavior and integration issues when consuming Blockifier outputs.

Expected behavior:

  • the specification, blockifier, and the internal representation should use a consistent type.
  • gas-related fields (l1_gas, l1_data_gas) should be defined as u128

Steps to reproduce:

Related code:

starknet-types-rpc

#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
pub struct DataAvailability {
    /// the data gas consumed by this transaction's data, 0 if it uses gas for DA
    pub l1_data_gas: u64,
    /// the gas consumed by this transaction's data, 0 if it uses data gas for DA
    pub l1_gas: u64,
}

blockifier

#[derive(
    derive_more::Add, derive_more::Sum, Clone, Copy, Debug, Default, Eq, PartialEq, Serialize,
)]
pub struct GasVector {
    pub l1_gas: u128,
    pub l1_data_gas: u128,
}

openrpc specs

{
  "type": "object",
  "title": "DataResources",
  "description": "the data-availability resources of this transaction",
  "properties": {
    "data_availability": {
      "type": "object",
      "properties": {
        "l1_gas": {
        "title": "L1Gas",
        "description": "the gas consumed by this transaction's data, 0 if it uses data gas for DA",
        "type": "integer"
        },
        "l1_data_gas": {
          "title": "L1DataGas",
          "description": "the data gas consumed by this transaction's data, 0 if it uses gas for DA",
          "type": "integer"
        }
      }
    }
  } 
}

Other information:

@jbcaron jbcaron added the bug Something isn't working label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant