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

Issue: differing interface vs. implementation named arguments #130

Open
pegahcarter opened this issue Jan 2, 2025 · 0 comments
Open

Issue: differing interface vs. implementation named arguments #130

pegahcarter opened this issue Jan 2, 2025 · 0 comments

Comments

@pegahcarter
Copy link

Description

Specifically within MessageLibManager, when calling named arguments of the contract one must use the interface over the implementation. For example, if I'm looking at the code and want to use:

function getSendLibrary(address _sender, uint32 _dstEid) public view returns (address lib) {
lib = sendLibrary[_sender][_dstEid];
if (lib == DEFAULT_LIB) {
lib = defaultSendLibrary[_dstEid];
if (lib == address(0x0)) revert Errors.LZ_DefaultSendLibUnavailable();
}
}

I would presume the contract I develop would look like this:

IMessageLibManager(endpoint).getSendLibrary({
    _sender: someAddress,
    _dstEid: someEid
})

However, this actually doesn't work in production. Why? Because the interface has a different declaration of the second argument:

function getSendLibrary(address _sender, uint32 _eid) external view returns (address lib);

Problem

Interfaces help with contract calls, while implementations help with understanding the interfaces. You can expect developers to refer to both implementation and interface when referencing contracts. However, if they use named variable calls, their contract won't compile if using the implementation named arguments.

Scope

There are several functions within MessageLibManager which break their interface conventions. I have not verified if the issue exists in other contracts.

Recommendation

I recommend maintaining the same variable name from interface to implementation so that named argument function calls can be consistently used.

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