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

Introduce evm-codec package with abi encoding/decoding #258

Merged
merged 39 commits into from
Apr 11, 2024
Merged

Conversation

vanruch
Copy link
Contributor

@vanruch vanruch commented Mar 21, 2024

No description provided.

@vanruch vanruch changed the title Introduce evm-utils package with abi encoding/decoding Introduce evm-codec package with abi encoding/decoding Mar 24, 2024
@vanruch vanruch requested a review from eldargab March 25, 2024 21:03
Copy link
Collaborator

@eldargab eldargab left a comment

Choose a reason for hiding this comment

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

I'd like to suggest the following codec structure - https://github.com/subsquid/squid-sdk/tree/evm-utils-feedback/evm/evm-codec-2

It is

  • Free from any extra allocations (explicit or implicit)
  • Clearly separates tokenisation (Src / Sink) from parsing and walking, making things conceptually simpler.

I haven't tested, but it should be significantly faster, especially for encoding, as Buffer.alloc(), I believe, is allocated outside of GC managed heap and must do some malloc style business, which is not nearly as cheep as regular JS allocation.

@vanruch vanruch requested a review from belopash April 2, 2024 09:10
evm/evm-codec/src/contract-base.ts Outdated Show resolved Hide resolved
evm/evm-codec/src/codec.ts Outdated Show resolved Hide resolved
evm/evm-codec/src/codecs/array.ts Outdated Show resolved Hide resolved
@vanruch vanruch merged commit 1c4f694 into master Apr 11, 2024
1 check passed
@vanruch vanruch deleted the evm-utils branch April 11, 2024 09:49
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.

4 participants