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

Problem: tx evm raw doesn't work under offline #524

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (block-stm) [#510](https://github.com/crypto-org-chain/ethermint/pull/510) Include a fix to avoid nondeterministic account set when stm workers execute in parallel.
* (rpc) [#521](https://github.com/crypto-org-chain/ethermint/pull/521) Align hash and miner in subscribe newHeads with eth_getBlockByNumber.
* (rpc) [#516](https://github.com/crypto-org-chain/ethermint/pull/516) Avoid method eth_chainId crashed due to nil pointer on IsEIP155 check.
* (cli) [#524](https://github.com/crypto-org-chain/ethermint/pull/524) Allow tx evm raw run for generate only when offline with evm-denom flag.

### Improvements

Expand Down
15 changes: 13 additions & 2 deletions x/evm/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"github.com/evmos/ethermint/x/evm/types"
)

const FlagEvmDenom = "evm-denom"

// GetTxCmd returns the transaction commands for this module
func GetTxCmd() *cobra.Command {
cmd := &cobra.Command{
Expand Down Expand Up @@ -77,12 +79,20 @@
return err
}

rsp, err := rpctypes.NewQueryClient(clientCtx).Params(cmd.Context(), &types.QueryParamsRequest{})
evmDenom, err := cmd.Flags().GetString(FlagEvmDenom)

Check warning on line 82 in x/evm/client/cli/tx.go

View check run for this annotation

Codecov / codecov/patch

x/evm/client/cli/tx.go#L82

Added line #L82 was not covered by tests
if err != nil {
return err
}

tx, err := msg.BuildTx(clientCtx.TxConfig.NewTxBuilder(), rsp.Params.EvmDenom)
if evmDenom == "" {
rsp, err := rpctypes.NewQueryClient(clientCtx).Params(cmd.Context(), &types.QueryParamsRequest{})
if err != nil {
return err

Check warning on line 90 in x/evm/client/cli/tx.go

View check run for this annotation

Codecov / codecov/patch

x/evm/client/cli/tx.go#L87-L90

Added lines #L87 - L90 were not covered by tests
}
evmDenom = rsp.Params.EvmDenom

Check warning on line 92 in x/evm/client/cli/tx.go

View check run for this annotation

Codecov / codecov/patch

x/evm/client/cli/tx.go#L92

Added line #L92 was not covered by tests
}

tx, err := msg.BuildTx(clientCtx.TxConfig.NewTxBuilder(), evmDenom)

Check warning on line 95 in x/evm/client/cli/tx.go

View check run for this annotation

Codecov / codecov/patch

x/evm/client/cli/tx.go#L95

Added line #L95 was not covered by tests
if err != nil {
return err
}
Expand Down Expand Up @@ -129,5 +139,6 @@
}

flags.AddTxFlagsToCmd(cmd)
cmd.Flags().String(FlagEvmDenom, "", "defines the EVM denomination which could be used for generate only when offline")

Check warning on line 142 in x/evm/client/cli/tx.go

View check run for this annotation

Codecov / codecov/patch

x/evm/client/cli/tx.go#L142

Added line #L142 was not covered by tests
return cmd
}
Loading