forked from evmos/ethermint
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix!: Remove unused fields verifyingContract & salt from EIP712 domai…
…n separator (#75) verifyingContract field is validated by MetaMask to be an address, but was expected to be a string. This field is unused so it is removed.
- Loading branch information
Showing
4 changed files
with
51 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package eip712 | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestTypedDataDomain(t *testing.T) { | ||
domain := getTypedDataDomain(1234) | ||
|
||
domainMap := domain.Map() | ||
|
||
// Verify both len and expected contents in order to assert that no other | ||
// fields are present | ||
require.Len(t, domainMap, 3) | ||
require.Contains(t, domainMap, "chainId") | ||
require.Contains(t, domainMap, "name") | ||
require.Contains(t, domainMap, "version") | ||
|
||
// Extra check to ensure that the fields that are not used for signature | ||
// verification are not present in the map. Should be in conjunction with | ||
// the checks above to ensure there isn't a different variant of these | ||
// fields present, e.g. different casing. | ||
require.NotContains(t, domainMap, "verifyingContract") | ||
require.NotContains(t, domainMap, "salt") | ||
} |