runtimeverification / runtimeverification/kontrol

Investigate discrepancy between method ids

Open
#493 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
122
Forks
16
PR merge metrics
No merged PRs in 30d

Description

@paulslen ran into the following error

Traceback (most recent call last):
  File "/nix/store/wpgaak7ivg5502jhhkc6m5bjjbc1yylp-python3.10-kontrol-0.1.228/bin/.kontrol-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/wpgaak7ivg5502jhhkc6m5bjjbc1yylp-python3.10-kontrol-0.1.228/lib/python3.10/site-packages/kontrol/__main__.py", line 94, in main
    execute(**vars(args))
  File "/nix/store/wpgaak7ivg5502jhhkc6m5bjjbc1yylp-python3.10-kontrol-0.1.228/lib/python3.10/site-packages/kontrol/__main__.py", line 200, in exec_build
    foundry_kompile(
  File "/nix/store/wpgaak7ivg5502jhhkc6m5bjjbc1yylp-python3.10-kontrol-0.1.228/lib/python3.10/site-packages/kontrol/kompile.py", line 76, in foundry_kompile
    _imports: dict[str, list[str]] = {contract.name_with_path: [] for contract in foundry.contracts.values()}
  File "/nix/store/s6fgyqbk8vn1014daznm5kqx90xdn86x-python3-3.10.13/lib/python3.10/functools.py", line 981, in __get__
    val = self.func(instance)
  File "/nix/store/wpgaak7ivg5502jhhkc6m5bjjbc1yylp-python3.10-kontrol-0.1.228/lib/python3.10/site-packages/kontrol/foundry.py", line 148, in contracts
    contract = Contract(contract_name, contract_json, foundry=True)
  File "/nix/store/wpgaak7ivg5502jhhkc6m5bjjbc1yylp-python3.10-kontrol-0.1.228/lib/python3.10/site-packages/kontrol/solc_to_k.py", line 654, in __init__
    method_selector: str = str(evm['methodIdentifiers'][msig])
KeyError: 'functionName(address,...,(...bool,uint128,uint128)[])'

when trying to run kontrol build in a project. It seems to be caused by the fact that functionName(address,...,(...bool,uint128,uint128)[]) is being looked up in evm['methodIdentifiers'], while it references this function as functionName(address,...,StructContract.StructName[]). At the same time, there is a test in Kontrol that uses an array of structs and is passing: https://github.com/runtimeverification/kontrol/blob/f2987383f7fea749b9cca43d66894a82ea3bca76/src/tests/integration/test-data/foundry/test/DynamicTypes.t.sol#L36

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with kontrol/solc_to_k.py at the methodIdentifiers lookup reported in the traceback, then compare its signature handling with src/tests/integration/test-data/foundry/test/DynamicTypes.t.sol. Reproduce the kontrol build failure and trace why the struct-array signature differs; done means the reported project builds without the KeyError and the existing dynamic-types test remains passing.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, solidity
Domain
blockchain, compilers, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.