ethermint icon indicating copy to clipboard operation
ethermint copied to clipboard

EIP712 doesn't support optional parameters

Open hanchon opened this issue 2 years ago • 1 comments

System info: Ethermint v0.16.1

Steps to reproduce:

  1. To replicate a simple test can be created on app/ante/utils_tests.go
func (suite *AnteTestSuite) CreateTestEIP712MsgEditValidator(from sdk.AccAddress, priv cryptotypes.PrivKey, chainId string, gas uint64, gasAmount sdk.Coins) client.TxBuilder {
	valAddr := sdk.ValAddress(from.Bytes())
	msgEdit := types3.NewMsgEditValidator(
		valAddr,
		types3.NewDescription("moniker", "identity", "website", "security_contract", "details"),
		nil,
		nil,
	)
	return suite.CreateTestEIP712CosmosTxBuilder(from, priv, chainId, gas, gasAmount, msgEdit)
}
  1. And call the function in app/ante/ante_test.go inside the TestAnteHandler function
		{
			"success- DeliverTx EIP712 edit validator",
			func() sdk.Tx {
				from := acc.GetAddress()
				coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20))
				amount := sdk.NewCoins(coinAmount)
				gas := uint64(200000)
				txBuilder := suite.CreateTestEIP712MsgEditValidator(from, privKey, "ethermint_9000-1", gas, amount)
				return txBuilder.GetTx()
			}, false, false, true,
		},

Expected behavior: Test should pass

Actual behavior: Errors with: failed to pack and hash typedData primary type: provided data '<nil>' doesn't match type 'string'. Because it's expecting a string and the interpreter is getting a '<nil>' value.

Additional info: The current implementation doesn't support optionals so sending nil is invalid. The message is working fine if the optional values are set to valid strings

hanchon avatar Jun 13 '22 08:06 hanchon

This issue is stale because it has been open 45 days with no activity. Remove Status: Stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jul 29 '22 02:07 github-actions[bot]

Duplicated https://github.com/evmos/ethermint/issues/1247

facs95 avatar Aug 19 '22 13:08 facs95