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: use creation init on self destruct #1954

Merged
merged 3 commits into from
May 21, 2019

Conversation

zachdaniel
Copy link
Contributor

@zachdaniel zachdaniel commented May 14, 2019

Resolves #1949 and #1950

Changelog

Enhancements

  • Use the init of the creating internal transaction in the case that data is <<>> due to a self destruct. Display it on the code page, and disable contract verification for those contracts.

Bug Fixes

  • Use Data.to_string/1 when rendering a raw trace of a create transaction.

    • I added an entry to CHANGELOG.md with this PR
    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
    • I checked whether I should update the docs and did so if necessary

@ghost ghost assigned zachdaniel May 14, 2019
@ghost ghost added the in progress label May 14, 2019
@coveralls
Copy link

coveralls commented May 14, 2019

Pull Request Test Coverage Report for Build 1449cb44-eff0-4edb-806f-5419b32bed8d

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.04%) to 81.102%

Files with Coverage Reduction New Missed Lines %
apps/explorer/lib/explorer/chain/transaction_count_cache.ex 2 84.21%
Totals Coverage Status
Change from base Build 0b01fb7e-c0dc-4c70-ad07-e5014c0c8ca2: -0.04%
Covered Lines: 4708
Relevant Lines: 5805

💛 - Coveralls

@zachdaniel zachdaniel force-pushed the use-internal-transaction-init-for-contract-code branch 6 times, most recently from b1ac255 to 83a920d Compare May 15, 2019 18:56
@zachdaniel zachdaniel force-pushed the use-internal-transaction-init-for-contract-code branch from 83a920d to 908c8f5 Compare May 15, 2019 19:33
@ghost ghost added the in progress label May 15, 2019

def contract_creation_code(%Address{
contract_code: %Data{bytes: <<>>},
contracts_creation_internal_transaction: %InternalTransaction{init: init}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're only checking contracts_creation_internal_transaction. should we also check contracts_creation_transaction if an address is created in the main transaction?

Copy link
Contributor Author

@zachdaniel zachdaniel May 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This case is only possible if the contract was self destructed in the transaction that created it (self destructs in its constructor), so the main transaction in this case will always be the constructing transaction, and the create will always be an internal transaction. I'm pretty sure this is the case.

@zachdaniel zachdaniel force-pushed the use-internal-transaction-init-for-contract-code branch from 908c8f5 to 0fe0fe7 Compare May 16, 2019 13:53
@zachdaniel zachdaniel force-pushed the use-internal-transaction-init-for-contract-code branch from 0fe0fe7 to 6c85f8b Compare May 16, 2019 13:55
@vbaranov vbaranov merged commit 96d38b7 into master May 21, 2019
@vbaranov vbaranov deleted the use-internal-transaction-init-for-contract-code branch May 27, 2019 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Contract creation code vs contract runtime code
5 participants