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

feat(bens): index reverse mapping changes from d3 connect protocol #1189

Conversation

renatoalencar
Copy link
Contributor

@renatoalencar renatoalencar commented Jan 14, 2025

This adds support for indexing the new SetReverseMapping event from the D3 Connect Resolver contract. With also a few things included:

A few things are still unresolved:

  • I've kept the mapping function as simple as possible, with only enough to make address lookups work.
  • Making domain resolved address as the reverse mapping address breaks our protocol since we can't make sure this is the actual resolved address from DNS.

Summary by CodeRabbit

  • New Features

    • Added support for the Shibarium network and Shibarium testnet in configuration files.
    • Introduced a new Resolver contract with enhanced domain resolution capabilities.
    • Implemented reverse mapping functionality for domain names.
  • Configuration Updates

    • Updated network and protocol configurations for Shibarium, including new protocols and chains.
    • Added new testnet chain configuration.
  • Technical Improvements

    • Enhanced domain resolution and mapping processes.
    • Optimized utility functions for string processing.

Copy link
Contributor

coderabbitai bot commented Jan 14, 2025

Warning

Rate limit exceeded

@renatoalencar has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 5 minutes and 45 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 7935973 and a1f878e.

📒 Files selected for processing (6)
  • blockscout-ens/bens-server/config/dev.json (3 hunks)
  • blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/abis/Resolver.json (1 hunks)
  • blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/networks.json (1 hunks)
  • blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/src/Resolver.ts (1 hunks)
  • blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/src/utils.ts (1 hunks)
  • blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/subgraph.yaml (1 hunks)

Walkthrough

This pull request introduces significant configuration updates for the Shibarium network's blockchain infrastructure within the blockscout-ens repository. Key changes include the modification of the subgraphs reader configuration to transition the protocol from "d3_connect" to "d3_connect_shib" and the addition of a new protocol "d3_connect_shib_testnet". A new chain configuration for the Shibarium testnet has been established, detailing provider settings and network specifications. Furthermore, a new Resolver contract has been introduced to enhance domain resolution through reverse mapping functionality. The overall structure of the configuration files has been expanded to accommodate these new protocols and networks.

Possibly related PRs

  • bens(config): add ape chain to configs #1188: The changes in this PR involve adding a new protocol "d3-connect-ape" and a new network configuration for the ApeChain, which is related to the modifications made in the main PR regarding the protocols and networks configuration.

Poem

🐰 A Rabbit's Ode to Shibarium's Debut

In config files, a new path unfurls,
Testnet whispers, blockchain's fresh pearls.
Resolver dancing, domains take flight,
Mapping reverse with algorithmic might.
CodeRabbit hops through networks bright! 🌐


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@renatoalencar renatoalencar force-pushed the renatoalencar/d3-connect-reverse-mapping-index branch from 1f3d105 to 3c12699 Compare January 14, 2025 22:20
resolvedDomain.resolver = resolverId;

resolvedDomain.subdomainCount = 0;
resolvedDomain.isMigrated = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
resolvedDomain.isMigrated = false;
resolvedDomain.isMigrated = true;

domain.resolver = resolverId

domain.subdomainCount = 0;
domain.isMigrated = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
domain.isMigrated = false;
domain.isMigrated = true;

Copy link
Contributor

Choose a reason for hiding this comment

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

this is field for ENS legacy, only old domains have isMigrated=false

