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

Empty contract should probably throw exceptions on calls #2803

Closed
hedgar2017 opened this issue Apr 16, 2022 · 3 comments
Closed

Empty contract should probably throw exceptions on calls #2803

hedgar2017 opened this issue Apr 16, 2022 · 3 comments

Comments

@hedgar2017
Copy link

Version Information

  • vyper Version (output of vyper --version): 0.3.2

What's your issue about?

The empty contract has the following IR:

[seq, [deploy, 0, seq, 0]]

In Solidity it does, but any behavior is accepted here.
Such contracts may be treated as just one single fallback.
Please close the issue if so.

@hedgar2017
Copy link
Author

That's right. In Yul an empty contract is just a revert:

object "test_1_deployed" {
        code {
            {
                /// @src 0:0:17  "contract test {..."
                revert(0, 0)
            }
        }
        data ".metadata" hex"a2646970667358221220c0ee3938739ac06f7623a04d58687a1d98be4d62f4fec897d0b8189d4d2b9a7564736f6c634300080d0033"
    }

@charles-cooper
Copy link
Member

I'm not convinced this is a bug. immutables provide a way to create "data-only" contracts. for instance,

FOO: immutable(uint256)
@external
def __init__():
    FOO = 1

will deploy a contract with just the bytecode 0x0000000000000000000000000000000000000000000000000000000000000001. (Whereas if we inserted a fallback, it would have bunch of code in it besides the immutables). I'm not sure, but I feel like this may be useful in the future.

@charles-cooper charles-cooper mentioned this issue May 6, 2022
5 tasks
@charles-cooper
Copy link
Member

this is completed (i believe as of #3496)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants