runtimeverification / runtimeverification/kontrol
Investigate discrepancy between method ids
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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