Add mypy#116
Conversation
|
I also suggest changing the |
af7daed to
3ac325d
Compare
| inputs: Sequence[int], | ||
| is_persistent: bool, | ||
| ) -> Array10: | ||
| assert tag.write_only_persistent() |
There was a problem hiding this comment.
There's no write_only_persistent, do we want to keep state_write_only_persistent?
There was a problem hiding this comment.
No, I think we forgot to remove this in previous PR.
| rlc_le_bytes = self.rlc_to_le_bytes(rlc) | ||
| return self.bytes_to_int(rlc_le_bytes[:n_bytes]), self.is_zero(self.sum(rlc_le_bytes[n_bytes:])) | ||
|
|
||
| def rlc_to_int_exact(self, rlc: RLC, n_bytes: int) -> int: |
There was a problem hiding this comment.
Should the output of rlc_to_int_exact FQ?
a1a6b38 to
b49aa1c
Compare
b49aa1c to
46b2459
Compare
8e123a4 to
1ff5aa7
Compare
|
This task is blocked. We are constantly juggling 3 types:
Usually, a cell in a table would be of different types. For example, a value of TxTable could be gasPrice, which is stored in RLC. A value could also be This makes our txTable lookup outputs Union[RLC, FQ], and we later need to eliminate the type to 1 possibility, which is not Python really good at. We keep RLC because usually, we want RLC.le_bytes for computation. But the RLC.value is what is acutally stored. |
|
close in favor of @han0110's new approach. PR would be submitted soon after recent spec PRs are merged. |
This sounds like a case where duck typing is needed, and for the typing we should use something like an Interface. I've taken a look at python support for "Interfaces" and there's So we could have something like And have |
Fixed #114