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

[Pectra] Chain or loop of delegations must stop after first code

Open
#25,774 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 on chain or loop of delegations, Consensus Node is failing on second code with `INVALID_OPERATION`, Transaction status is `CONTRACT_EXECUTION_EXCEPTION`

- EIP 7702 Loops
```
In case a delegation indicator points to another delegation, creating a potential chain or loop of delegations, clients must retrieve only the first code and then stop following the delegation chain.
```

### 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. Test failed with `AssertionError: Code of is 0x, expected 0xef0100.`
4. Type 4 transaction of the test (2nd transaction in a row) is failed with `CONTRACT_EXECUTION_EXCEPTION` and `INVALID_OPERATION` in Trace
5. So we are breaking self delegation loop with `INVALID_OPERATION`, but should break it with NoOp and transaction status `SUCCESS`

Contributor guide

Open the contributing guide

Research direction

Start by running the specified execution-spec-tests test_gas.py::test_self_set_code_cost case through the hedera-evm-testing test.sh setup, using the listed Pectra branches. Trace the second type 4 transaction where INVALID_OPERATION occurs during the delegation loop. Done means the loop stops after the first delegation code with NoOp, SUCCESS, and the expected 0xef0100 code.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.