From c24fbcdd587321700d5a3709a34d46b45c55eb34 Mon Sep 17 00:00:00 2001 From: Brian Li Date: Fri, 10 May 2024 10:59:14 -0700 Subject: [PATCH] Fix router in post cutoff period (#184) * Fix router in post cutoff period * Use version 3.3.0 --- router/sources/router.move | 14 ++++++++++++-- sh_scripts/dev_setup.sh | 4 +--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/router/sources/router.move b/router/sources/router.move index 0b21c064..87a8441d 100644 --- a/router/sources/router.move +++ b/router/sources/router.move @@ -428,12 +428,22 @@ module router::router { }; // Mint token in v2 + // Names past the cutoff date will end up with a negative + // registration duration. The following logic ensures that duration + // is >= 1 + let registration_duration_secs = if (new_expiration_time_sec > now) + { + new_expiration_time_sec - now + } else { + // Must be non-zero so that the name is not considered expired + 1 + }; v2_1_domains::register_name_with_router( router_signer, user, domain_name, subdomain_name, - new_expiration_time_sec - now + registration_duration_secs, ); // If the name was a primary name, carry it over (`target_addr` gets automatically carried over too) @@ -770,7 +780,7 @@ module router::router { subdomain_name: Option, ): bool { let (is_owner, _token_id) = domains::is_token_owner(owner_addr, subdomain_name, domain_name); - is_owner && !domains::name_is_expired(subdomain_name, domain_name) + is_owner && !domains::name_is_expired_past_grace(subdomain_name, domain_name) } #[view] diff --git a/sh_scripts/dev_setup.sh b/sh_scripts/dev_setup.sh index 31a4e295..711c1df4 100755 --- a/sh_scripts/dev_setup.sh +++ b/sh_scripts/dev_setup.sh @@ -11,10 +11,8 @@ if ! command -v aptos &>/dev/null; then echo "aptos could not be found" echo "installing it..." TARGET=Ubuntu-x86_64 - VERSION=2.0.2 + VERSION=3.3.0 wget https://github.com/aptos-labs/aptos-core/releases/download/aptos-cli-v$VERSION/aptos-cli-$VERSION-$TARGET.zip - sha=$(shasum -a 256 aptos-cli-$VERSION-$TARGET.zip | awk '{ print $1 }') - [ "$sha" != "1f0ed0d0e042ff8b48b428eaaff9f52e6ff2b246a2054740d017f514c753c6cb" ] && echo "shasum mismatch" && exit 1 unzip aptos-cli-$VERSION-$TARGET.zip chmod +x aptos else