hyperledger / besu

An enterprise-grade Java-based, Apache 2.0 licensed Ethereum client https://wiki.hyperledger.org/display/besu
https://www.hyperledger.org/projects/besu
Apache License 2.0
1.44k stars 765 forks source link

Fixed baseFee option #6335

Closed suraneti closed 2 months ago

suraneti commented 6 months ago

Description

As a developer, I need to enable EIP-1559 on Besu (IBFT 2.0 non-gas-free network) with zeroBaseFee: true to prevent a supply-burning mechanism and fixed baseFee as gasPrice value.

Currently, I've set zeroBaseFee: true. It works fine if I fixed baseFee to the same as my network's gasPrice. However, when calling the eth_feeHistory method, it always returns a 0, causing Metamask to estimate invalid maxBaseFee and maxPriority.

I know it sounds strange but I want to integrate some features that require EIP-1559, such as the Account Abstraction Bundler Node on my network.

Acceptance Criteria

Steps to Reproduce (Bug)

  1. Run Besu IBFT 2.0 with the London upgrade.
  2. Enable zeroBaseFee.
  3. Call eth_feeHistory or use a wallet like Metamask to estimate gas.

Expected behavior: [What you expect to happen]

  1. zeroBaseFee should be a constant value as gasPrice
  2. eth_feeHistory should return non-zero value

Actual behavior: [What actually happens]

  1. eth_feeHistory always return zero value

Frequency: [What percentage of the time does it occur?] 100% on ibft 2.0

Logs (if a bug)

Please post relevant logs from Besu (and the consensus client, if running proof of stake) from before and after the issue.

Versions (Add all that apply)

Additional Information (Add any of the following or anything else that may be relevant)

non-fungible-nelson commented 6 months ago

@fab-10 is there any code that is used for Linea's fee market that could allow for a fixed fee market in Besu private networks?

non-fungible-nelson commented 6 months ago

@matthew1001 any interest in this ticket? valuable for side-chains and straightforward config option changes.

matthew1001 commented 6 months ago

Hi @non-fungible-nelson, possibly, although it would be behind the QBFT/shanghai work and QBFT/empty-block-period work for me, so not likely to come to the top of my list for a little while

fab-10 commented 6 months ago

Please review this work https://github.com/hyperledger/besu/pull/6202 done by @Gabriel-Trintinalia, that could already satisfy your requirement, otherwise could be a good starting point for the development

suraneti commented 6 months ago

For your additional information, here are transactions from my private network (Besu 22.10.2, IBFT2.0)

EIP-1559 transaction:

https://scan.tokenx-alpha.com/tx/0x44b6d7bc905a2ee131b7873106b45d96500e9f24258b4d00d15c577cd0a7dca0

Legacy transaction:

https://scan.tokenx-alpha.com/tx/0x6c1159a020efee86dc47fb3e84cbf44f294f44b3988e8b88471d38b0ad1a1801

Note that either the gasPrice or both the maxBaseFee and maxPriorityFee must be set to 100 gwei. Otherwise, the validator node will not mine the transaction because my network's minimum gasPrice is 100 gwei.

manojpramesh commented 6 months ago

I can take a look at this.

suraneti commented 6 months ago

Could you kindly share if there have been any delightful updates?

bhargav55 commented 6 months ago

I have issues implementing account abstraction in besu, it is reverting with execution reverted error, I have simulated the same scenario in polygon mumbai, it is working fine but not in besu, is this related to config file params? I am using the london block and qbft. I am not using bundlers for now, created userop and directly interacting with entrypoint contract @suraneti

manojpramesh commented 6 months ago

Could you kindly share if there have been any delightful updates?

@suraneti Targeting to get the PR out this weekend. Can you also post here a transaction payload that worked for you.

suraneti commented 6 months ago

@manojpramesh Assuming that my network has set the minimum gas price to 100 gwei.

Legacy payload

{
      from: "<FROM_ADDR>",
      to: "<TO_ADDR>",
      value: "1000000000000000000",
      nonce: 0,
      gasPrice: "100000000000", // 100 gwei
      gasLimit: "21000"
 }

EIP-1559 payload

{
      from: "<FROM_ADDR>",
      to: "<TO_ADDR>",
      value: "1000000000000000000",
      nonce: 0,
      maxPriorityFeePerGas: "100000000000", // 100 gwei
      maxFeePerGas: "100000000000", // 100 gwei
      gasLimit: "21000"
 }
suraneti commented 6 months ago

@bhargav55, my EIP-4337 setup on Besu includes:

Besu version: 22.10.2 or any Besu version that has debugTraceCall. AA Contract: The standard one contract. Account Abstraction SDK: https://docs.stackup.sh/docs/erc-4337-examples Bundler-Node: https://github.com/etherspot/skandha

I've tried several Bundler-Node with Besu, and only Skandha worked.

Important note for Skandha: You have to use the --unsafeMode option to bypass staking validation (#117).

bhargavkacharla commented 5 months ago

@suraneti what are the values you are giving for callGasLimit, verificationGasLimit, preVerificationGas inside userOperation object. transaction getting failed with CALL_EXCEPTION'. you can find more details about the issue here https://github.com/hyperledger/besu/issues/6434. I need help in implementing 4337 in besu network. The similar account abstraction contracts are working in mumbai and fuji

suraneti commented 5 months ago

@manojpramesh I'm looking forward to using this feature and would appreciate an update. Thank you

suraneti commented 5 months ago

I've submitted PR #6562, @non-fungible-nelson @matthew1001 @manojpramesh could you please take a moment to review it when you have the time? I'm unsure whether it's okay or not.

I'm new to the Java language

non-fungible-nelson commented 5 months ago

Awesome contribution 💪🏻 I have asked the engineers to review

macfarla commented 2 months ago

completed in #6562