From 1d40bb4940c92a369105e98b3bfe536e024e8682 Mon Sep 17 00:00:00 2001 From: Anton Bukov Date: Tue, 9 May 2023 12:38:12 +0200 Subject: [PATCH] Disallow to use typehash() for structs with nested mappings --- libsolidity/ast/AST.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index d24184af8..25d1c1eeb 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -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 subtypes; insertEip712EncodedSubtypes(subtypes);