From 113d5d63f87b767bf5b8a4ffbe7153ab4dec46e3 Mon Sep 17 00:00:00 2001 From: Randy Date: Mon, 9 Sep 2024 16:52:15 +0800 Subject: [PATCH] fix verifyingContract to be a valid evm hex address (using `cosmos` as hex address) --- ethereum/eip712/domain.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ethereum/eip712/domain.go b/ethereum/eip712/domain.go index 7e2c1c2000..d768a17ab8 100644 --- a/ethereum/eip712/domain.go +++ b/ethereum/eip712/domain.go @@ -16,19 +16,22 @@ package eip712 import ( + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/math" "github.com/ethereum/go-ethereum/signer/core/apitypes" ) // createEIP712Domain creates the typed data domain for the given chainID. func createEIP712Domain(chainID uint64) apitypes.TypedDataDomain { + contractStr := "cosmos" + contractAddr := common.BytesToAddress([]byte(contractStr)) domain := apitypes.TypedDataDomain{ Name: "Carbon", Version: "1.0.0", ChainId: math.NewHexOrDecimal256(int64(chainID)), - VerifyingContract: "cosmos", + VerifyingContract: contractAddr.Hex(), Salt: "1", } - + return domain }