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

feat[lang]: rename _abi_encode and _abi_decode #4097

Merged
merged 5 commits into from
Jun 11, 2024

Conversation

charles-cooper
Copy link
Member

@charles-cooper charles-cooper commented Jun 7, 2024

What I did

How I did it

How to verify it

Commit message

rename to `abi_encode` and `abi_decode` respectively
leave the old ones in, but with deprecation warnings

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

rename to `abi_encode` and `abi_decode` respectively
leave the old ones in, but with deprecation warnings
@z80dev
Copy link
Contributor

z80dev commented Jun 7, 2024

🔥

@charles-cooper charles-cooper marked this pull request as ready for review June 7, 2024 17:27
@charles-cooper charles-cooper changed the title feat[lang]: rename _abi_encode and _abi_decode feat[lang]: rename _abi_encode and _abi_decode Jun 7, 2024
@cyberthirst
Copy link
Collaborator

are we abandoning the idea of using abi.encode / abi.decode?

@cyberthirst
Copy link
Collaborator

i think we can update the docs too in this PR

@cyberthirst
Copy link
Collaborator

would like to see at least a few tests for the new variant

@cyberthirst
Copy link
Collaborator

do we need to display this to the users?

vyper_warn(f"`{self._id}()` is deprecated! Please use `{super()._id}()` instead.", node)

from:

UserWarning: `_abi_decode()` is deprecated! Please use `abi_decode()` instead.

  contract "tests/custom/test4.vy:4", function "run", line 4:52 
       3     y: Bytes[2 * 32 + 3 * 32 + 3 * 32 * 4] = x
  ---> 4     decoded_y1: DynArray[DynArray[uint256, 3], 3] = _abi_decode(
  -----------------------------------------------------------^
       5         y,

  vyper_warn(f"`{self._id}()` is deprecated! Please use `{super()._id}()` instead.", node)

@cyberthirst
Copy link
Collaborator

nit:

# e.g. _abi_encode(bytes) -> _abi_encode((bytes,))
# _abi_encode((bytes,)) -> _abi_encode(((bytes,),))

@cyberthirst
Copy link
Collaborator

this won't be problematic?

abi_decode: "_abi_decode" "(" arg "," type ( "," kwarg )* ")"

Copy link
Collaborator

@pcaversaccio pcaversaccio left a comment

Choose a reason for hiding this comment

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

Please also fix the docs and add a note in the docs for _abi_encode and _abi_decode. Something like:

The syntax `_abi_encode` has been deprecated from version 0.4.0 onwards. Please use `_abi_encode` operator instead.
The syntax `_abi_decode` has been deprecated from version 0.4.0 onwards. Please use `abi_decode` operator instead.

@fubuloubu
Copy link
Member

are we abandoning the idea of using abi.encode / abi.decode?

would love to have abi module namespaced under ethereum stdlib module

@charles-cooper
Copy link
Member Author

do we need to display this to the users?

vyper_warn(f"`{self._id}()` is deprecated! Please use `{super()._id}()` instead.", node)

i think that's just a function of how warnings.warn() works, we can investigate how to squash them but it's unrelated to this PR

@charles-cooper
Copy link
Member Author

this won't be problematic?

abi_decode: "_abi_decode" "(" arg "," type ( "," kwarg )* ")"

hmm yea, it will make some tests fail once we update the usages in the test suite

@charles-cooper
Copy link
Member Author

are we abandoning the idea of using abi.encode / abi.decode?

yea, at least for now. it's a less trivial change, we have no machinery for it right now

@charles-cooper charles-cooper merged commit 7c8862a into vyperlang:master Jun 11, 2024
155 checks passed
pcaversaccio added a commit to pcaversaccio/snekmate that referenced this pull request Jun 11, 2024
### 🕓 Changelog

The Vyper PR vyperlang/vyper#4097 renamed
`_abi_encode` and `_abi_decode` to `abi_encode` and `abi_decode`
respectively. This PR applies these new syntax rules to all 🐍 snekmate
contracts (if applicable). Furthermore, I simplify the glob pattern that
excludes the compilation of non-mock files.

---------

Signed-off-by: Pascal Marco Caversaccio <pascal.caversaccio@hotmail.ch>
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.

5 participants