Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ABI parser #108

Closed
Closed

Conversation

DanielSchiavini
Copy link
Collaborator

@DanielSchiavini DanielSchiavini commented Dec 12, 2023

  • Implement a separate ABI parser independent from Vyper
  • Implement function overloading
  • Test that it works with Solidity code, dynamic arrays and protected keywords

Fixes #106

boa/vyper/abi.py Outdated
)


def parse_abi_type(abi: dict) -> VyperType:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think maybe a more robust method will be to go directly from the ABI dict/json format to an ABI (string) signature. i used the vyper parser as a shortcut to be compatible with the VyperFunction machinery but if we need to rewrite the prepare_calldata/__call__ machinery think we can just bypass it (parsing to vyper types) at this point.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think eth-abi or eth-stdlib (both included as dependencies already) should have some utilities for this. also may want to wrap the dependency as is done in boa/util/abi.py

Copy link
Collaborator Author

@DanielSchiavini DanielSchiavini Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about this TODO?

# todo: eth.codecs.abi does not have such a function, which one do we use?

boa/abi/function.py Outdated Show resolved Hide resolved
@DanielSchiavini DanielSchiavini marked this pull request as ready for review December 19, 2023 11:28
@DanielSchiavini DanielSchiavini changed the title WIP: Custom ABI parser ABI parser Dec 19, 2023
boa/util/abi.py Outdated Show resolved Hide resolved
boa/util/evm.py Outdated

class _EvmContract:
"""
Base class for the electrum virtual machine contracts:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Base class for the electrum virtual machine contracts:
Base class for EVM (Ethereum Virtual Machine) contracts:

Copy link
Collaborator Author

@DanielSchiavini DanielSchiavini Dec 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😱

boa/util/evm.py Outdated Show resolved Hide resolved
Copy link
Member

@charles-cooper charles-cooper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is looking fairly good. i would say we probably need an overall directory restructuring. how about something like the following:

boa/
  boa/contract/
    boa/contract/base_evm_contract.py
    boa/contract/abi/
      boa/contract/abi/...  # everything currently in boa/abi.py
    boa/contract/vyper/... # everything currently in boa/vyper/...

boa/profiling.py Outdated Show resolved Hide resolved
@DanielSchiavini
Copy link
Collaborator Author

Moving to #115 so the pipeline can run properly without the fork

@DanielSchiavini DanielSchiavini deleted the abi-parsing-bugs branch December 22, 2023 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix ABI parsing bugs
2 participants