Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storage.KeyValueMismatch is broken #523

Open
chfast opened this issue Apr 23, 2024 · 0 comments
Open

Storage.KeyValueMismatch is broken #523

chfast opened this issue Apr 23, 2024 · 0 comments

Comments

@chfast
Copy link
Contributor

chfast commented Apr 23, 2024

It seems the usage of the Storage.KeyValueMismatch exception is causing another exception when it is being printed. In the end, user get no information what is mismatched.

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = Storage(root={0: 1}), address = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00'
other = Storage(root={1: 1})

    def must_be_equal(self, address: Address, other: "Storage | None"):
        """
        Succeeds only if "self" is equal to "other" storage.
        """
        # Test keys contained in both storage objects
        if other is None:
            other = Storage({})
        for key in self.keys() & other.keys():
            if self[key] != other[key]:
                raise Storage.KeyValueMismatch(
                    address=address, key=key, want=self[key], got=other[key]
                )

        # Test keys contained in either one of the storage objects
        for key in self.keys() ^ other.keys():
            if key in self:
                if self[key] != 0:
>                   raise Storage.KeyValueMismatch(address=address, key=key, want=self[key], got=0)
E                   ethereum_test_tools.common.types.Storage.KeyValueMismatch: <exception str() failed>

src/ethereum_test_tools/common/types.py:314: KeyValueMismatch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant