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

Out of bounds test id #805

Open
anvacaru opened this issue Sep 4, 2024 · 0 comments
Open

Out of bounds test id #805

anvacaru opened this issue Sep 4, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@anvacaru
Copy link
Contributor

anvacaru commented Sep 4, 2024

Contract methods that use function arguments with complex structures could result in a test ID that is longer than the file system limit of 255 characters.

OSError: [Errno 36] File name too long: 'out/proofs/src%ThisIsAContractExample.thisIsAMethod((uint256,address,bytes32),(uint8,(((uint8,uint256)[]),bytes32),(bytes32,bytes32),(((uint8,uint256)[]),bytes32),(((uint8,uint256),bytes32,uint32,uint32)[],bytes32),(bytes32,bytes32),bytes32,uint32,uint32,uint32,bytes32,bytes32),(bytes32,(uint64,uint64,bytes32),bytes32,bytes32,bytes32,uint32),(uint16,uint256),bytes):0/proof.json'

As a workaround, I've modified the FoundryTest.name property to hash the arguments used in the method signature, but we must find a permanent solution for this corner case.
Output:

out/proofs/src%ThisIsAContractExample.thisIsAMethod(bcb029f448):0/proof.json

Code changed:

    @property
    def name(self) -> str:
        n = f'{self.contract.name_with_path}.{self.method.signature}'
        if len(n) > 250:
            h = hashlib.sha256(self.method.signature.encode('utf-8')).hexdigest()[:10]
            n = f'{self.contract.name_with_path}.{self.method.name}({h})'
        return n
@anvacaru anvacaru added the bug Something isn't working label Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant