Skip to content

Commit

Permalink
♻️ Refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Pascal Marco Caversaccio <[email protected]>
  • Loading branch information
pcaversaccio committed Oct 7, 2024
1 parent 3734e18 commit 6f65503
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 29 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ jobs:
- name: Check formatting with Black
uses: psf/black@stable
with:
options: "--check --verbose scripts lib/utils"
options: "--check --verbose"
src: "./lib/utils"

codespell:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -106,6 +107,6 @@ jobs:
- name: Validate URLs
run: |
awesome_bot ./*.md src/snekmate/**/*.vy src/snekmate/**/mocks/*.vy src/snekmate/**/interfaces/*.vyi \
test/**/*.sol test/**/interfaces/*.sol test/**/mocks/*.sol test/**/scripts/*.js lib/utils/*.sol scripts/*.py lib/utils/*.py \
test/**/*.sol test/**/interfaces/*.sol test/**/mocks/*.sol test/**/scripts/*.js lib/utils/*.sol lib/utils/*.py \
--allow-dupe --allow-redirect --request-delay 0.4 \
--white-list https://www.wagmi.xyz,https://github.com/pcaversaccio/snekmate.git@,https://github.com/pcaversaccio/snekmate/releases/tag/v0.1.1,https://github.com/pcaversaccio/snekmate/blob/v0.1.1,https://github.com/pcaversaccio/snekmate/compare/v0.1.0...v0.1.1,https://hyperelliptic.org
2 changes: 1 addition & 1 deletion .github/workflows/halmos-venom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
FOUNDRY_PROFILE: halmos-venom

- name: Run Halmos ERC-20 symbolic tests
run: RUST_LOG=trace halmos --contract ERC20TestHalmos ${{ matrix.halmos }}
run: halmos --contract ERC20TestHalmos ${{ matrix.halmos }}
env:
FOUNDRY_PROFILE: halmos-venom

Expand Down
26 changes: 24 additions & 2 deletions lib/utils/compile.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
import sys, subprocess

result = subprocess.run(["vyper"] + sys.argv[1:], capture_output=True, text=True)

# Check if `experimental_codegen` is enabled in the
# Foundry profile.
def is_experimental_codegen():
return (
subprocess.run(
["bash", "-c", 'forge config --json | jq -r ".vyper.experimental_codegen"'],
capture_output=True,
text=True,
)
.stdout.strip()
.lower()
== "true"
)


# Build the Vyper command.
command = (
["vyper", "--experimental-codegen"] if is_experimental_codegen() else ["vyper"]
)
command += sys.argv[1:]

result = subprocess.run(command, capture_output=True, text=True)
if result.returncode != 0:
raise Exception("Error compiling: " + sys.argv[1])
raise Exception(f"Error compiling: {sys.argv[1]}")

# Remove any leading and trailing whitespace characters
# from the compilation result.
Expand Down
24 changes: 0 additions & 24 deletions scripts/insert_venom_pragma.py

This file was deleted.

0 comments on commit 6f65503

Please sign in to comment.