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

update vyper default evm version to paris #1684

Merged
merged 2 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -177,10 +173,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