Disallow to use typehash() for structs with nested mappings

This commit is contained in:
Anton Bukov 2023-05-09 12:38:12 +02:00
parent c4e8d3754d
commit 1d40bb4940

View File

@ -420,6 +420,9 @@ std::string StructDefinition::eip712EncodeTypeWithoutSubtypes() const
std::string StructDefinition::eip712EncodeType() const
{
// EIP-712 supports recurvie structs, but not containing nested mappings
solAssert(!annotation().containsNestedMapping.has_value() || !annotation().containsNestedMapping.value(), "Struct containing mapping cannot be used in EIP-712.");
// std::set enables duplicates elimination and ordered enumeration
std::set<std::string> subtypes;
insertEip712EncodedSubtypes(subtypes);