Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions rust/tw_evm/src/message/eip712/eip712_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ mod encode_custom_type {
&field.property_type
};
// Seen this type before? or not a custom type - skip
if !deps.contains(field_type) || custom_types.contains_key(field_type) {
if !deps.contains(field_type) && custom_types.contains_key(field_type) {
types_stack.push(field_type);
}
}
Expand All @@ -340,6 +340,8 @@ mod tests {

#[test]
fn test_build_dependencies() {
// This custom types definition has an intentional cycle dependency between `Person` and `Mail`
// to test if the `build_dependencies` function can handle it without getting into an infinite loop.
let custom_types = r#"{
"EIP712Domain": [
{ "name": "name", "type": "string" },
Expand All @@ -349,7 +351,8 @@ mod tests {
],
"Person": [
{ "name": "name", "type": "string" },
{ "name": "wallet", "type": "address" }
{ "name": "wallet", "type": "address" },
{ "name": "mail", "type": "Mail" }
],
"Mail": [
{ "name": "from", "type": "Person" },
Expand Down
Loading