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

Charge gas according to actual resources consumed #1328

Open
1 of 3 tasks
Tracked by #1326 ...
enitrat opened this issue Aug 5, 2024 · 4 comments
Open
1 of 3 tasks
Tracked by #1326 ...

Charge gas according to actual resources consumed #1328

enitrat opened this issue Aug 5, 2024 · 4 comments
Assignees

Comments

@enitrat
Copy link
Collaborator

enitrat commented Aug 5, 2024

EVM and Starknet have different ways of pricing resource usages due to the underlying architecture differences. As such, there cannot be a 1 <> 1 mapping between the EVM gas consumed and the Starknet fee to pay.

As such, we need to design a mechanism ensuring that in the majority of cases, the fee charged for the user (based on gas price and gas used) matches the actual fee, paid by our relayers, for the execution of the starknet transcation.

Tasks

@Eikix
Copy link
Member

Eikix commented Aug 5, 2024

EVM and Starknet have different ways of pricing resource usages due to the underlying architecture differences. As such, there cannot be a 1 <> 1 mapping between the EVM gas consumed and the Starknet fee to pay.

As such, we need to design a mechanism ensuring that in the majority of cases, the fee charged for the user (based on gas price and gas used) matches the actual fee, paid by our relayers, for the execution of the starknet transcation.

Note that an option is also to use our STRK allocation to sponsor part of our users' transactions as part of an on-chain incentive to boost usage. At least until Stwo/Cairo native (they will bring L2 fees down)

Second note: there are extensive efforts to come up with a Rollup Improvement Proposal for EVM L2s to have multi dimensional gas.

@Eikix
Copy link
Member

Eikix commented Aug 5, 2024

A fine plan could be:

  • Start by slightly overcharging with unidimensional gas approach, if too expensive, arrange to sponsor 10% or 50%? We can arrange.
  • Parallely participate to multidimensional gas governance effort. Adopt it eagerly asap.

@obatirou obatirou moved this from 🆕 Backlog to 🔖 Ready in Kakarot's Project Management Aug 13, 2024
@obatirou obatirou moved this from 🔖 Ready to 🏗 In progress in Kakarot's Project Management Aug 13, 2024
@obatirou obatirou self-assigned this Aug 19, 2024
@obatirou obatirou removed their assignment Aug 28, 2024
@eugypalu
Copy link
Contributor

IMG_8157

@eugypalu
Copy link
Contributor

eugypalu commented Oct 21, 2024

To ensure that the network only accepts pre-EIP1559 transactions, it's necessary to make the wallets understand that the network does not accept EIP1559 transactions. This is done in the network definition by specifying that the network does not support EIP1559, which will automatically allow wallets to send the correct transactions.

For example, MetaMask stores the data in a Redux state with metadata, which is used, for example, here and here to verify whether the network supports EIP1559 or not.

An example of netowrk configuration that does not accept EIP1559 is the following:

{
    name: "Mordor Testnet",
    title: "Ethereum Classic Mordor Testnet",
    status: "active",
    chain: "ETC",
    icon: "ethereumclassictestnet",
    rpc: [
        "https://rpc.mordor.etccooperative.org",
        "https://geth-mordor.etc-network.info"
    ],
    features: [
        {
            name: "EIP155"
        }
    ],
    faucets: [
        "https://easy.hebeswap.com/#/faucet",
        "https://faucet.mordortest.net"
    ],
    nativeCurrency: {
        name: "Mordor Ether",
        symbol: "METC",
        decimals: 18
    },
    infoURL: "https://ethereumclassic.org/development/testnets",
    shortName: "metc",
    chainId: 63,
    networkId: 7,
    slip44: 1,
    explorers: [
    {
        name: "blockscout-mordor",
        url: "https://etc-mordor.blockscout.com",
        standard: "EIP3091"
    },
    {
        name: "etcnetworkinfo-expedition-mordor",
        url: "https://explorer-expedition.etc-network.info/?network=Ethereum+Classic+at+etc-network.info+GETH+Mordor",
        standard: "none"
    }
    ]
}

Therefore, to exclude it, it is necessary to modify the configuration file by not including the EIP1559 feature, or by not inheriting from a network that accepts it.

Here is an example of a network that does accept EIP1559:

{
  "name": "Ethereum Mainnet",
  "chain": "ETH",
  "rpc": [
    "https://mainnet.infura.io/v3/${INFURA_API_KEY}",
    "https://api.mycryptoapi.com/eth"
  ],
  "faucets": [],
  "nativeCurrency": {
    "name": "Ether",
    "symbol": "ETH",
    "decimals": 18
  },
  "features": [{ "name": "EIP155" }, { "name": "EIP1559" }],
  "infoURL": "https://ethereum.org",
  "shortName": "eth",
  "chainId": 1,
  "networkId": 1,
  "icon": "ethereum",
  "explorers": [{
    "name": "etherscan",
    "url": "https://etherscan.io",
    "icon": "etherscan",
    "standard": "EIP3091"
  }]
}

From the SDKs' perspective, the main SDKs allow sending pre-EIP1559 transactions, but we need to ensure that EIP1559 transactions are rejected on the RPC side.

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

No branches or pull requests

4 participants