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

chore: bump Vyper version to 0.4.0 #18

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Conversation

AlbertoCentonze
Copy link
Contributor

List of Changes

  • Update Vyper version to 0.4.0
  • Update boa to latest release
  • Update tests accordingly
  • Fix broken CI

@AlbertoCentonze AlbertoCentonze changed the title chore: bump vyper version chore: bump Vyper version to 0.4.0 Jan 29, 2025
Copy link

@heswithme heswithme left a comment

Choose a reason for hiding this comment

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

I went through the codebase changes, and observed minor syntax adjustments to make contracts compile with vyper 4.0. Notably, contract names were simplified, and now look much better.

As long as all previously passing tests are passing now, i'd say we're safe from introducing some bugs.

I left some comments here and there, let's iterate a bit on that before accepting this PR.

Choose a reason for hiding this comment

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

I see in the logs that cache@v2 is outdated, may be bump to v3

Choose a reason for hiding this comment

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

all changes seem ok, i did not go through contract to check if anything else should be changed. I guess if contract compiles - no static(ext)calls are missing and syntax is correct.

Choose a reason for hiding this comment

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

the changes are 99% syntax: reentrancy flag, uint division or function calls. However, there's one @pure that became @view, any good reason for that?

@@ -250,10 +244,10 @@ def get_y(
gamma2: int256 = unsafe_mul(gamma, gamma)

# savediv by x_j done here:
y: int256 = D**2 / (x_j * N_COINS**2)
y: int256 = D**2 // (x_j * convert(N_COINS, int256)**2)

Choose a reason for hiding this comment

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

what's up with N_COINS convert? why is it introduced?

D*ann_gamma2/400000000/x_j
- convert(unsafe_mul(10**32, 3), int256)
D*ann_gamma2//400000000//x_j
- (3 * 10**32)
- unsafe_mul(unsafe_mul(2, gamma), 10**14)

Choose a reason for hiding this comment

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

why such changes?

amm_contract_obj = boa.load_partial(
f"./contracts/{contract_folder}/CurveTwocryptoOptimized.vy"
)
amm_contract_obj = boa.load_partial(f"./contracts/{contract_folder}/CurveTwocryptoOptimized.vy")

Choose a reason for hiding this comment

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

ctrl-f old names across the whole repo, see if they are hidden where formatter didn't find them

factory = boa.load_partial(
"contracts/main/CurveTwoCryptoFactory.vy"
).at(deployments[network]["factory"])
factory = boa.load_partial("contracts/main/CurveTwoCryptoFactory.vy").at(

Choose a reason for hiding this comment

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

hehe

with boa.swap_env(env):
yield
assert rpc_url is not None, "Provider url is not set, add RPC_ETHEREUM param to env"
boa.fork(rpc_url)

Choose a reason for hiding this comment

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

shouldn't we use syntax like

with boa.swap_env(boa.Env()):
        boa.fork(rpc_url)

Choose a reason for hiding this comment

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

some legacy tests are just rm'ed. were they not used/not working?

Choose a reason for hiding this comment

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

we have one! test failing, i believe because this test was rm'ed
==================================== ERRORS ====================================
__________ ERROR collecting tests/unitary/factory/test_deploy_pool.py __________
ImportError while importing test module '/home/runner/work/twocrypto-ng/twocrypto-ng/tests/unitary/factory/test_deploy_pool.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
../../../.local/share/uv/python/cpython-3.12.6-linux-x86_64-gnu/lib/python3.12/importlib/init.py:90: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
tests/unitary/factory/test_deploy_pool.py:4: in
from tests.unitary.pool.token.test_permit import ZERO_ADDRESS
E ModuleNotFoundError: No module named 'tests.unitary.pool.token.test_permit'

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.

2 participants