ethereum / ethereum/py_ecc

Test and bugfix equality testing with different degree polynomials.

Open
#45 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
231
Forks
88
PR merge metrics
No merged PRs in 30d

Description

### What is wrong?

If I read the current implementation of `FQP.__eq__` correctly, it returns `True` for this test:

```py
FQP([1, 2, 3], ...) == FQP([1, 2], ...)
```
which seems wrong.

In the current implementation, `zip` terminates on the shorter list, and there's no explicit length/degree check.

### How can it be fixed

Add tests for related scenarios, and make sure implementation is correct.

Also, because of the type checking involved, make sure that the equality test is commutative when the class is different, like:
```py
fq2_a = FQP([2, 3], (1, 0))
fq2_b = FQ2([2, 3], (1, 0))

assert fq2_a == fq2_b
assert fq2_b == fq2_a

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.