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

ctx tweak #703

Merged
merged 1 commit into from
Jun 1, 2022
Merged

ctx tweak #703

merged 1 commit into from
Jun 1, 2022

Conversation

sbillig
Copy link
Collaborator

@sbillig sbillig commented May 7, 2022

This makes minor changes to the rules of the context object.

  • ctx is not required when casting an address to a contract type. Eg let foo: Foo = Foo(address(0))
  • ctx is required when calling an external contract function that requires ctx

Example:

contract Foo {
  pub fn emit_stuff(ctx: Context) {
    emit Stuff(ctx) // will be changed to ctx.emit(Stuff{}) someday
  }
}
contract Bar {
  pub fn call_foo_emit_stuff(ctx: Context) {
    Foo(address(0)).emit_stuff(ctx)
  }
}
event Stuff {}

To-Do

  • OPTIONAL: Update Spec if applicable
  • Add entry to the release notes (may forgo for trivial changes)
  • Clean up commit history

@codecov-commenter
Copy link

codecov-commenter commented May 30, 2022

Codecov Report

Merging #703 (f16d927) into master (43b58a8) will increase coverage by 0.02%.
The diff coverage is 100.00%.

❗ Current head f16d927 differs from pull request most recent head f33f0f0. Consider uploading reports for the commit f33f0f0 to get more accurate results

@@            Coverage Diff             @@
##           master     #703      +/-   ##
==========================================
+ Coverage   81.92%   81.95%   +0.02%     
==========================================
  Files         105      105              
  Lines       11822    11790      -32     
==========================================
- Hits         9685     9662      -23     
+ Misses       2137     2128       -9     
Impacted Files Coverage Δ
crates/analyzer/src/namespace/types.rs 59.17% <ø> (+0.66%) ⬆️
crates/analyzer/src/traversal/call_args.rs 95.65% <ø> (ø)
crates/analyzer/src/traversal/expressions.rs 80.42% <100.00%> (-0.10%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 43b58a8...f33f0f0. Read the comment docs.

Copy link
Member

@g-r-a-n-t g-r-a-n-t left a comment

Choose a reason for hiding this comment

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

looks good 👍

- not required for contract type cast, eg `Foo(address(0))`
- is required when calling external contract fn that takes ctx
@sbillig sbillig merged commit cacaefd into ethereum:master Jun 1, 2022
@sbillig sbillig mentioned this pull request Jun 2, 2022
Closed
3 tasks
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.

3 participants