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

feat(sol-macro): support namespaces #694

Merged
merged 12 commits into from
Aug 12, 2024
Merged

Conversation

DaniPopes
Copy link
Member

@DaniPopes DaniPopes commented Jul 25, 2024

Closes #660
Closes #599

DaniPopes and others added 3 commits July 6, 2024 16:10
* respect namespaces

* un-ignore test

* clippy

* clippy

* fix doc

* rm debug prints
@klkvr
Copy link
Member

klkvr commented Jul 25, 2024

just tested locally and it seems that derives aren't applied to generated libraries in json abi input causing compilation issues

e.g. this would cause Lib::Struct doesn't implement Debug because Lib::Struct is used in some of the Contract types

sol!(
    #[derive(Debug)]
    Contract,
    r#"[
        {
            "type": "function",
            "name": "f",
            "inputs": [
                {
                    "name": "s",
                    "type": "tuple",
                    "internalType": "struct Lib.Struct",
                    "components": [
                        {
                            "name": "a",
                            "type": "uint256",
                            "internalType": "uint256"
                        }
                    ]
                }
            ],
            "outputs": [],
            "stateMutability": "nonpayable"
        }
    ]"#
);

@DaniPopes
Copy link
Member Author

And would also be a pretty big breaking change

@DaniPopes DaniPopes marked this pull request as draft July 25, 2024 09:48
@DaniPopes DaniPopes marked this pull request as ready for review August 7, 2024 19:44
@DaniPopes
Copy link
Member Author

DaniPopes commented Aug 7, 2024

This is broken now, marking as draft again:

sol! {
    contract Vm {
        struct Wallet {
            uint stuff;
        }

        /// Gets the nonce of an account.
        function getNonce(address account) external view returns (uint64 nonce);

        /// Get the nonce of a `Wallet`.
        function getNonce(Wallet calldata wallet) external returns (uint64 nonce);
    }
}

@DaniPopes DaniPopes marked this pull request as draft August 7, 2024 20:10
@klkvr
Copy link
Member

klkvr commented Aug 8, 2024

Updated in 8fe0df0, we didn't apply namespaces when resolving overloads

@klkvr klkvr force-pushed the dani/to-sol-contract-specifiers branch from 18c2ed4 to 8fe0df0 Compare August 8, 2024 04:51
@DaniPopes DaniPopes marked this pull request as ready for review August 8, 2024 16:57
@DaniPopes DaniPopes merged commit b4ca4fe into main Aug 12, 2024
30 checks passed
@DaniPopes DaniPopes deleted the dani/to-sol-contract-specifiers branch August 12, 2024 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants