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

feat[lang]: singleton modules with ownership hierarchy #3729

Merged
merged 164 commits into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from 133 commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
4cf4cd7
allow walrus operator
charles-cooper Jan 13, 2024
dad2072
enforce single visit of modules
charles-cooper Jan 13, 2024
c7819e6
add UsesDecl and InitializesDecl nodes
charles-cooper Jan 13, 2024
f524fd9
add special visibility for the __init__ function
charles-cooper Dec 27, 2023
7431780
add compilation for init functions
charles-cooper Jan 13, 2024
9d6a3dc
fix an assert
charles-cooper Jan 13, 2024
672441d
Merge branch 'master' into feat/singleton_modules
charles-cooper Jan 14, 2024
46140f4
fix bad variable name in vyper.ast.nodes
charles-cooper Jan 14, 2024
d6d7de7
remove dead variable: Context.in_assertion
charles-cooper Jan 14, 2024
b67d361
get __init__() working both as entry point and as internal function
charles-cooper Jan 14, 2024
1089ee0
add sanity checks
charles-cooper Jan 14, 2024
6bb650b
update storage allocator - recurse into `initialized` modules
charles-cooper Jan 15, 2024
c3d5765
use tagged expr_info instead of context.globals
charles-cooper Jan 15, 2024
4a1f1d8
fix get_expr_info for nested moduleinfo
charles-cooper Jan 15, 2024
f89b118
fix missing expr_info
charles-cooper Jan 15, 2024
c1ca06f
add simple storage variable
charles-cooper Jan 19, 2024
6adbb5a
add more complicated test
charles-cooper Jan 19, 2024
99f9b8a
Merge branch 'master' into feat/singleton_modules
charles-cooper Feb 2, 2024
468b35e
implement borrowship checker
charles-cooper Feb 2, 2024
de98cbc
add uses check for module writes
charles-cooper Feb 2, 2024
d82eb3e
add global initialization constraint
charles-cooper Feb 3, 2024
82e1da0
fix mypy
charles-cooper Feb 3, 2024
9d94161
fix duplicate initialization check, rename FunctionNodeVisitor to Fun…
charles-cooper Feb 3, 2024
21b753a
fix some mypy
charles-cooper Feb 3, 2024
629f2e6
add missing case
charles-cooper Feb 3, 2024
72bf1ba
simplify mutability check
charles-cooper Feb 3, 2024
63aaa8d
fix a bad exception type
charles-cooper Feb 3, 2024
07aa416
rename CONSTRUCTOR visibility to DEPLOY, and make it user-facing
charles-cooper Feb 3, 2024
cf942ab
fix a lint
charles-cooper Feb 3, 2024
21fe23d
add a comment
charles-cooper Feb 3, 2024
27dfd6b
add init function check
charles-cooper Feb 3, 2024
b10ce08
move initializer check to module analysis
charles-cooper Feb 3, 2024
3e16f2d
add uses check
charles-cooper Feb 3, 2024
15057aa
refactor: move global initializer constraint checker to global.py
charles-cooper Feb 3, 2024
6a227d9
add a check that deploy functions can only be called from deploy func…
charles-cooper Feb 3, 2024
5bc40b8
fix lint
charles-cooper Feb 3, 2024
7b8aebb
pretty up an error message
charles-cooper Feb 3, 2024
3c2fbf3
some fixes
charles-cooper Feb 4, 2024
34ca482
fix scope_name for ExprVisitor
charles-cooper Feb 4, 2024
1e91a63
fix stray debug
charles-cooper Feb 4, 2024
2a52622
add recursive allocator for immutables
charles-cooper Feb 4, 2024
61310c0
add a comment
charles-cooper Feb 4, 2024
34244c4
refactor: move validate_modification to analysis/utils.py
charles-cooper Feb 4, 2024
8472c29
move validate_numeric_op from validate_modification directly into vis…
charles-cooper Feb 4, 2024
2fd7848
refactor validate_modification: remove `node` parameter
charles-cooper Feb 4, 2024
446c70a
fix tag_exceptions, again
charles-cooper Feb 4, 2024
e99c7af
fix circular import
charles-cooper Feb 4, 2024
a1c177d
refactor: rename _StringEnum to StringEnum
charles-cooper Feb 4, 2024
70a9b56
make DataLocation a StringEnum
charles-cooper Feb 4, 2024
255669d
add a comment
charles-cooper Feb 4, 2024
7f296e7
dynamic programming
charles-cooper Feb 4, 2024
e0174fd
fix module use checker
charles-cooper Feb 4, 2024
462a7b4
small fix
charles-cooper Feb 4, 2024
24abdd8
improve modifiability check
charles-cooper Feb 4, 2024
4981710
fix: bad assertion in expr.py
charles-cooper Feb 4, 2024
032b8b5
improve an error
charles-cooper Feb 4, 2024
aff0fb4
fix for unfolded constant variables
charles-cooper Feb 5, 2024
27770ef
spruce up some error messages
charles-cooper Feb 5, 2024
ccb5a68
Merge branch 'master' into feat/singleton_modules
charles-cooper Feb 5, 2024
a490eee
Merge branch 'master' into feat/singleton_modules
charles-cooper Feb 5, 2024
8902991
fix mypy
charles-cooper Feb 5, 2024
e51756c
Merge branch 'master' into feat/singleton_modules
charles-cooper Feb 5, 2024
70e0226
get rid of bad Index nodes
charles-cooper Feb 5, 2024
3ebd2d3
update a bunch of __init__ functions visibility to `@deploy` from `@e…
charles-cooper Feb 5, 2024
0945835
fix a bug
charles-cooper Feb 5, 2024
00aa0bf
fix another bug
charles-cooper Feb 5, 2024
142ae33
change a bunch of __init__ function visibilities - `@external` to `@d…
charles-cooper Feb 5, 2024
0d7052e
fix abi -- emit constructor in abi
charles-cooper Feb 5, 2024
58937a8
use TYPE_T in functions instead of "TYPE_DEFINITION"
charles-cooper Feb 5, 2024
3477373
move hashmap check into handle_modification
charles-cooper Feb 5, 2024
c74e74d
refactor out check_call_modifiability
charles-cooper Feb 5, 2024
dd94476
Revert "refactor out check_call_modifiability"
charles-cooper Feb 5, 2024
fd0fb67
refactor out check_call_mutability (take 2)
charles-cooper Feb 5, 2024
6a5434e
fix a test
charles-cooper Feb 5, 2024
3587ef1
stray @external -> @deploy
charles-cooper Feb 5, 2024
7b06f5d
fix: don't require call to __init__ when module has no __init__ function
charles-cooper Feb 5, 2024
253b924
fix: panic when mutating complex immutables
charles-cooper Feb 5, 2024
58358c1
fix a test
charles-cooper Feb 5, 2024
bbd0c13
update a test
charles-cooper Feb 5, 2024
61aac63
update an error message
charles-cooper Feb 5, 2024
168c939
update dead code eliminator tests
charles-cooper Feb 5, 2024
8952c6d
fix lint
charles-cooper Feb 5, 2024
89eff74
fix mypy
charles-cooper Feb 5, 2024
1d331ce
add NamedExpr to vyper/ast/nodes.pyi
charles-cooper Feb 6, 2024
84c5188
fix: bad error message in constant folder
charles-cooper Feb 6, 2024
125ae11
add hint functionality to VyperException
charles-cooper Feb 6, 2024
ffb9deb
improve an error message
charles-cooper Feb 6, 2024
8ed92d4
format an error message
charles-cooper Feb 6, 2024
0d3b032
refactor some hints
charles-cooper Feb 6, 2024
10f3aeb
refactor out find_module routine
charles-cooper Feb 6, 2024
1133674
fix a type signature
charles-cooper Feb 6, 2024
316456a
fix global initializer constraint and improve an error message
charles-cooper Feb 6, 2024
76db10c
fix a function name
charles-cooper Feb 6, 2024
02ca269
make ModuleOwnership a StringEnum, fix an error message
charles-cooper Feb 6, 2024
8950848
test initializer init function
charles-cooper Feb 6, 2024
b7ba6f1
fix ordering of Modifiability things
charles-cooper Feb 6, 2024
ad09356
fix modifiability propagation
charles-cooper Feb 6, 2024
3f74ed8
refactor: Attribute.get_attribute_root()
charles-cooper Feb 6, 2024
ba80865
improve some error messages
charles-cooper Feb 6, 2024
cf3c3e3
fix an error message
charles-cooper Feb 6, 2024
c8deffd
add tests for initializer constraints
charles-cooper Feb 6, 2024
8bb4399
fix mypy; refactor get_attribute_root
charles-cooper Feb 6, 2024
afcef72
can't call `@deploy` function from `@internal` function
charles-cooper Feb 6, 2024
74f6ffb
fix: unused modules cannot be used as default arguments
charles-cooper Feb 6, 2024
18bb4d0
fix lint
charles-cooper Feb 6, 2024
a7ca410
add a couple more tests
charles-cooper Feb 6, 2024
aa5b802
fix variable writes analysis
charles-cooper Feb 6, 2024
afb5dd0
fix some tests
charles-cooper Feb 6, 2024
b697f24
refactor module use analysis
charles-cooper Feb 6, 2024
865661a
ban module state reads without `uses`
charles-cooper Feb 6, 2024
c8f194a
fix mypy
charles-cooper Feb 6, 2024
81c246c
fix a stupid bug -- refactor get_expr_info to handle callables
charles-cooper Feb 6, 2024
389d3c0
fix handle_modification for tuples
charles-cooper Feb 6, 2024
dad54f0
fix handle_modification for subscripts
charles-cooper Feb 7, 2024
ee271f1
add test for `uses` hashmap
charles-cooper Feb 7, 2024
ca12961
fix bad modifiability check
charles-cooper Feb 7, 2024
de29d46
fix lint
charles-cooper Feb 7, 2024
fbe19b0
fix another bug
charles-cooper Feb 7, 2024
708867b
add a test for tuples
charles-cooper Feb 7, 2024
8d56d81
simplify module use analysis and fix variable use analysis
charles-cooper Feb 7, 2024
e2e15cd
add some mutability tests
charles-cooper Feb 7, 2024
cbef6bc
add more mutability tests
charles-cooper Feb 7, 2024
8d75e4d
fix lint
charles-cooper Feb 7, 2024
a344739
add a test for empty builtin
charles-cooper Feb 7, 2024
84841e9
test more complex types
charles-cooper Feb 7, 2024
86892cc
refactor variable access analysis
charles-cooper Feb 7, 2024
f510ddd
add some more tests for nested attributes
charles-cooper Feb 7, 2024
6f17271
Merge branch 'master' into feat/singleton_modules
charles-cooper Feb 7, 2024
320c549
fix `uses` analysis for chain of modules
charles-cooper Feb 7, 2024
0288807
remove an xfail
charles-cooper Feb 7, 2024
8fdb0c9
add a docstring
charles-cooper Feb 7, 2024
5b63573
add uses test for nonpayable function which doesn't touch any module …
charles-cooper Feb 7, 2024
5b703e0
fix codegen for imported immutables and add a test
charles-cooper Feb 7, 2024
c47f1d3
add more reads/uses tests
charles-cooper Feb 7, 2024
bdbc48d
fix lark grammar -- add walrus operator
charles-cooper Feb 7, 2024
ca58f43
add codegen test for `uses`
charles-cooper Feb 7, 2024
353699c
test a rename
charles-cooper Feb 7, 2024
d9293e7
add some more tests
charles-cooper Feb 7, 2024
7bde8ec
add another test for uses/initializes codegen
charles-cooper Feb 7, 2024
ca77ccc
fix a comment
charles-cooper Feb 7, 2024
7ca5876
fixup storage layout export and add tests for storage layout
charles-cooper Feb 7, 2024
618e06a
add separate transient storage allocator
charles-cooper Feb 8, 2024
dc8bbbe
add storage layout tests for nested uses/initializes
charles-cooper Feb 8, 2024
ba6fb9a
fix mypy
charles-cooper Feb 8, 2024
b706c85
add tests for init function visibility
charles-cooper Feb 8, 2024
f95f440
fix lint
charles-cooper Feb 8, 2024
ac8d26a
add a couple more deploy visibility tests
charles-cooper Feb 8, 2024
524a7e8
improve a couple error messages
charles-cooper Feb 8, 2024
c33facc
test cannot call @deploy from @external function
charles-cooper Feb 8, 2024
f34923b
add pragma version to all examples
charles-cooper Feb 8, 2024
2dc82a1
fix lint
charles-cooper Feb 8, 2024
4fca078
fix a bug
charles-cooper Feb 8, 2024
0957c9b
Merge branch 'master' into feat/singleton_modules
charles-cooper Feb 8, 2024
82735c4
fix typo -- missing space
charles-cooper Feb 8, 2024
e393bd7
remove dead function
charles-cooper Feb 9, 2024
5b7b3b8
add tests for multiple uses
charles-cooper Feb 9, 2024
bdd3dea
fix: swallowed errors result in bad state
charles-cooper Feb 9, 2024
161d3ac
fix lint
charles-cooper Feb 9, 2024
5c30bf4
fix: interfaces access from .vyi files
charles-cooper Feb 9, 2024
e16ab99
add a test for implements via imported vyi file
charles-cooper Feb 9, 2024
96699f9
fix lint
charles-cooper Feb 9, 2024
f5186b8
fix importing types from nested modules
charles-cooper Feb 9, 2024
87afe01
add missing StringEnum methods
charles-cooper Feb 9, 2024
94d0215
hygiene: replace a usage of StringEnum.value
charles-cooper Feb 10, 2024
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: 1 addition & 1 deletion examples/auctions/blind_auction.vy
charles-cooper marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pendingReturns: HashMap[address, uint256]
# Create a blinded auction with `_biddingTime` seconds bidding time and
# `_revealTime` seconds reveal time on behalf of the beneficiary address
# `_beneficiary`.
@external
@deploy
def __init__(_beneficiary: address, _biddingTime: uint256, _revealTime: uint256):
self.beneficiary = _beneficiary
self.biddingEnd = block.timestamp + _biddingTime
Expand Down
2 changes: 1 addition & 1 deletion examples/auctions/simple_open_auction.vy
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pendingReturns: public(HashMap[address, uint256])
# Create a simple auction with `_auction_start` and
# `_bidding_time` seconds bidding time on behalf of the
# beneficiary address `_beneficiary`.
@external
@deploy
def __init__(_beneficiary: address, _auction_start: uint256, _bidding_time: uint256):
self.beneficiary = _beneficiary
self.auctionStart = _auction_start # auction start time can be in the past, present or future
Expand Down
2 changes: 1 addition & 1 deletion examples/crowdfund.vy
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ goal: public(uint256)
timelimit: public(uint256)

# Setup global variables
@external
@deploy
def __init__(_beneficiary: address, _goal: uint256, _timelimit: uint256):
self.beneficiary = _beneficiary
self.deadline = block.timestamp + _timelimit
Expand Down
2 changes: 1 addition & 1 deletion examples/factory/Exchange.vy
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ token: public(ERC20)
factory: Factory


@external
@deploy
def __init__(_token: ERC20, _factory: Factory):
self.token = _token
self.factory = _factory
Expand Down
2 changes: 1 addition & 1 deletion examples/factory/Factory.vy
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exchange_codehash: public(bytes32)
exchanges: public(HashMap[ERC20, Exchange])


@external
@deploy
def __init__(_exchange_codehash: bytes32):
# Register the exchange code hash during deployment of the factory
self.exchange_codehash = _exchange_codehash
Expand Down
2 changes: 1 addition & 1 deletion examples/safe_remote_purchase/safe_remote_purchase.vy
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ buyer: public(address)
unlocked: public(bool)
ended: public(bool)

@external
@deploy
@payable
def __init__():
assert (msg.value % 2) == 0
Expand Down
2 changes: 1 addition & 1 deletion examples/stock/company.vy
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ price: public(uint256)
holdings: HashMap[address, uint256]

# Set up the company.
@external
@deploy
def __init__(_company: address, _total_shares: uint256, initial_price: uint256):
assert _total_shares > 0
assert initial_price > 0
Expand Down
2 changes: 1 addition & 1 deletion examples/storage/advanced_storage.vy
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ event DataChange:

storedData: public(int128)

@external
@deploy
def __init__(_x: int128):
self.storedData = _x

Expand Down
4 changes: 2 additions & 2 deletions examples/storage/storage.vy
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
storedData: public(int128)

@external
@deploy
def __init__(_x: int128):
self.storedData = _x

@external
def set(_x: int128):
self.storedData = _x
self.storedData = _x
2 changes: 1 addition & 1 deletion examples/tokens/ERC1155ownable.vy
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ interface IERC1155MetadataURI:

############### functions ###############

@external
@deploy
def __init__(name: String[128], symbol: String[16], uri: String[MAX_URI_LENGTH], contractUri: String[MAX_URI_LENGTH]):
"""
@dev contract initialization on deployment
Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/ERC20.vy
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ totalSupply: public(uint256)
minter: address


@external
@deploy
def __init__(_name: String[32], _symbol: String[32], _decimals: uint8, _supply: uint256):
init_supply: uint256 = _supply * 10 ** convert(_decimals, uint256)
self.name = _name
Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/ERC4626.vy
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ event Withdraw:
shares: uint256


@external
@deploy
def __init__(asset: ERC20):
self.asset = asset

Expand Down
2 changes: 1 addition & 1 deletion examples/tokens/ERC721.vy
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ SUPPORTED_INTERFACES: constant(bytes4[2]) = [
0x80ac58cd,
]

@external
@deploy
def __init__():
"""
@dev Contract constructor.
Expand Down
2 changes: 1 addition & 1 deletion examples/voting/ballot.vy
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def directlyVoted(addr: address) -> bool:


