ethermint
ethermint copied to clipboard
EIP712 doesn't support optional parameters
System info: Ethermint v0.16.1
Steps to reproduce:
- 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)
}
- 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
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.
Duplicated https://github.com/evmos/ethermint/issues/1247