mirror of
https://github.com/filecoin-project/lotus.git
synced 2025-08-06 16:41:19 +08:00
Merge pull request #10224 from filecoin-project/feat/ethcli-strip-spaces
feat: eth cli: Strip out empty spaces around contract bytes
This commit is contained in:
10
cli/evm.go
10
cli/evm.go
@ -107,7 +107,7 @@ var EvmCallSimulateCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
params, err := ethtypes.DecodeHexString(cctx.Args().Get(2))
|
||||
params, err := ethtypes.DecodeHexStringTrimSpace(cctx.Args().Get(2))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -151,7 +151,7 @@ var EvmGetContractAddress = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
salt, err := ethtypes.DecodeHexString(cctx.Args().Get(1))
|
||||
salt, err := ethtypes.DecodeHexStringTrimSpace(cctx.Args().Get(1))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("Could not decode salt: %w", err)
|
||||
}
|
||||
@ -170,7 +170,7 @@ var EvmGetContractAddress = &cli.Command{
|
||||
|
||||
return err
|
||||
}
|
||||
contract, err := ethtypes.DecodeHexString(string(contractHex))
|
||||
contract, err := ethtypes.DecodeHexStringTrimSpace(string(contractHex))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("Could not decode contract file: %w", err)
|
||||
}
|
||||
@ -219,7 +219,7 @@ var EvmDeployCmd = &cli.Command{
|
||||
return xerrors.Errorf("failed to read contract: %w", err)
|
||||
}
|
||||
if cctx.Bool("hex") {
|
||||
contract, err = ethtypes.DecodeHexString(string(contract))
|
||||
contract, err = ethtypes.DecodeHexStringTrimSpace(string(contract))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to decode contract: %w", err)
|
||||
}
|
||||
@ -341,7 +341,7 @@ var EvmInvokeCmd = &cli.Command{
|
||||
}
|
||||
|
||||
var calldata []byte
|
||||
calldata, err = ethtypes.DecodeHexString(cctx.Args().Get(1))
|
||||
calldata, err = ethtypes.DecodeHexStringTrimSpace(cctx.Args().Get(1))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("decoding hex input data: %w", err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user