feat: fixed router registry entry point bug - #1232
Merged
Merged
Conversation
|
@Jayydy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
What changed
Here's a summary of what was changed and why each decision was made:
contracts/router-registry/src/lib.rsAdded two constants after MAX_CONSTRAINT_LEN, matching router-core exactly:
const INSTANCE_TTL_THRESHOLD: u32 = 17280 * 30; // ~30 days
const INSTANCE_TTL_EXTEND_TO: u32 = 17280 * 60; // ~60 days
Added router_common::extend_instance_ttl(&env, INSTANCE_TTL_THRESHOLD,
INSTANCE_TTL_EXTEND_TO); to all 16 public entry points: initialize, register,
register_with_check, bulk_register, get, is_deprecated, get_latest,
get_latest_with_constraint, deprecate, deprecate_all_versions, deprecate_many,
transfer_admin, admin, versions, get_all_versions, get_all_names,
get_entry_by_address.
The call is placed after require_auth() (so unauthorized callers don't extend
TTL) but before the admin check — consistent with how router-core handles it.
For read-only entry points that have no auth, it's the very first line.
One design note on is_deprecated: it was previously delegating to get(), which
would now create a double TTL bump. I inlined the storage read directly so
each entry point only bumps once.
contracts/router-common/src/lib.rsRemoved a pre-existing duplicate EVENT_ROLE_LIMITS_SET constant at line 245
that was causing a compile error (E0428: defined multiple times). The first
definition at line 62 has the more precise doc comment ("Emitted when the
super-admin changes the role-system limits") and was kept
How it was tested
Follow-up work
Checklist
feat/,fix/,docs/, etc.)cargo test)cargo fmt)cargo clippy -- -D warnings)type(scope): description)Related Issues
Closes #1173