[Feat] Integrate Bytecode Verification Status Display#115
[Feat] Integrate Bytecode Verification Status Display#115
Conversation
Update explorer to query node's bytecode verification endpoint and only display source code when verification succeeds. Changes: - Add getModuleVerificationStatus API client function - Add useGetModuleVerificationStatus React hook for querying verification status - Update Code component to query verification before displaying source - Only display source code if verification status is true (verified_success) - Handle errors: 404 (no source), 503 (verification disabled), false (verification failure) - Update ViewCode and Contract components to pass address/moduleName to Code component - Add SERVICE_UNAVAILABLE error type for 503 responses Display logic: - Loading: shows "Verifying source code..." message - Verified (true): displays source code with syntax highlighting - Not verified (false/error): does not display source code
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for rococo-selkie-abda2e ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Not sure if this change is intentional, flagging it in case it affects other existing workflows
There was a problem hiding this comment.
thx for pointing this out.
The new value for local network URL matches aptos-core's default REST API port. (defined in aptos-core/config/src/config/api_config.rs as DEFAULT_PORT: u16 = 8080).
i did not understand the reason why it should be 30731
There was a problem hiding this comment.
Iirc it was 30731 with the old process-compose but yes 8080 should be correct default now... think @musitdev would know with greater certainty.
| <Stack spacing={1}> | ||
| {hasVerificationFailure && ( | ||
| <Alert severity="warning"> | ||
| The deployer provided source code but it does not match the deployed bytecode. The displayed code may not accurately represent what is actually running on-chain. |
There was a problem hiding this comment.
| The deployer provided source code but it does not match the deployed bytecode. The displayed code may not accurately represent what is actually running on-chain. | |
| The deployer provided source code but it does not match the deployed bytecode. The displayed code does not accurately represent what is actually running on-chain. |
There was a problem hiding this comment.
i was going for the less strong word, because i would assume if there is a differing comment it would also fail? which can be construed as not being different with respect to code... is this wrong?
| </Box> | ||
| ) : shouldShowCode ? ( | ||
| <Stack spacing={1}> | ||
| {hasVerificationFailure && ( |
There was a problem hiding this comment.
Add message when verification is successful:
| {hasVerificationFailure && ( | |
| {isVerified && ( | |
| <Alert severity="success"> | |
| Source code verified: the displayed code matches the deployed bytecode. | |
| </Alert> | |
| )} | |
| {hasVerificationFailure && ( |
There was a problem hiding this comment.
Iirc it was 30731 with the old process-compose but yes 8080 should be correct default now... think @musitdev would know with greater certainty.
| @@ -18,7 +18,7 @@ export const bardockTestnetUrl = | |||
| testnet: "", | |||
| "bardock testnet": bardockTestnetUrl, | |||
| devnet: "", | |||
There was a problem hiding this comment.
@apenzk could you clean up the indentation:
- Line 16: export has extra leading spaces
- Line 20: devnet is missing indentation
|
@andygolay i have added
I also added two cases in analysis-explorer-vulnerability to test correct behavior |
|
@apenzk @andygolay don't we always want the latest version meaning that we always want to return the latest upgrade number? I would say we should drop the version number and cache only if the latest version is verified. So once it finds on cache and it doesn't find the latest version, it deletes from cache to free up some space (10k registries isn't that much). Are we able to optimize finding the iteration over the Vec somehow? |
- getModuleVerificationStatus and useGetModuleVerificationStatus accept upgradeNumber - API called with ?upgrade_number= when set - Contract and ViewCode pass upgrade_number from selected package to Code/verification hook - CodeSnippet accepts upgradeNumber and forwards to useGetModuleVerificationStatus
@Primata I now dropped Why we must use upgrade_number at all:
commits:
if 10k is an issue i would say we can reduce to 1000 or 100 even. |
Integrate Bytecode Verification Status Display
Target Branch:
mainRelated Issues
Closes #114
Dependencies
Depends on movementlabsxyz/aptos-core#272
Summary
This PR integrates the new bytecode verification API endpoint into the explorer UI. The explorer now queries the node's verification status and displays source code with appropriate warnings. Source code is always shown (if available), with warnings displayed when verification fails, is disabled, or unavailable.
Changes
Core Features
useGetModuleVerificationStatusto query node verification statusverified: true(matching source/bytecode) ✓verified: false(SUSPICIOUS - bytecode mismatch)Implementation Details
API Client (
src/api/client.ts):SERVICE_UNAVAILABLEandCOMPILATION_ERRORerror typesgetModuleVerificationStatusfunctionModuleVerificationStatusResponseinterfaceReact Hook (
src/api/hooks/useGetModuleVerificationStatus.ts): New fileCode Display Component (
src/pages/Account/Components/CodeSnippet.tsx):verified: false) - mismatched source/bytecode (SUSPICIOUS)Module Views:
src/pages/Account/Tabs/ModulesTab/ViewCode.tsx: Passes address and moduleName to Code componentsrc/pages/Account/Tabs/ModulesTab/Contract.tsx: Passes address and moduleName to Code componentConstants (
src/constants.tsx):Testing
Manual testing was performed using the test setup at analysis-explorer-vulnerability on local devnet: