-
Notifications
You must be signed in to change notification settings - Fork 179
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
[Flow EVM] Improving evm integration tests #5431
[Flow EVM] Improving evm integration tests #5431
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5431 +/- ##
==========================================
+ Coverage 55.30% 55.85% +0.55%
==========================================
Files 946 1029 +83
Lines 96206 100783 +4577
==========================================
+ Hits 53204 56292 +3088
- Misses 38877 40159 +1282
- Partials 4125 4332 +207
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
…m:onflow/flow-go into ramtin/5228-improve-evm-integration-tests
code: [], | ||
gasLimit: 53000, | ||
value: EVM.Balance(attoflow: 1230000000000000000) | ||
let bal = EVM.Balance(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let bal = EVM.Balance(0) | |
let bal = EVM.Balance(attoflow: 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change in Cadence 1.0. The named attribute is always required.
let cadenceOwnedAccount <- EVM.createCadenceOwnedAccount() | ||
cadenceOwnedAccount.deposit(from: <-vault) | ||
|
||
let bal = EVM.Balance(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let bal = EVM.Balance(0) | |
let bal = EVM.Balance(attoflow: 0) |
) uint64 { | ||
code := []byte(fmt.Sprintf( | ||
` | ||
pub fun main(): UFix64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub fun main(): UFix64 { | |
access(all) fun main(): UFix64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice 👏
Left only a few comments, to make the Cadence changes compatible with C1.0.
|
||
assert(res.status == EVM.Status.failed, message: "unexpected status") | ||
// ExecutionErrCodeExecutionReverted | ||
assert(res.errorCode == 306, message: "unexpected error code") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe:
assert(res.errorCode == 306, message: "unexpected error code") | |
assert(res.errorCode == %d, message: "unexpected error code") | |
// ... | |
types.ExecutionErrCodeExecutionReverted |
|
||
let bal = EVM.Balance(0) | ||
bal.setFLOW(flow: 1.23) | ||
let vault2 <- cadenceOwnedAccount.withdraw(balance: bal) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe you can add a line in Cadence that asserts the coa balance is 2.34-1.23
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice tests
I'll apply suggested these in my other PR #5443 |
applied fixes to 7ae2c70 |
closes: #5228
It also adds some utility methods for integration testing that can be used later to expand the integration tests.