"address": "0x1443bC2bBAB07437BCF9C577b647523A736bB33E",
"startBlock": 1927346
},
"Resolver": {
Copy link
Contributor

Choose a reason for hiding this comment

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

To deploy this subgraph on shibarium-mainnet, we need to specify Resolver for mainnet also

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Once the new mainnet resolvers are deployed I'll update them.

@renatoalencar renatoalencar force-pushed the renatoalencar/d3-connect-reverse-mapping-index branch 2 times, most recently from 42bb7a6 to f738e6d Compare January 20, 2025 20:15
@renatoalencar renatoalencar marked this pull request as ready for review January 20, 2025 20:15
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (3)
blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/src/Resolver.ts (2)

9-31: Consider validating wallet address format.

The function assumes the wallet address is valid and can be converted to a hex string. Consider adding validation to handle potential invalid addresses.

 export function handleSetReverseMapping(event: SetReverseMapping): void {
+  if (!event.params.wallet) {
+    log.warning('Invalid wallet address in SetReverseMapping event', []);
+    return;
+  }
   let name = `${event.params.wallet.toHexString().slice(2)}.addr.reverse`;

51-57: Consider adding timestamp to NameChanged event.

The event entity should include a timestamp for better tracking and querying capabilities.

   let resolverEvent = new NameChanged(createEventID(event));
   resolverEvent.resolver = resolverId
   resolverEvent.blockNumber = event.block.number.toI32();
   resolverEvent.transactionID = event.transaction.hash;
   resolverEvent.name = event.params.name;
+  resolverEvent.timestamp = event.block.timestamp;
   resolverEvent.save();
blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/abis/Resolver.json (1)

1-648: Consider documenting the contract interface.

The ABI is comprehensive but lacks documentation. Consider adding NatSpec documentation to explain:

  • The purpose of each function
  • The role requirements for restricted functions
  • The expected format of input arrays for setReverseMapping
  • The relationship between resolve and reverseResolve functions

Would you like me to generate NatSpec documentation for the contract interface?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8f2caa9 and f738e6d.

📒 Files selected for processing (8)
  • blockscout-ens/bens-server/config/dev.json (3 hunks)
  • blockscout-ens/graph-node/config.toml (1 hunks)
  • blockscout-ens/graph-node/deployer/config.json (1 hunks)
  • blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/abis/Resolver.json (1 hunks)
  • blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/networks.json (1 hunks)
  • blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/src/Resolver.ts (1 hunks)
  • blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/src/utils.ts (1 hunks)
  • blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/subgraph.yaml (1 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
blockscout-ens/graph-node/deployer/config.json

[error] 72-72: Expected a property but instead found '}'.

Expected a property here.

(parse)

🪛 Gitleaks (8.21.2)
blockscout-ens/bens-server/config/dev.json

106-106: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🔇 Additional comments (9)
blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/src/Resolver.ts (1)

7-7: Verify the hardcoded ADDR_REVERSE_NODE value.

Please ensure this hash value matches the deployed contract's configuration for reverse node address.

✅ Verification successful

The ADDR_REVERSE_NODE value is correct

The hash value 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2 is verified to be the correct namehash of "addr.reverse" domain, as confirmed by multiple independent implementations and documentation in the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any other occurrences or definitions of this hash
rg -i "91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2"

Length of output: 68038

blockscout-ens/graph-node/config.toml (1)

47-51: Verify RPC endpoint availability and rate limits.

Please ensure that the RPC endpoint https://puppynet.shibrpc.com is:

  1. Publicly accessible
  2. Has sufficient rate limits for graph-node indexing
  3. Provides archive node capabilities if historical data indexing is required
✅ Verification successful

RPC endpoint is accessible and provides archive node capabilities

The endpoint https://puppynet.shibrpc.com:

  • Responds to JSON-RPC requests correctly
  • Provides historical block data (archive node functionality confirmed)
  • Manual verification of rate limits during indexing is recommended
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Test RPC endpoint availability and basic functionality
curl -X POST -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
  https://puppynet.shibrpc.com

Length of output: 514


Script:

#!/bin/bash
# Test archive node capabilities by querying an early block
curl -X POST -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x1", false],"id":1}' \
  https://puppynet.shibrpc.com

Length of output: 2111

blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/subgraph.yaml (1)

35-56: LGTM! The Resolver data source configuration is well-structured.

The configuration correctly sets up indexing for the SetReverseMapping event with appropriate entities and mappings.

Let's verify the contract address deployment:

✅ Verification successful

Resolver contract implementation verified successfully

The contract address, ABI definition, and event handling implementation are all properly configured and consistent. The SetReverseMapping event is correctly defined in the ABI and the handler implementation properly processes the event data.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the Resolver contract address exists on the network
# and check if there are any other contracts at this address

# Search for any references to the Resolver contract address
rg -i "0x8b9d58e6915A71Dd782F5111c886377Df1d5cBe5"

Length of output: 313


Script:

#!/bin/bash
# Check the event signature in Resolver ABI and handler implementation
cat blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/abis/Resolver.json
echo "---"
cat blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/src/Resolver.ts

Length of output: 14735

blockscout-ens/graph-node/deployer/config.json (1)

73-76: LGTM! The testnet protocol configuration is properly structured.

The new protocol "d3-connect-shib-testnet" is correctly configured with appropriate subgraph path and network settings.

blockscout-ens/bens-server/config/dev.json (3)

26-26: LGTM! Protocol name updated correctly.

The protocol name change from "d3_connect" to "d3_connect_shib" aligns with the new naming convention.


30-37: LGTM! Testnet network configuration is properly structured.

The new network 157 configuration is correctly set up with appropriate blockscout URL and RPC endpoint.


Line range hint 81-98: Verify resolver contract addresses across environments.

The resolver contract addresses differ between mainnet and testnet:

  • Mainnet: 0xD60D40674E678F0089736D6381071973a75B4B6f
  • Testnet: 0xae6Bdf6e9edA0bA60F97390e70a545e91B5E8bf2

Please ensure these are the correct contract addresses for each environment.

Also applies to: 99-115

✅ Verification successful

Resolver contract addresses are correctly configured

The resolver contract addresses are properly configured for each network:

  • Shibarium mainnet (network 109): 0xD60D40674E678F0089736D6381071973a75B4B6f
  • Shibarium testnet (network 157): 0xae6Bdf6e9edA0bA60F97390e70a545e91B5E8bf2
  • APE network (network 33139): 0xeA54b0E40E956383C95e28cb407FF35235Aa31fE
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify resolver contract addresses across configurations
# Search for any references to the resolver contract addresses to ensure consistency

echo "Checking mainnet resolver contract references:"
rg -i "0xD60D40674E678F0089736D6381071973a75B4B6f"

echo "Checking testnet resolver contract references:"
rg -i "0xae6Bdf6e9edA0bA60F97390e70a545e91B5E8bf2"

Length of output: 799


Script:

#!/bin/bash
# Search for all resolver contract configurations and environment config files
echo "Checking all resolver contract configurations:"
rg -i "resolver_contract"

echo -e "\nChecking for environment config files:"
fd -e json -p "config/"

Length of output: 1668


Script:

#!/bin/bash
# Get full context of resolver configurations in environment files
echo "Checking resolver configurations in dev.json:"
rg -A 10 -B 10 "resolver_contract" blockscout-ens/bens-server/config/dev.json

echo -e "\nChecking resolver configurations in prod.json:"
rg -A 10 -B 10 "resolver_contract" blockscout-ens/bens-server/config/prod.json

echo -e "\nChecking resolver configurations in staging.json:"
rg -A 10 -B 10 "resolver_contract" blockscout-ens/bens-server/config/staging.json

Length of output: 3463

🧰 Tools
🪛 Gitleaks (8.21.2)

88-88: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/abis/Resolver.json (2)

179-203: LGTM! The SetReverseMapping event is properly defined.

The event includes all necessary parameters for reverse mapping:

  • wallet (address)
  • name (string)
  • symbol (string)

536-558: Verify array parameters in setReverseMapping function.

The setReverseMapping function accepts arrays (string[]) for both name and symbol parameters, but the event emits single strings. This might indicate a potential mismatch in the implementation.

Comment on lines +33 to +50
let resolvedDomainNode = hashByName(event.params.name);
let resolvedDomain = Domain.load(resolvedDomainNode.toHexString());
if (resolvedDomain == null) {
resolvedDomain = new Domain(resolvedDomainNode.toHexString());
resolvedDomain.createdAt = event.block.timestamp;
resolvedDomain.name = event.params.name;

resolvedDomain.subdomainCount = 0;
resolvedDomain.isMigrated = true;
resolvedDomain.owner = event.params.wallet.toHexString();
resolvedDomain.storedOffchain = false;
resolvedDomain.resolvedWithWildcard = false;
}

resolvedDomain.resolver = resolverId;
resolvedDomain.resolvedAddress = event.params.wallet.toHexString();
resolvedDomain.save();

Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add validation for resolved domain name.

The function should validate event.params.name to ensure it's a valid domain name before processing.

+  if (!event.params.name || event.params.name.trim().length === 0) {
+    log.warning('Empty or invalid domain name in SetReverseMapping event', []);
+    return;
+  }
   let resolvedDomainNode = hashByName(event.params.name);

Committable suggestion skipped: line range outside the PR's diff.

Comment on lines +125 to +136
function splitStringOnce(input: string, separator: string): string[] {
const separatorIndex = input.indexOf(separator)

if (separatorIndex === -1) {
return [input, ''];
}

return [
input.slice(0, separatorIndex),
input.slice(separatorIndex + separator.length)
]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider adding input validation for empty separator.

The function should handle the case when the separator is an empty string to prevent potential issues.

 function splitStringOnce(input: string, separator: string): string[] {
+  if (!separator) {
+    return [input, ''];
+  }
   const separatorIndex = input.indexOf(separator)

   if (separatorIndex === -1) {
     return [input, ''];
   }

   return [
     input.slice(0, separatorIndex),
     input.slice(separatorIndex + separator.length)
   ]
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function splitStringOnce(input: string, separator: string): string[] {
const separatorIndex = input.indexOf(separator)
if (separatorIndex === -1) {
return [input, ''];
}
return [
input.slice(0, separatorIndex),
input.slice(separatorIndex + separator.length)
]
}
function splitStringOnce(input: string, separator: string): string[] {
if (!separator) {
return [input, ''];
}
const separatorIndex = input.indexOf(separator)
if (separatorIndex === -1) {
return [input, ''];
}
return [
input.slice(0, separatorIndex),
input.slice(separatorIndex + separator.length)
]
}

"startBlock": 1927346
},
"Resolver": {
"address": "0xae6Bdf6e9edA0bA60F97390e70a545e91B5E8bf2.",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix invalid address format.

The Resolver address for shibarium-testnet contains an extra period at the end which makes it invalid.

-      "address": "0xae6Bdf6e9edA0bA60F97390e70a545e91B5E8bf2.",
+      "address": "0xae6Bdf6e9edA0bA60F97390e70a545e91B5E8bf2"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"address": "0xae6Bdf6e9edA0bA60F97390e70a545e91B5E8bf2.",
"address": "0xae6Bdf6e9edA0bA60F97390e70a545e91B5E8bf2"

Comment on lines 71 to 72
"network": "ape-mainnet",
},
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix JSON syntax error.

Remove the trailing comma after "network": "ape-mainnet" as it's causing a parsing error.

Apply this diff:

-      "network": "ape-mainnet",
+      "network": "ape-mainnet"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"network": "ape-mainnet",
},
"network": "ape-mainnet"
},
🧰 Tools
🪛 Biome (1.9.4)

[error] 72-72: Expected a property but instead found '}'.

Expected a property here.

(parse)

@renatoalencar renatoalencar force-pushed the renatoalencar/d3-connect-reverse-mapping-index branch from a6d68e6 to 7935973 Compare January 20, 2025 21:06
@renatoalencar renatoalencar force-pushed the renatoalencar/d3-connect-reverse-mapping-index branch from 7935973 to a1f878e Compare January 20, 2025 21:08
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments.

Actionable comments posted: 2

🔭 Outside diff range comments (1)
blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/networks.json (1)

Contract verification results require attention

  • ✅ Shibarium mainnet: Both Registry and Resolver contracts are deployed and operational
  • ❌ Shibarium testnet: Invalid Resolver address format (contains trailing period: "0xae6Bdf6e9edA0bA60F97390e70a545e91B5E8bf2.")
  • ❌ No contract bytecode found for either contract on Shibarium testnet and Ape mainnet networks
🔗 Analysis chain

Line range hint 1-34: Verify contract addresses on-chain.

Please verify that all contract addresses are correctly deployed and operational on their respective networks.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify contract addresses exist on their respective networks

# Function to check contract code existence
check_contract() {
  local network=$1
  local name=$2
  local address=$3
  echo "Checking $name contract at $address on $network..."
  
  # Use eth_getCode RPC call to verify contract existence
  curl -s -X POST -H "Content-Type: application/json" --data "{
    \"jsonrpc\":\"2.0\",
    \"method\":\"eth_getCode\",
    \"params\":[\"$address\", \"latest\"],
    \"id\":1
  }" "$network" | jq -r '.result'
}

# Check Shibarium contracts
check_contract "https://rpc.shibrpc.com" "Registry" "0xDe74799371Ceac11A0F52BA2694392A391D0dA18"
check_contract "https://rpc.shibrpc.com" "Resolver" "0x8b9d58e6915A71Dd782F5111c886377Df1d5cBe5"

# Check Shibarium Testnet contracts
check_contract "https://rpc-shibuya.dog" "Registry" "0x1443bC2bBAB07437BCF9C577b647523A736bB33E"
check_contract "https://rpc-shibuya.dog" "Resolver" "0xae6Bdf6e9edA0bA60F97390e70a545e91B5E8bf2"

# Check Ape-mainnet contracts
check_contract "https://mainnet.apexlayer.xyz" "Registry" "0x0D435A6c16045Abeaf6A442Bf162fd52597B4Ed3"
check_contract "https://mainnet.apexlayer.xyz" "Resolver" "0x3698485B8079FBDCc86Eb4f69Ebb9349DF1fc6f4"

Length of output: 6911

🧹 Nitpick comments (1)
blockscout-ens/bens-server/config/dev.json (1)

99-115: Consider adding environment indicators to prevent confusion.

The meta information (title, description) is identical between mainnet and testnet configurations. Consider adding "(Testnet)" suffix to distinguish them, similar to how the ENS configuration does it.

Apply this diff to improve clarity:

         "meta": {
-          "short_name": "D3 Connect",
-          "title": "D3 Connect",
+          "short_name": "D3 Connect (Testnet)",
+          "title": "D3 Connect (Testnet)",
           "description": "D3 Connect is a platform for connecting to the Shibarium network.",
🧰 Tools
🪛 Gitleaks (8.21.2)

106-106: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🛑 Comments failed to post (2)
blockscout-ens/graph-node/subgraphs/d3-connect-subgraph/src/Resolver.ts (2)

26-26: ⚠️ Potential issue

Verify ownership assignment.

Using transaction.from as the owner might not be secure as it could be different from the actual wallet address. Consider using the wallet parameter from the event instead.

-    domain.owner = event.transaction.from.toHexString();
+    domain.owner = event.params.wallet.toHexString();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

    domain.owner = event.params.wallet.toHexString();

47-49: ⚠️ Potential issue

Verify domain ownership before updates.

The function updates the resolver and resolved address without verifying if the caller has permission to modify the domain.

+  // Only allow updates if the domain is owned by the wallet
+  if (resolvedDomain.owner != event.params.wallet.toHexString()) {
+    log.warning('Unauthorized attempt to update domain resolution', []);
+    return;
+  }
   resolvedDomain.resolver = resolverId;
   resolvedDomain.resolvedAddress = event.params.wallet.toHexString();

Committable suggestion skipped: line range outside the PR's diff.

@sevenzing
Copy link
Contributor

will be merged in #1220

@sevenzing sevenzing closed this Jan 30, 2025
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