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

Add support for resource-kinded fields in transaction roles #2262

Conversation

turbolent
Copy link
Member

@turbolent turbolent commented Jan 19, 2023

Work towards #2177

Description

Transaction roles may have resource-kinded fields.

Add dedicated support for allowing resource-kinded fields to get invalidated in a transaction's execute block, even though such invalidations are nested, which are not allowed in other contexts (composite destructors).


  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@@ -1366,32 +1366,13 @@ func (checker *Checker) recordResourceInvalidation(
)
}

Copy link
Member Author

Choose a reason for hiding this comment

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

The refactor of this function is probably best viewed in split-mode. Also, I first refactored the function a bit to simplify it in 7abf054 and to allow customization of the check what is allowed to a function in 48247ab.

return memberInfo.Member
}

return checker.accessedSelfMember(expression)
Copy link
Member Author

@turbolent turbolent Jan 20, 2023

Choose a reason for hiding this comment

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

runtime/tests/checker/transactions_test.go Outdated Show resolved Hide resolved
@turbolent turbolent requested a review from SupunS January 27, 2023 20:23
@turbolent
Copy link
Member Author

@SupunS pushed some more tests and improvements, could you please have a final look? Thank you!

Base automatically changed from bastian/extended-transaction-format-3 to feature/extended-transaction-format January 30, 2023 22:37
@codecov
Copy link

codecov bot commented Jan 30, 2023

Codecov Report

Merging #2262 (7d32929) into feature/extended-transaction-format (dc837ee) will increase coverage by 0.00%.
The diff coverage is 97.22%.

@@                         Coverage Diff                          @@
##           feature/extended-transaction-format    #2262   +/-   ##
====================================================================
  Coverage                                77.79%   77.80%           
====================================================================
  Files                                      309      309           
  Lines                                    66164    66189   +25     
====================================================================
+ Hits                                     51474    51499   +25     
  Misses                                   12906    12906           
  Partials                                  1784     1784           
Flag Coverage Δ
unittests 77.80% <97.22%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
runtime/ast/transaction_declaration.go 78.94% <ø> (ø)
runtime/interpreter/errors.go 59.92% <ø> (ø)
runtime/sema/resources.go 88.44% <ø> (ø)
types.go 92.84% <ø> (ø)
runtime/sema/checker.go 92.11% <93.75%> (-0.03%) ⬇️
runtime/sema/check_composite_declaration.go 95.61% <100.00%> (+0.01%) ⬆️
runtime/sema/check_member_expression.go 97.81% <100.00%> (+0.03%) ⬆️
runtime/sema/check_transaction_declaration.go 96.02% <100.00%> (+0.22%) ⬆️
runtime/sema/errors.go 94.94% <100.00%> (+0.01%) ⬆️
... and 2 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@github-actions
Copy link

Cadence Benchstat comparison

This branch with compared with the base branch onflow:feature/extended-transaction-format commit dc837ee
The command for i in {1..N}; do go test ./... -run=XXX -bench=. -benchmem -shuffle=on; done was used.
Bench tests were run a total of 7 times on each branch.

Collapsed results for better readability

@turbolent turbolent merged commit fa4cf3d into feature/extended-transaction-format Jan 31, 2023
@turbolent turbolent deleted the bastian/extended-transaction-format-4 branch January 31, 2023 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants