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

fix: metadata output interaction with natspec #3627

Merged
merged 2 commits into from
Sep 28, 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
2 changes: 0 additions & 2 deletions examples/tokens/ERC1155ownable.vy
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ def mint(receiver: address, id: uint256, amount:uint256):
@param receiver the account that will receive the minted token
@param id the ID of the token
@param amount of tokens for this ID
@param data the data associated with this mint. Usually stays empty
"""
assert not self.paused, "The contract has been paused"
assert self.owner == msg.sender, "Only the contract owner can mint"
Expand All @@ -232,7 +231,6 @@ def mintBatch(receiver: address, ids: DynArray[uint256, BATCH_SIZE], amounts: Dy
@param receiver the account that will receive the minted token
@param ids array of ids for the tokens
@param amounts amounts of tokens for each ID in the ids array
@param data the data associated with this mint. Usually stays empty
"""
assert not self.paused, "The contract has been paused"
assert self.owner == msg.sender, "Only the contract owner can mint"
Expand Down
4 changes: 2 additions & 2 deletions tests/base_conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ def _get_contract(w3, source_code, optimize, *args, override_opt_level=None, **k
settings.optimize = override_opt_level or optimize
out = compiler.compile_code(
source_code,
# test that metadata gets generated
["abi", "bytecode", "metadata"],
# test that metadata and natspecs get generated
["abi", "bytecode", "metadata", "userdoc", "devdoc"],
settings=settings,
interface_codes=kwargs.pop("interface_codes", None),
show_gas_estimates=True, # Enable gas estimates for testing
Expand Down
6 changes: 3 additions & 3 deletions vyper/compiler/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def build_metadata_output(compiler_data: CompilerData) -> dict:
sigs = compiler_data.function_signatures

def _var_rec_dict(variable_record):
ret = vars(variable_record)
ret = vars(variable_record).copy()
ret["typ"] = str(ret["typ"])
if ret["data_offset"] is None:
del ret["data_offset"]
Expand All @@ -117,7 +117,7 @@ def _var_rec_dict(variable_record):
return ret

def _to_dict(func_t):
ret = vars(func_t)
ret = vars(func_t).copy()
ret["return_type"] = str(ret["return_type"])
ret["_ir_identifier"] = func_t._ir_info.ir_identifier

Expand All @@ -133,7 +133,7 @@ def _to_dict(func_t):
args = ret[attr]
ret[attr] = {arg.name: str(arg.typ) for arg in args}

ret["frame_info"] = vars(func_t._ir_info.frame_info)
ret["frame_info"] = vars(func_t._ir_info.frame_info).copy()
del ret["frame_info"]["frame_vars"] # frame_var.pos might be IR, cannot serialize

keep_keys = {
Expand Down
Loading