# Setup global variables
@external
@deploy
def __init__(_proposalNames: bytes32[2]):
self.chairperson = msg.sender
self.voterCount = 0
Expand Down
2 changes: 1 addition & 1 deletion examples/wallet/wallet.vy
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ threshold: int128
seq: public(int128)


@external
@deploy
def __init__(_owners: address[5], _threshold: int128):
for i: uint256 in range(5):
if _owners[i] != empty(address):
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/builtins/codegen/test_abi.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
"""
x: int128

@external
@deploy
def __init__():
self.x = 1
""",
"""
x: int128

@external
@deploy
def __init__():
pass
""",
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/builtins/codegen/test_abi_decode.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def test_side_effects_evaluation(get_contract):
contract_1 = """
counter: uint256

@external
@deploy
def __init__():
self.counter = 0

Expand Down
2 changes: 1 addition & 1 deletion tests/functional/builtins/codegen/test_abi_encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def test_side_effects_evaluation(get_contract):
contract_1 = """
counter: uint256

@external
@deploy
def __init__():
self.counter = 0

Expand Down
4 changes: 2 additions & 2 deletions tests/functional/builtins/codegen/test_ceil.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def test_ceil(get_contract_with_gas_estimation):
code = """
x: decimal

@external
@deploy
def __init__():
self.x = 504.0000000001

Expand Down Expand Up @@ -53,7 +53,7 @@ def test_ceil_negative(get_contract_with_gas_estimation):
code = """
x: decimal

@external
@deploy
def __init__():
self.x = -504.0000000001

Expand Down
4 changes: 2 additions & 2 deletions tests/functional/builtins/codegen/test_concat.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_concat_buffer2(get_contract):
code = """
i: immutable(int256)

@external
@deploy
def __init__():
i = -1
s: String[2] = concat("a", "b")
Expand All @@ -99,7 +99,7 @@ def test_concat_buffer3(get_contract):
s2: String[33]
s3: String[34]

@external
@deploy
def __init__():
self.s = "a"
self.s2 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" # 33*'a'
Expand Down
10 changes: 5 additions & 5 deletions tests/functional/builtins/codegen/test_create_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def test_create_from_blueprint_bad_code_offset(
deployer_code = """
BLUEPRINT: immutable(address)

@external
@deploy
def __init__(blueprint_address: address):
BLUEPRINT = blueprint_address

Expand Down Expand Up @@ -269,7 +269,7 @@ def test_create_from_blueprint_args(
FOO: immutable(String[128])
BAR: immutable(Bar)

@external
@deploy
def __init__(foo: String[128], bar: Bar):
FOO = foo
BAR = bar
Expand Down Expand Up @@ -450,7 +450,7 @@ def test_create_from_blueprint_complex_value(
code = """
var: uint256

@external
@deploy
@payable
def __init__(x: uint256):
self.var = x
Expand Down Expand Up @@ -507,7 +507,7 @@ def test_create_from_blueprint_complex_salt_raw_args(
code = """
var: uint256

@external
@deploy
@payable
def __init__(x: uint256):
self.var = x
Expand Down Expand Up @@ -565,7 +565,7 @@ def test_create_from_blueprint_complex_salt_no_constructor_args(
code = """
var: uint256

@external
@deploy
@payable
def __init__():
self.var = 12
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/builtins/codegen/test_ecrecover.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_invalid_signature2(get_contract):

owner: immutable(address)

@external
@deploy
def __init__():
owner = 0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf

Expand Down
4 changes: 2 additions & 2 deletions tests/functional/builtins/codegen/test_floor.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def test_floor(get_contract_with_gas_estimation):
code = """
x: decimal

@external
@deploy
def __init__():
self.x = 504.0000000001

Expand Down Expand Up @@ -55,7 +55,7 @@ def test_floor_negative(get_contract_with_gas_estimation):
code = """
x: decimal

@external
@deploy
def __init__():
self.x = -504.0000000001

Expand Down
2 changes: 1 addition & 1 deletion tests/functional/builtins/codegen/test_raw_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def set_owner(i: int128, o: address):
owners: public(address[5])


@external
@deploy
def __init__(_owner_setter: address):
self.owner_setter_contract = _owner_setter

Expand Down
10 changes: 5 additions & 5 deletions tests/functional/builtins/codegen/test_slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_slice_immutable(
IMMUTABLE_BYTES: immutable(Bytes[{length_bound}])
IMMUTABLE_SLICE: immutable(Bytes[{length_bound}])

@external
@deploy
def __init__(inp: Bytes[{length_bound}], start: uint256, length: uint256):
IMMUTABLE_BYTES = inp
IMMUTABLE_SLICE = slice(IMMUTABLE_BYTES, {_start}, {_length})
Expand Down Expand Up @@ -119,7 +119,7 @@ def test_slice_bytes_fuzz(
elif location == "code":
preamble = f"""
IMMUTABLE_BYTES: immutable(Bytes[{length_bound}])
@external
@deploy
def __init__(foo: Bytes[{length_bound}]):
IMMUTABLE_BYTES = foo
"""
Expand Down Expand Up @@ -230,7 +230,7 @@ def test_slice_immutable_length_arg(get_contract_with_gas_estimation):
code = """
LENGTH: immutable(uint256)

@external
@deploy
def __init__():
LENGTH = 5

Expand Down Expand Up @@ -314,7 +314,7 @@ def f() -> bytes32:
"""
foo: bytes32

@external
@deploy
def __init__():
self.foo = 0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f

Expand All @@ -325,7 +325,7 @@ def bar() -> Bytes[{length}]:
"""
foo: bytes32

@external
@deploy
def __init__():
self.foo = 0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ def test_throw_on_sending(w3, tx_failed, get_contract_with_gas_estimation):
code = """
x: public(int128)

@external
@deploy
def __init__():
self.x = 123
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def allowance(_owner: address, _spender: address) -> uint256: nonpayable

token_address: ERC20Contract

@external
@deploy
def __init__(token_addr: address):
self.token_address = ERC20Contract(token_addr)

Expand Down
Loading
Loading