ConsenSysMesh / ConsenSysMesh/py-eip712-structs

.to_message() fails on Arrays

Open
#16 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
35
Forks
28
PR merge metrics
No merged PRs in 30d

Description

Test code:

```python
import os
from eip712_structs import Bytes, Array, EIP712Struct, make_domain

class TestStruct(EIP712Struct):
byte_array = Array(Bytes(32), 4)

byte_array = [os.urandom(32) for _ in range(4)]

domain = make_domain(name='hello')
s = TestStruct(byte_array=byte_array)
print(s.to_message(domain))
```

This code will raise:

```
Traceback (most recent call last):
File "test.py", line 11, in
print(s.to_message(domain))
File "site-packages/eip712_structs/struct.py", line 165, in to_message
structs = {domain, self}
File "site-packages/eip712_structs/struct.py", line 315, in __hash__
value_hashes = [hash(k) ^ hash(v) for k, v in self.values.items()]
File "site-packages/eip712_structs/struct.py", line 315, in
value_hashes = [hash(k) ^ hash(v) for k, v in self.values.items()]
TypeError: unhashable type: 'list'
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.