-
Notifications
You must be signed in to change notification settings - Fork 615
feat: compress debug symbols #1760
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
Changes from 2 commits
7214882
ea2ce05
119207c
ee469dc
c1384a3
7cc3ad7
c8c09c1
fea761b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| import { inflate } from 'pako'; | ||
|
|
||
| /** | ||
| * A named type. | ||
| */ | ||
|
|
@@ -202,9 +204,9 @@ export type DebugFileMap = Record< | |
| */ | ||
| export interface DebugMetadata { | ||
| /** | ||
| * The debug information for each function. | ||
| * The debug information, serialized as JSON. | ||
| */ | ||
| debugSymbols: DebugInfo[]; | ||
| debugSymbols: string[]; | ||
| /** | ||
| * The map of file ID to the source code and path of the file. | ||
| */ | ||
|
|
@@ -254,7 +256,9 @@ export interface FunctionDebugMetadata { | |
| export function getFunctionDebugMetadata(abi: ContractAbi, functionName: string): FunctionDebugMetadata | undefined { | ||
| const functionIndex = abi.functions.findIndex(f => f.name === functionName); | ||
| if (abi.debug && functionIndex !== -1) { | ||
| const debugSymbols = abi.debug.debugSymbols[functionIndex]; | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this only run if there's a need for debug data? (I ask as if so, the fact that json is somewhat inefficient doesn't matter much)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's run if you execute a function that you have stored debug metadata for (the idea is that only developers will use ABIs with debug metadata) and only for the function being executed
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we see that it hurts performance we can change it to a structure that parses it lazily when accessed but I don't see it being an issue for now |
||
| const debugSymbols = JSON.parse( | ||
| inflate(Buffer.from(abi.debug.debugSymbols[functionIndex], 'base64'), { to: 'string' }), | ||
| ); | ||
| const files = abi.debug.fileMap; | ||
| return { | ||
| debugSymbols, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.