I am able to set expiry of subdomain further than expiry of parent. How is this happening?

Hey guys,

I am able to set the expiry of my 3LD further than the 2LD. Isn’t this not supposed to happen?

The names are bigdog.eth and 449.bigdog.eth. bigdog.eth expiries in march, and 449.bigdog.eth expires in June.

Here’s the registrar: 0x93a4FE0E13b44Bf13fE94De558639e1ac4e4D8f0
Here’s the resolver: 0xCD9BEadB30dCdcaDAae071B2F7682A1e2D3bC4E1

I’ve also set GRACE_PERIOD to 0 in the BaseSubdomainRegistrar, so I don’t think it’s to do with that. Also, in the registrar, I’m able to call the renew function even for durations after expiry. The function goes through successfully, but it obviously does not update the expiry time.

Thanks!

1 Like

Grace period is 90 days, so that lines up with your 3 month difference.

I had set GRACE_PERIOD to 0. Also, I don’t know why my contract is allowing me to call renew even though the duration is greater than parent expiry. The transaction goes through successfully, but the expiry doesn’t increase. The _checkParent function basically returns true when it shouldn’t.

    function renew(
    bytes32 parentNode,
    string calldata label,
    uint64 duration
) external payable onlySubdomainOwner(parentNode, label) returns (uint64 newExpiry) {
    _checkParent(parentNode, duration);

    uint256 fee = duration * getRegistrationFee();
    require(msg.value >= fee, "msg value does not meet the price");
    
    duration = duration * 365 days;

    (, , uint64 parentExpiry) = wrapper.getData(uint256(parentNode));
    require(parentExpiry - uint64(block.timestamp) > duration, "duration exceeds limit");

    // names[parentNode].balance += msg.value;

    (bool success1, ) = payable(contractOwner).call{value: msg.value}("");

    if (!success1) {
            revert TransferFailed();
        }
    newExpiry = _renew(parentNode, keccak256(abi.encodePacked(label)), duration);
    emit LeetRenewed(label, parentNode, newExpiry, fee, msg.sender);
    return newExpiry;
}

Note: I have also tried moving _checkParent under duration = duration * 365 days but it still doesn’t work.

The grace period of .eth 2LDs is 90 days, and you cannot change that.

It’s a technicality of the Name Wrapper, the expiry in the wrapper for .eth 2LDs will be set to the end of the grace period (including the 90 days). However when the name reaches the expiry from the .eth Registrar, you won’t be able to transfer it or create subnames or do other NW actions until it is renewed.

1 Like

Any idea why I can call the renew function even past the parent expiry? This is the contract address:

0x457338Be1aD9efe85FE40b152036121e4a9C0156

That’s not a contract address. But in any case, you cannot extend a subname past the parent expiry. The Name Wrapper will automatically set it to the parent expiry if you try to.

If you want your contract to revert when the expiry is too long, then you need to build that into your contract.

It’s on the goerli testnet:

https://goerli.etherscan.io/address/0x457338Be1aD9efe85FE40b152036121e4a9C0156#code

Also, I have built in checks to ensure that it reverts, but it still gets called.

My bad, Goerli, right.

Can you show me a transaction where you say that you were able to extend a subname past its parent expiry?

it won’t… any date past the parent will be accepted but then it’s normalised to the parent date. So you can pass in type(uint64).max and parent expiry date will be set.

1 Like

https://goerli.etherscan.io/tx/0xd3b7296608d91451b083b385f32922651bdbb3331f681fef2995457bd9a09514

All your funds were refunded and it did not extend. You can check in the state tab.

1 Like

Right, it is as I said. You did not extend the subname past the parent expiry.

The Name Wrapper automatically set it to the parent expiry since it was over that cap.

1 Like

Thanks!