hiero-ledger / hiero-ledger/hiero-consensus-node

[Pectra] type 4 transaction spend much more gas than expected

Open
#25,775 0 comments 0 reactions 0 assignees View on GitHub
Hedera Smart Contract Service Team Promoted
Dominant language
Java
Stars
406
Forks
226
Avg merge
3d 4h
Merged PRs (30d)
210

Description

### Description

During running [execution-spec-tests](https://github.com/gkozyryatskyy/execution-spec-tests) for Pectra, I noticed that `type 4` transaction spend much more gas than expected. Even more, if we increase the gas, it succeed but consume almost all the gas set regardless of gasLimit value (if we set 2kk, it consume almost 2kk, if we set 10kk, it consume almost 10kk).

### Steps to reproduce

1. Set up local Hedera with Pectra feature branches for all the services.
- Use [23725-Enable-EVM-spec-tests](https://github.com/hashgraph/hedera-evm-testing/tree/23725-Enable-EVM-spec-tests) branch of `hedera-evm-testing` to set it up
- Consensus Node: Branch [feature/hedera-evm-pectra-support-v2](https://github.com/hiero-ledger/hiero-consensus-node/tree/feature/hedera-evm-pectra-support-v2) should be at [this path](https://github.com/hashgraph/hedera-evm-testing/blob/23725-Enable-EVM-spec-tests/evm-functional-testing/test.sh#L13)
- Relay: Branch [pectra-upgrade](https://github.com/hiero-ledger/hiero-json-rpc-relay/tree/pectra-upgrade) should be at [this path](https://github.com/hashgraph/hedera-evm-testing/blob/23725-Enable-EVM-spec-tests/evm-functional-testing/test.sh#L25)
- Mirror Node: Images should be replaced at [mn-values.yaml](https://github.com/hashgraph/hedera-evm-testing/blob/23725-Enable-EVM-spec-tests/evm-functional-testing/local/mn-values.yaml#L5) file
- run with `./test.sh solo start`

2. Run specific spect test from [23725-Enable-EVM-spec-tests](https://github.com/gkozyryatskyy/execution-spec-tests/tree/23725-Enable-EVM-spec-tests) branch
```
uv run execute remote -rA --verbose --fork=Prague \
--rpc-endpoint=http://localhost:37546/ \
--rpc-seed-key=0xde78ff4e5e77ec2bf28ef7b446d4bec66e06d39b6e6967864b2bf3d6153f3e68 \
--rpc-chain-id=298 \
--sender-funding-txs-gas-price='710 gwei' \
--default-gas-price=710_000_000_000 \
--sender-fund-refund-gas-limit=1_000_000 \
--seed-account-sweep-amount='500000000 ether' \
--eoa-fund-amount-default=8_000_000_000_000_000_000_000 \
--transaction-gas-limit=12_500_000 \
--tx-wait-timeout=15 \
--html=tests/prague/eip7623_report.html \
--self-contained-html \
"tests/prague/eip7702_set_code_tx/test_gas.py::test_self_set_code_cost[fork_Prague-state_test-pre_authorized_True]"
```

3. Type 4 transaction of the test (6th transaction in the row), `Gas Limit: 2,000,000, Gas Used: 1,967,007`.
- original tests expect it to consume `200_000` gas and its result in `INSUFFICIENT_GAS`
- it will consume almost all the gas set. Even if we set 10kk gas, it will consume almost 10kk. Why?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Prague test command for tests/prague/eip7702_set_code_tx/test_gas.py::test_self_set_code_cost and review the local setup in evm-functional-testing/test.sh and local/mn-values.yaml. Trace the type 4 transaction's gas accounting in the Pectra feature branches and compare it with the execution-spec-tests expectation. Done means the transaction follows the expected 200,000-gas behavior and produces INSUFFICIENT_GAS.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, python
Domain
blockchain, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.