-
Notifications
You must be signed in to change notification settings - Fork 180
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] use transfer from/to a fixed native token bridge address for deposit/withdraw calls #5469
[Flow EVM] use transfer from/to a fixed native token bridge address for deposit/withdraw calls #5469
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5469 +/- ##
==========================================
- Coverage 55.85% 55.83% -0.02%
==========================================
Files 1030 1030
Lines 100807 100803 -4
==========================================
- Hits 56304 56283 -21
- Misses 40171 40186 +15
- Partials 4332 4334 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Looks nice 👌
if !proc.state.Exist(addr) { | ||
proc.state.CreateAccount(addr) | ||
// create bridge account if not exist | ||
if !proc.state.Exist(bridge) { |
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.
just wondering why we don't create these "special" accounts as part of evm setup?
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.
hmm, we could, I was more leaning towards lazy creation, but we can revisit this in a future PR for all of the special accounts.
msg := call.Message() | ||
proc.evm.TxContext.Origin = msg.From | ||
// withdraw the amount and move it to the bridge account | ||
res, err := proc.run(msg, txHash, 0, types.DirectCallTxType) |
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.
nice
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
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.
LGTM, except the comment from @m-Peter https://github.com/onflow/flow-go/pull/5469/files#r1508162324
This PR
But why?
This is the first PR towards [Flow EVM] make deposit available for any EVM address #5468, using simple transfer makes it possible to deposit to any address (even smart contracts).
Not using a fixed pre-allocated address, means all the tools should be updated to expect a COA account balance changes after bridging and some legacy tools might not know how to deal with these anomalies, using a fixed address, manage the anomaly to a single EOA (bridge account).
This would allow later expansion of COA smart contracts to introduce TokenDeposit events like other smart contract wallets.