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

[REG-1440] [WIP] feat: updating ENSCustody contract to support wallet migration #369

Closed
wants to merge 1 commit into from

Conversation

DancingAxolotl
Copy link
Contributor

PR Checklist

1. Contracts versioning

  • Make sure that the patch version of the contracts is increased if changes have been made to the UNSRegistry, MintingManager, ProxyReader, ENSCustody contracts.
  • Make sure that the minor version of the contracts is increased if breaking changes have been made to the UNSRegistry, MintingManager, ProxyReader, ENSCustody contracts. It includes changes of interfaces.

2. Contracts licensing

  • Make sure that no SPDX-License-Identifier defined in contracts.
  • Make sure that the header is added to the new contract files.
    // @author Unstoppable Domains, Inc.
    // @date {Month} {Day}(ordinal), {Year}
    

3. Coverage

  • Make sure that the coverage of contracts has not decreased and strive 100%

4. Configs versioning

  • Make sure that the version of uns-config.json is increased if changes have been made to the config.
  • Make sure that the version of ens-config.json is increased if changes have been made to the config.
  • Make sure that the version of resolver-keys.json is increased if changes have been made to the config.
  • Make sure that the version of ens-resolver-keys.json is increased if changes have been made to the config.

5. Package versioning

  • Make sure that the patch version of package is increased if valuable changes have been made to the package. It includes contracts update, configs update, etc.
  • Make sure that the major.minor version of package is synced with version of UNSRegistry contract.
  • Make sure that the CHANGELOG is updated with short description for the new version.

6. Code review

  • resolver-keys.json code review is required from DevTools team
  • ens-resolver-keys.json code review is required from DevTools team
  • For all other changes code review is required from Registry team

Copy link

github-actions bot commented Oct 3, 2024

Contracts size report

Contract name Size (KiB) Delta (KiB)
ENSCustody 14.217 +1.153
MintingManager 18.92 0
ProxyReader 15.176 0
UNSRegistry 20.725 0

@@ -215,15 +217,33 @@ contract ENSCustody is
}

function safeTransfer(address to, uint256 tokenId) external onlyTokenOwner(tokenId) {
this.safeTransfer(to, tokenId, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While calling
this.safeTransfer(to, tokenId, false);
msg.sender will be contract address in the second function, which I suppose will most likely fail on onlyTokenOwner check.
Using call through this. in smart contracts is a highly unrecommended practice. Better to make lower function public and calling it like internal one

}

receive() external payable {}

function multicall(bytes[] calldata data) public returns (bytes[] memory results) {
bytes[] memory _data = data;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just mark data as memory in parameters

}

receive() external payable {}

function multicall(bytes[] calldata data) public returns (bytes[] memory results) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we discussed with Nick and Kiryl that it is better not to include generic multicall here but to add just butchTransfer
which will take an array of tokens to transfer and perform a cycle of transfers. It must be enough for our case here.

Copy link
Contributor Author

@DancingAxolotl DancingAxolotl Oct 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean something like this?

    struct TransferParams {
        address from;
        uint256 to;
        uint256 tokenId;
        bytes signature
    }
    function BulkTransfer(TransferParams[] params) {
        for (uint256 i = 0; i < params.length; i++) {
            TransferParams calldata p = params[i];
            // check owner, check signature, invalidate token nonce, etc.
            _park(p.tokenId, p.to);
        }
    }

Why can't we reuse existing meta tx functionality to handle validations for each transfer?
If we check the function signature in calldata to restrict multicall only to safeTransfer, would that work?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's what I ment, to reuse existing meta functionality but for a narrow field of bulk transfer and not for generic multicall.

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

Successfully merging this pull request may close these issues.

2 participants