Skip to content

refactor[test]: remove selfdestruct from example contracts#4537

Merged
charles-cooper merged 12 commits intovyperlang:masterfrom
cyberthirst:fix/example-contract-warnings
Apr 27, 2025
Merged

refactor[test]: remove selfdestruct from example contracts#4537
charles-cooper merged 12 commits intovyperlang:masterfrom
cyberthirst:fix/example-contract-warnings

Conversation

@cyberthirst
Copy link
Copy Markdown
Collaborator

@cyberthirst cyberthirst commented Mar 25, 2025

What I did

  • removed references to selfdestruct and replaced them with a lock + send

How to verify it

  • existing example tests still pass
  • added new selfdestruct tests to compensate for their removal from the examples

Commit message

this commit removes references to `selfdestruct()` in the example
contracts and replaces them with a lock + `send()` pattern

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@cyberthirst
Copy link
Copy Markdown
Collaborator Author

looking at our safe_remote_purchase is it that once the buyer buys, then he can just block owner's funds forever?

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.44%. Comparing base (d5677b1) to head (28b51c4).
⚠️ Report is 87 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4537      +/-   ##
==========================================
- Coverage   92.55%   92.44%   -0.11%     
==========================================
  Files         123      127       +4     
  Lines       17506    18308     +802     
  Branches     2962     3174     +212     
==========================================
+ Hits        16202    16925     +723     
- Misses        898      946      +48     
- Partials      406      437      +31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cyberthirst cyberthirst changed the title remove selfdestruct from example contracts feat[test]: remove selfdestruct from example contracts Mar 25, 2025
@cyberthirst cyberthirst changed the title feat[test]: remove selfdestruct from example contracts refactor[test]: remove selfdestruct from example contracts Mar 25, 2025
a0 = env.accounts[0]
val = 10
env.set_balance(env.deployer, val)
c = get_contract(contract, a0, value=val)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we add a check_warnings here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

sorry, catch_warnings -- and check the warning!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

addressed in: e002bc6

@cyberthirst
Copy link
Copy Markdown
Collaborator Author

as per suggestion from @charles-cooper we'll emphasize that builtins should be stateless and I'll remove the state reset added in 3f5eaa5

instead we'll remove warning limit here #4542 and will enforce statelessness in the future

Copy link
Copy Markdown
Member

@charles-cooper charles-cooper left a comment

Choose a reason for hiding this comment

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

could add another assert to each test, otherwise lgtm

cyberthirst and others added 2 commits April 26, 2025 09:49
Co-authored-by: Charles Cooper <[email protected]>
Co-authored-by: Charles Cooper <[email protected]>
@charles-cooper charles-cooper merged commit 5fe3d2e into vyperlang:master Apr 27, 2025
162 checks passed
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.

2 participants