onflow / flow-cli

The Flow CLI is a command-line interface that provides useful utilities for building Flow applications
https://onflow.org
Apache License 2.0
206 stars 66 forks source link

Fix EVM gateway unsupported network #1621

Closed jribbink closed 4 months ago

jribbink commented 4 months ago

Closes #1620

Description

There were two checks for networks, this removes the problematic one (was comparing flow-emulator to emulator so always failing)


For contributor use:

austinkline commented 4 months ago

Bit confused, in my reported issue it seemed like the given parameter wasn't being honored. Is something else going on that skipping validation will fix? If I also try to specify evm-network-id emulator is not a valid input

jribbink commented 4 months ago

Bit confused, in my reported issue it seemed like the given parameter wasn't being honored. Is something else going on that skipping validation will fix? If I also try to specify evm-network-id emulator is not a valid input

The issue is that cfg.FlowNetworkID is a flow.ChainID (from flow-go) where chains are formatted like: flow-testnet, flow-mainnet, etc. However, in that check, these are being compared against strings without the prefix, e.g. emulator & previewnet.

The reason it is removed altogether instead of being changed is because this check is redundant and already handled here:

https://github.com/onflow/flow-cli/blob/959f64bf57978c1affae47eed85b2cecd3717c38/internal/evm/gateway.go#L112-L119

Sorry, should have made this more clear in PR description.

austinkline commented 4 months ago

Bit confused, in my reported issue it seemed like the given parameter wasn't being honored. Is something else going on that skipping validation will fix? If I also try to specify evm-network-id emulator is not a valid input

The issue is that cfg.FlowNetworkID is a flow.ChainID (from flow-go) where chains are formatted like: flow-testnet, flow-mainnet, etc. However, in that check, these are being compared against strings without the prefix, e.g. emulator & previewnet.

The reason it is removed altogether instead of being changed is because this check is redundant and already handled here:

https://github.com/onflow/flow-cli/blob/959f64bf57978c1affae47eed85b2cecd3717c38/internal/evm/gateway.go#L112-L119

Sorry, should have made this more clear in PR description.

Thanks for the explanation 🙏

codecov-commenter commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 42.69%. Comparing base (9b1830d) to head (fabb637).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## feature/stable-cadence #1621 +/- ## ======================================================= Coverage 42.69% 42.69% ======================================================= Files 60 60 Lines 4195 4195 ======================================================= Hits 1791 1791 Misses 2169 2169 Partials 235 235 ``` | [Flag](https://app.codecov.io/gh/onflow/flow-cli/pull/1621/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=onflow) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/onflow/flow-cli/pull/1621/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=onflow) | `42.69% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=onflow#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.