Skip to content

Commit

Permalink
Merge pull request #1684 from eth-brownie/vyper-paris
Browse files Browse the repository at this point in the history
update vyper default evm version to paris
  • Loading branch information
iamdefinitelyahuman authored Jun 2, 2023
2 parents 3b5f0ce + 846026b commit 80109a9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
12 changes: 3 additions & 9 deletions brownie/project/compiler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@
"remappings": [],
},
}
EVM_SOLC_VERSIONS = [
("istanbul", Version("0.5.13")),
("petersburg", Version("0.5.5")),
("byzantium", Version("0.4.0")),
]



def compile_and_format(
Expand Down Expand Up @@ -182,10 +178,8 @@ def generate_input_json(
optimizer = {"enabled": optimize, "runs": runs if optimize else 0}

if evm_version is None:
if language == "Solidity":
evm_version = next(i[0] for i in EVM_SOLC_VERSIONS if solidity.get_version() >= i[1])
else:
evm_version = "istanbul"
_module = solidity if language == "Solidity" else vyper
evm_version = next(i[0] for i in _module.EVM_VERSION_MAPPING if _module.get_version() >= i[1])

input_json: Dict = deepcopy(STANDARD_JSON)
input_json["language"] = language
Expand Down
6 changes: 6 additions & 0 deletions brownie/project/compiler/solidity.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@

AVAILABLE_SOLC_VERSIONS = None

EVM_VERSION_MAPPING = [
("istanbul", Version("0.5.13")),
("petersburg", Version("0.5.5")),
("byzantium", Version("0.4.0")),
]

# error codes used in Solidity >=0.8.0
# docs.soliditylang.org/en/v0.8.0/control-structures.html#panic-via-assert-and-error-via-require
SOLIDITY_ERROR_CODES = {
Expand Down
8 changes: 8 additions & 0 deletions brownie/project/compiler/vyper.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
_active_version = Version(vyper.__version__)


EVM_VERSION_MAPPING = [
("shanghai", Version("0.3.9")),
("paris", Version("0.3.7")),
("berlin", Version("0.2.12")),
("istanbul", Version("0.1.0")),
]


def get_version() -> Version:
return _active_version

Expand Down
2 changes: 1 addition & 1 deletion tests/project/compiler/test_vyper.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_generate_input_json(vysource):

def test_generate_input_json_evm(vysource):
fn = functools.partial(compiler.generate_input_json, {"path.vy": vysource}, language="Vyper")
assert fn()["settings"]["evmVersion"] == "istanbul"
assert fn()["settings"]["evmVersion"] == "paris"
assert fn(evm_version="byzantium")["settings"]["evmVersion"] == "byzantium"
assert fn(evm_version="petersburg")["settings"]["evmVersion"] == "petersburg"

Expand Down

0 comments on commit 80109a9

Please sign in to comment.