Skip to content

Conversation

patricios-space
Copy link
Collaborator

@patricios-space patricios-space commented Sep 26, 2025

NONEVM-2656

Debugging tool to search the commit hash given the contract code hash and the published artifacts

@patricios-space patricios-space force-pushed the debug/code-version-matcher branch from b3fb714 to d636748 Compare September 26, 2025 22:45
@patricios-space patricios-space force-pushed the debug/code-version-matcher branch from 1a9a6a8 to 1c553bb Compare September 29, 2025 14:12
@patricios-space patricios-space force-pushed the debug/code-version-matcher branch from 6ade2c4 to b5070c2 Compare September 29, 2025 14:17
@patricios-space patricios-space marked this pull request as ready for review September 29, 2025 14:33
@patricios-space patricios-space requested a review from a team as a code owner September 29, 2025 14:33
@Copilot Copilot AI review requested due to automatic review settings September 29, 2025 14:33
Copy link
Contributor

@Copilot 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 introduces a debugging tool to search for the commit hash that corresponds to a given contract code hash by cross-referencing published artifacts. The tool connects to the TON blockchain, retrieves a contract's code hash, and searches through GitHub releases to find the matching compiled contract.

Key changes:

  • Added a complete Go application for contract version debugging
  • Implemented GitHub API integration to fetch releases and commit information
  • Created functionality to download and parse contract artifacts from releases

Reviewed Changes

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

File Description
scripts/codehash-matcher/main.go Main application with TON RPC connection, GitHub API integration, and contract matching logic
scripts/codehash-matcher/go.mod Go module definition with dependencies for TON utilities
scripts/codehash-matcher/README.md Documentation explaining tool usage, examples, and troubleshooting

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

strings.Contains(baseName, "/") ||
strings.Contains(baseName, "\\") ||
strings.Contains(baseName, "..") ||
strings.HasPrefix(baseName, ".") {
Copy link

Copilot AI Sep 29, 2025

Choose a reason for hiding this comment

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

The security check to reject filenames starting with '.' may be too restrictive as it would also reject legitimate files like '.compiled.json'. Consider allowing files that end with '.compiled.json' even if they start with a dot, or adjust the logic to be more specific about which dot-prefixed files to reject.

Suggested change
strings.HasPrefix(baseName, ".") {
(strings.HasPrefix(baseName, ".") && !strings.HasSuffix(baseName, ".compiled.json")) {

Copilot uses AI. Check for mistakes.

Comment on lines +394 to +395
strings.Contains(baseName, "/") ||
strings.Contains(baseName, "\\") ||
Copy link

Copilot AI Sep 29, 2025

Choose a reason for hiding this comment

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

The path sanitization logic has a logical issue. Since baseName is derived from filepath.Base(header.Name), it should never contain '/' or '\' characters, making those checks redundant. Consider removing these redundant checks or restructuring the validation logic.

Suggested change
strings.Contains(baseName, "/") ||
strings.Contains(baseName, "\\") ||

Copilot uses AI. Check for mistakes.

@patricios-space patricios-space marked this pull request as draft September 29, 2025 14:58
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.

1 participant