diff --git a/libsolidity/ast/AST.cpp b/libsolidity/ast/AST.cpp index f6b82f00c..d24184af8 100644 --- a/libsolidity/ast/AST.cpp +++ b/libsolidity/ast/AST.cpp @@ -391,7 +391,7 @@ std::vector, std::optional>> UsingFo return ranges::zip_view(m_functionsOrLibrary, m_operators) | ranges::to; } -void StructDefinition::insertEncodedSubtypes(std::set& subtypes) const +void StructDefinition::insertEip712EncodedSubtypes(std::set& subtypes) const { for (size_t i = 0; i < m_members.size(); i++) { @@ -401,13 +401,13 @@ void StructDefinition::insertEncodedSubtypes(std::set& subtypes) co StructDefinition const* structDef = dynamic_cast(declaration); solAssert(structDef != nullptr); - subtypes.insert(structDef->encodeTypeWithoutSubtypes()); - structDef->insertEncodedSubtypes(subtypes); + subtypes.insert(structDef->eip712EncodeTypeWithoutSubtypes()); + structDef->insertEip712EncodedSubtypes(subtypes); } } } -std::string StructDefinition::encodeTypeWithoutSubtypes() const +std::string StructDefinition::eip712EncodeTypeWithoutSubtypes() const { std::string str = name() + "("; for (size_t i = 0; i < m_members.size(); i++) @@ -418,17 +418,17 @@ std::string StructDefinition::encodeTypeWithoutSubtypes() const return str + ")"; } -std::string StructDefinition::encodeType() const +std::string StructDefinition::eip712EncodeType() const { // std::set enables duplicates elimination and ordered enumeration std::set subtypes; - insertEncodedSubtypes(subtypes); - return std::accumulate(subtypes.begin(), subtypes.end(), encodeTypeWithoutSubtypes()); + insertEip712EncodedSubtypes(subtypes); + return std::accumulate(subtypes.begin(), subtypes.end(), eip712EncodeTypeWithoutSubtypes()); } util::h256 StructDefinition::typehash() const { - return util::keccak256(encodeType()); + return util::keccak256(eip712EncodeType()); } Type const* StructDefinition::type() const diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index e11cda10e..eb39c7b35 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -742,13 +742,13 @@ public: std::vector> const& members() const { return m_members; } /// Fills set with the EIP-712 compatible struct encodings without subtypes concatenated. - void insertEncodedSubtypes(std::set& subtypes) const; + void insertEip712EncodedSubtypes(std::set& subtypes) const; /// @returns the EIP-712 compatible struct encoding but without subtypes concatenated. - std::string encodeTypeWithoutSubtypes() const; + std::string eip712EncodeTypeWithoutSubtypes() const; /// @returns the EIP-712 compatible struct encoding with subtypes sorted and concatenated. - std::string encodeType() const; + std::string eip712EncodeType() const; /// @returns the EIP-712 compatible typehash of this struct. util::h256 typehash() const;