signer/core: EIP-712 encoded data should not reject a Domain without a ChainId (#21306)

* Do not check for a non-nil ChainId

* Add encoding test
This commit is contained in:
Natsu Kagami
2020-08-03 13:30:32 +00:00
committed by GitHub
parent 290d6bd903
commit b2b14e6ce3
2 changed files with 9 additions and 5 deletions

View File

@ -965,11 +965,7 @@ func isPrimitiveTypeValid(primitiveType string) bool {
// validate checks if the given domain is valid, i.e. contains at least
// the minimum viable keys and values
func (domain *TypedDataDomain) validate() error {
if domain.ChainId == nil {
return errors.New("chainId must be specified according to EIP-155")
}
if len(domain.Name) == 0 && len(domain.Version) == 0 && len(domain.VerifyingContract) == 0 && len(domain.Salt) == 0 {
if domain.ChainId == nil && len(domain.Name) == 0 && len(domain.Version) == 0 && len(domain.VerifyingContract) == 0 && len(domain.Salt) == 0 {
return errors.New("domain is undefined")
}