Skip to content

Develop#17

Merged
wzrdx merged 3 commits intomainfrom
develop
Jan 4, 2026
Merged

Develop#17
wzrdx merged 3 commits intomainfrom
develop

Conversation

@aledefra
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings December 22, 2025 09:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the node page to support internal node addresses (prefixed with 0xai_) in addition to standard Ethereum addresses. A new resolution layer converts internal addresses to Ethereum addresses before fetching node data.

  • Added resolveNodeEthAddress function to handle both internal and Ethereum address formats
  • Refactored parameter names from nodeEthAddr to nodeAddr throughout to reflect dual address support
  • Added loading skeleton component for improved user experience during page loads

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
app/node/[nodeAddr]/page.tsx Implements internal address resolution and updates parameter naming to support both address types
app/node/[nodeAddr]/loading.tsx Adds skeleton loading states for node page sections
Comments suppressed due to low confidence (1)

app/node/[nodeAddr]/page.tsx:26

  • The internal address validation is missing a length check. In other parts of the codebase (lib/actions.ts line 62 and lib/utils.tsx line 231), internal addresses are validated to be exactly 49 characters long with the pattern query.startsWith('0xai_') && query.length === 49. This function should include the same length validation to ensure consistency and reject malformed internal addresses.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings January 4, 2026 15:31
@aledefra aledefra changed the title feat: use internal address for node page (#16) Develop Jan 4, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 6 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

app/node/[nodeAddr]/page.tsx:32

  • The error handling in the try-catch block silently catches and ignores errors from internalNodeAddressToEthAddress. Consider logging the error for debugging purposes to help identify issues with malformed internal addresses.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +138 to +145
const firstMiningEpoch = (
await publicClient.readContract({
address: config.mndContractAddress,
abi: MNDContractAbi,
functionName: 'licenses',
args: [BigInt(licenseId)],
})
)[3];
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

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

The array indexing used to extract firstMiningEpoch is fragile and unclear. Using a magic index [3] makes the code difficult to understand and maintain. Consider either destructuring the return value with named properties or adding a comment explaining what index 3 represents in the licenses tuple.

Suggested change
const firstMiningEpoch = (
await publicClient.readContract({
address: config.mndContractAddress,
abi: MNDContractAbi,
functionName: 'licenses',
args: [BigInt(licenseId)],
})
)[3];
// The 'licenses' function returns a tuple where the 4th element is firstMiningEpoch.
const [, , , firstMiningEpoch] = await publicClient.readContract({
address: config.mndContractAddress,
abi: MNDContractAbi,
functionName: 'licenses',
args: [BigInt(licenseId)],
});

Copilot uses AI. Check for mistakes.
}

const maxRemainingClaimAmount = license.totalAssignedAmount - license.totalClaimedAmount;
return rewards_amount > maxRemainingClaimAmount ? maxRemainingClaimAmount : rewards_amount;
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

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

The comparison logic should use strict equality. The condition should be written as rewards_amount < maxRemainingClaimAmount ? rewards_amount : maxRemainingClaimAmount to match the pattern used in the original calculateLicenseRewards function at line 414. Currently, it uses the reversed order which could be confusing for maintainability.

Suggested change
return rewards_amount > maxRemainingClaimAmount ? maxRemainingClaimAmount : rewards_amount;
return rewards_amount < maxRemainingClaimAmount ? rewards_amount : maxRemainingClaimAmount;

Copilot uses AI. Check for mistakes.
Comment on lines +74 to +81
firstMiningEpoch = (
await publicClient.readContract({
address: config.mndContractAddress,
abi: MNDContractAbi,
functionName: 'licenses',
args: [result.licenseId],
})
)[3];
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

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

The array indexing used to extract firstMiningEpoch is fragile and unclear. Using a magic index [3] makes the code difficult to understand and maintain. Consider either destructuring the return value with named properties or adding a comment explaining what index 3 represents in the licenses tuple.

Suggested change
firstMiningEpoch = (
await publicClient.readContract({
address: config.mndContractAddress,
abi: MNDContractAbi,
functionName: 'licenses',
args: [result.licenseId],
})
)[3];
const [, , , firstMiningEpochFromLicense] = await publicClient.readContract({
address: config.mndContractAddress,
abi: MNDContractAbi,
functionName: 'licenses',
args: [result.licenseId],
});
firstMiningEpoch = firstMiningEpochFromLicense;

Copilot uses AI. Check for mistakes.
@wzrdx wzrdx merged commit 3a040a6 into main Jan 4, 2026
7 checks passed
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