@nomicfoundation/edr
Advanced tools
Comparing version 0.5.2 to 0.6.0
278
index.d.ts
@@ -152,2 +152,3 @@ /* tslint:disable */ | ||
decodeConsoleLogInputsCallback: (inputs: Buffer[]) => string[] | ||
/** Used to resolve the contract and function name when logging. */ | ||
getContractAndFunctionNameCallback: (code: Buffer, calldata?: Buffer) => ContractAndFunctionName | ||
@@ -349,2 +350,239 @@ printLineCallback: (message: string, replace: boolean) => void | ||
} | ||
export function createModelsAndDecodeBytecodes(solcVersion: string, compilerInput: any, compilerOutput: any): Array<BytecodeWrapper> | ||
export function linkHexStringBytecode(code: string, address: string, position: number): string | ||
export const enum ContractFunctionType { | ||
CONSTRUCTOR = 0, | ||
FUNCTION = 1, | ||
FALLBACK = 2, | ||
RECEIVE = 3, | ||
GETTER = 4, | ||
MODIFIER = 5, | ||
FREE_FUNCTION = 6 | ||
} | ||
export function printMessageTrace(trace: PrecompileMessageTrace | CallMessageTrace | CreateMessageTrace, depth?: number | undefined | null): void | ||
export function printStackTrace(trace: SolidityStackTrace): void | ||
/** Represents the exit code of the EVM. */ | ||
export const enum ExitCode { | ||
/** Execution was successful. */ | ||
SUCCESS = 0, | ||
/** Execution was reverted. */ | ||
REVERT = 1, | ||
/** Execution ran out of gas. */ | ||
OUT_OF_GAS = 2, | ||
/** Execution encountered an internal error. */ | ||
INTERNAL_ERROR = 3, | ||
/** Execution encountered an invalid opcode. */ | ||
INVALID_OPCODE = 4, | ||
/** Execution encountered a stack underflow. */ | ||
STACK_UNDERFLOW = 5, | ||
/** Create init code size exceeds limit (runtime). */ | ||
CODESIZE_EXCEEDS_MAXIMUM = 6, | ||
/** Create collision. */ | ||
CREATE_COLLISION = 7 | ||
} | ||
export interface EvmStep { | ||
pc: number | ||
} | ||
export interface PrecompileMessageTrace { | ||
value: bigint | ||
returnData: Uint8Array | ||
exit: Exit | ||
gasUsed: bigint | ||
depth: number | ||
precompile: number | ||
calldata: Uint8Array | ||
} | ||
export interface CreateMessageTrace { | ||
value: bigint | ||
returnData: Uint8Array | ||
exit: Exit | ||
gasUsed: bigint | ||
depth: number | ||
code: Uint8Array | ||
steps: Array<EvmStep | PrecompileMessageTrace | CallMessageTrace | CreateMessageTrace> | ||
/** | ||
* Reference to the resolved `Bytecode` EDR data. | ||
* Only used on the JS side by the `VmTraceDecoder` class. | ||
*/ | ||
bytecode?: BytecodeWrapper | ||
numberOfSubtraces: number | ||
deployedContract?: Uint8Array | undefined | ||
} | ||
export interface CallMessageTrace { | ||
value: bigint | ||
returnData: Uint8Array | ||
exit: Exit | ||
gasUsed: bigint | ||
depth: number | ||
code: Uint8Array | ||
steps: Array<EvmStep | PrecompileMessageTrace | CallMessageTrace | CreateMessageTrace> | ||
/** | ||
* Reference to the resolved `Bytecode` EDR data. | ||
* Only used on the JS side by the `VmTraceDecoder` class. | ||
*/ | ||
bytecode?: BytecodeWrapper | ||
numberOfSubtraces: number | ||
calldata: Uint8Array | ||
address: Uint8Array | ||
codeAddress: Uint8Array | ||
} | ||
export const enum StackTraceEntryType { | ||
CALLSTACK_ENTRY = 0, | ||
UNRECOGNIZED_CREATE_CALLSTACK_ENTRY = 1, | ||
UNRECOGNIZED_CONTRACT_CALLSTACK_ENTRY = 2, | ||
PRECOMPILE_ERROR = 3, | ||
REVERT_ERROR = 4, | ||
PANIC_ERROR = 5, | ||
CUSTOM_ERROR = 6, | ||
FUNCTION_NOT_PAYABLE_ERROR = 7, | ||
INVALID_PARAMS_ERROR = 8, | ||
FALLBACK_NOT_PAYABLE_ERROR = 9, | ||
FALLBACK_NOT_PAYABLE_AND_NO_RECEIVE_ERROR = 10, | ||
UNRECOGNIZED_FUNCTION_WITHOUT_FALLBACK_ERROR = 11, | ||
MISSING_FALLBACK_OR_RECEIVE_ERROR = 12, | ||
RETURNDATA_SIZE_ERROR = 13, | ||
NONCONTRACT_ACCOUNT_CALLED_ERROR = 14, | ||
CALL_FAILED_ERROR = 15, | ||
DIRECT_LIBRARY_CALL_ERROR = 16, | ||
UNRECOGNIZED_CREATE_ERROR = 17, | ||
UNRECOGNIZED_CONTRACT_ERROR = 18, | ||
OTHER_EXECUTION_ERROR = 19, | ||
UNMAPPED_SOLC_0_6_3_REVERT_ERROR = 20, | ||
CONTRACT_TOO_LARGE_ERROR = 21, | ||
INTERNAL_FUNCTION_CALLSTACK_ENTRY = 22, | ||
CONTRACT_CALL_RUN_OUT_OF_GAS_ERROR = 23 | ||
} | ||
export function stackTraceEntryTypeToString(val: StackTraceEntryType): string | ||
export const FALLBACK_FUNCTION_NAME: string | ||
export const RECEIVE_FUNCTION_NAME: string | ||
export const CONSTRUCTOR_FUNCTION_NAME: string | ||
export const UNRECOGNIZED_FUNCTION_NAME: string | ||
export const UNKNOWN_FUNCTION_NAME: string | ||
export const PRECOMPILE_FUNCTION_NAME: string | ||
export const UNRECOGNIZED_CONTRACT_NAME: string | ||
export interface SourceReference { | ||
sourceName: string | ||
sourceContent: string | ||
contract?: string | ||
function?: string | ||
line: number | ||
range: Array<number> | ||
} | ||
export interface CallstackEntryStackTraceEntry { | ||
type: StackTraceEntryType.CALLSTACK_ENTRY | ||
sourceReference: SourceReference | ||
functionType: ContractFunctionType | ||
} | ||
export interface UnrecognizedCreateCallstackEntryStackTraceEntry { | ||
type: StackTraceEntryType.UNRECOGNIZED_CREATE_CALLSTACK_ENTRY | ||
sourceReference?: undefined | ||
} | ||
export interface UnrecognizedContractCallstackEntryStackTraceEntry { | ||
type: StackTraceEntryType.UNRECOGNIZED_CONTRACT_CALLSTACK_ENTRY | ||
address: Uint8Array | ||
sourceReference?: undefined | ||
} | ||
export interface PrecompileErrorStackTraceEntry { | ||
type: StackTraceEntryType.PRECOMPILE_ERROR | ||
precompile: number | ||
sourceReference?: undefined | ||
} | ||
export interface RevertErrorStackTraceEntry { | ||
type: StackTraceEntryType.REVERT_ERROR | ||
returnData: Uint8Array | ||
sourceReference: SourceReference | ||
isInvalidOpcodeError: boolean | ||
} | ||
export interface PanicErrorStackTraceEntry { | ||
type: StackTraceEntryType.PANIC_ERROR | ||
errorCode: bigint | ||
sourceReference?: SourceReference | ||
} | ||
export interface CustomErrorStackTraceEntry { | ||
type: StackTraceEntryType.CUSTOM_ERROR | ||
message: string | ||
sourceReference: SourceReference | ||
} | ||
export interface FunctionNotPayableErrorStackTraceEntry { | ||
type: StackTraceEntryType.FUNCTION_NOT_PAYABLE_ERROR | ||
value: bigint | ||
sourceReference: SourceReference | ||
} | ||
export interface InvalidParamsErrorStackTraceEntry { | ||
type: StackTraceEntryType.INVALID_PARAMS_ERROR | ||
sourceReference: SourceReference | ||
} | ||
export interface FallbackNotPayableErrorStackTraceEntry { | ||
type: StackTraceEntryType.FALLBACK_NOT_PAYABLE_ERROR | ||
value: bigint | ||
sourceReference: SourceReference | ||
} | ||
export interface FallbackNotPayableAndNoReceiveErrorStackTraceEntry { | ||
type: StackTraceEntryType.FALLBACK_NOT_PAYABLE_AND_NO_RECEIVE_ERROR | ||
value: bigint | ||
sourceReference: SourceReference | ||
} | ||
export interface UnrecognizedFunctionWithoutFallbackErrorStackTraceEntry { | ||
type: StackTraceEntryType.UNRECOGNIZED_FUNCTION_WITHOUT_FALLBACK_ERROR | ||
sourceReference: SourceReference | ||
} | ||
export interface MissingFallbackOrReceiveErrorStackTraceEntry { | ||
type: StackTraceEntryType.MISSING_FALLBACK_OR_RECEIVE_ERROR | ||
sourceReference: SourceReference | ||
} | ||
export interface ReturndataSizeErrorStackTraceEntry { | ||
type: StackTraceEntryType.RETURNDATA_SIZE_ERROR | ||
sourceReference: SourceReference | ||
} | ||
export interface NonContractAccountCalledErrorStackTraceEntry { | ||
type: StackTraceEntryType.NONCONTRACT_ACCOUNT_CALLED_ERROR | ||
sourceReference: SourceReference | ||
} | ||
export interface CallFailedErrorStackTraceEntry { | ||
type: StackTraceEntryType.CALL_FAILED_ERROR | ||
sourceReference: SourceReference | ||
} | ||
export interface DirectLibraryCallErrorStackTraceEntry { | ||
type: StackTraceEntryType.DIRECT_LIBRARY_CALL_ERROR | ||
sourceReference: SourceReference | ||
} | ||
export interface UnrecognizedCreateErrorStackTraceEntry { | ||
type: StackTraceEntryType.UNRECOGNIZED_CREATE_ERROR | ||
returnData: Uint8Array | ||
sourceReference?: undefined | ||
isInvalidOpcodeError: boolean | ||
} | ||
export interface UnrecognizedContractErrorStackTraceEntry { | ||
type: StackTraceEntryType.UNRECOGNIZED_CONTRACT_ERROR | ||
address: Uint8Array | ||
returnData: Uint8Array | ||
sourceReference?: undefined | ||
isInvalidOpcodeError: boolean | ||
} | ||
export interface OtherExecutionErrorStackTraceEntry { | ||
type: StackTraceEntryType.OTHER_EXECUTION_ERROR | ||
sourceReference?: SourceReference | ||
} | ||
export interface UnmappedSolc063RevertErrorStackTraceEntry { | ||
type: StackTraceEntryType.UNMAPPED_SOLC_0_6_3_REVERT_ERROR | ||
sourceReference?: SourceReference | ||
} | ||
export interface ContractTooLargeErrorStackTraceEntry { | ||
type: StackTraceEntryType.CONTRACT_TOO_LARGE_ERROR | ||
sourceReference?: SourceReference | ||
} | ||
export interface InternalFunctionCallStackEntry { | ||
type: StackTraceEntryType.INTERNAL_FUNCTION_CALLSTACK_ENTRY | ||
pc: number | ||
sourceReference: SourceReference | ||
} | ||
export interface ContractCallRunOutOfGasError { | ||
type: StackTraceEntryType.CONTRACT_CALL_RUN_OUT_OF_GAS_ERROR | ||
sourceReference?: SourceReference | ||
} | ||
export interface ContractAndFunctionName { | ||
contractName: string | ||
functionName: string | undefined | ||
} | ||
export function initializeVmTraceDecoder(vmTraceDecoder: VmTraceDecoder, tracingConfig: any): void | ||
export interface TracingMessage { | ||
@@ -425,8 +663,46 @@ /** Sender address */ | ||
get data(): string | any | ||
get json(): string | any | ||
get solidityTrace(): RawTrace | null | ||
get traces(): Array<RawTrace> | ||
} | ||
/** | ||
* Opaque handle to the `Bytecode` struct. | ||
* Only used on the JS side by the `VmTraceDecoder` class. | ||
*/ | ||
export class BytecodeWrapper { } | ||
export class Exit { | ||
get kind(): ExitCode | ||
isError(): boolean | ||
getReason(): string | ||
} | ||
export class ReturnData { | ||
readonly value: Uint8Array | ||
constructor(value: Uint8Array) | ||
isEmpty(): boolean | ||
isErrorReturnData(): boolean | ||
isPanicReturnData(): boolean | ||
decodeError(): string | ||
decodePanic(): bigint | ||
} | ||
export class SolidityTracer { | ||
constructor() | ||
getStackTrace(trace: PrecompileMessageTrace | CallMessageTrace | CreateMessageTrace): SolidityStackTrace | ||
} | ||
export class VmTraceDecoder { | ||
constructor() | ||
addBytecode(bytecode: BytecodeWrapper): void | ||
tryToDecodeMessageTrace(messageTrace: PrecompileMessageTrace | CallMessageTrace | CreateMessageTrace): PrecompileMessageTrace | CallMessageTrace | CreateMessageTrace | ||
getContractAndFunctionNamesForCall(code: Uint8Array, calldata: Uint8Array | undefined): ContractAndFunctionName | ||
} | ||
export type VMTracer = VmTracer | ||
/** N-API bindings for the Rust port of `VMTracer` from Hardhat. */ | ||
export class VmTracer { | ||
constructor() | ||
/** Observes a trace, collecting information about the execution of the EVM. */ | ||
observe(trace: RawTrace): void | ||
getLastTopLevelMessageTrace(): PrecompileMessageTrace | CallMessageTrace | CreateMessageTrace | undefined | ||
getLastError(): Error | undefined | ||
} | ||
export class RawTrace { | ||
trace(): Array<TracingMessage | TracingStep | TracingMessageResult> | ||
} |
24
index.js
@@ -313,3 +313,3 @@ /* tslint:disable */ | ||
const { SpecId, EdrContext, MineOrdering, Provider, Response, SuccessReason, ExceptionalHalt, RawTrace } = nativeBinding | ||
const { SpecId, EdrContext, MineOrdering, Provider, Response, SuccessReason, ExceptionalHalt, createModelsAndDecodeBytecodes, linkHexStringBytecode, BytecodeWrapper, ContractFunctionType, printMessageTrace, printStackTrace, Exit, ExitCode, ReturnData, StackTraceEntryType, stackTraceEntryTypeToString, FALLBACK_FUNCTION_NAME, RECEIVE_FUNCTION_NAME, CONSTRUCTOR_FUNCTION_NAME, UNRECOGNIZED_FUNCTION_NAME, UNKNOWN_FUNCTION_NAME, PRECOMPILE_FUNCTION_NAME, UNRECOGNIZED_CONTRACT_NAME, SolidityTracer, VmTraceDecoder, initializeVmTraceDecoder, VmTracer, RawTrace } = nativeBinding | ||
@@ -323,2 +323,24 @@ module.exports.SpecId = SpecId | ||
module.exports.ExceptionalHalt = ExceptionalHalt | ||
module.exports.createModelsAndDecodeBytecodes = createModelsAndDecodeBytecodes | ||
module.exports.linkHexStringBytecode = linkHexStringBytecode | ||
module.exports.BytecodeWrapper = BytecodeWrapper | ||
module.exports.ContractFunctionType = ContractFunctionType | ||
module.exports.printMessageTrace = printMessageTrace | ||
module.exports.printStackTrace = printStackTrace | ||
module.exports.Exit = Exit | ||
module.exports.ExitCode = ExitCode | ||
module.exports.ReturnData = ReturnData | ||
module.exports.StackTraceEntryType = StackTraceEntryType | ||
module.exports.stackTraceEntryTypeToString = stackTraceEntryTypeToString | ||
module.exports.FALLBACK_FUNCTION_NAME = FALLBACK_FUNCTION_NAME | ||
module.exports.RECEIVE_FUNCTION_NAME = RECEIVE_FUNCTION_NAME | ||
module.exports.CONSTRUCTOR_FUNCTION_NAME = CONSTRUCTOR_FUNCTION_NAME | ||
module.exports.UNRECOGNIZED_FUNCTION_NAME = UNRECOGNIZED_FUNCTION_NAME | ||
module.exports.UNKNOWN_FUNCTION_NAME = UNKNOWN_FUNCTION_NAME | ||
module.exports.PRECOMPILE_FUNCTION_NAME = PRECOMPILE_FUNCTION_NAME | ||
module.exports.UNRECOGNIZED_CONTRACT_NAME = UNRECOGNIZED_CONTRACT_NAME | ||
module.exports.SolidityTracer = SolidityTracer | ||
module.exports.VmTraceDecoder = VmTraceDecoder | ||
module.exports.initializeVmTraceDecoder = initializeVmTraceDecoder | ||
module.exports.VmTracer = VmTracer | ||
module.exports.RawTrace = RawTrace |
{ | ||
"name": "@nomicfoundation/edr", | ||
"version": "0.5.2", | ||
"main": "index.js", | ||
"types": "index.d.ts", | ||
"version": "0.6.0", | ||
"devDependencies": { | ||
"@napi-rs/cli": "^2.18.3", | ||
"@types/chai": "^4.2.0", | ||
"@types/chai-as-promised": "^7.1.8", | ||
"@types/mocha": ">=9.1.0", | ||
"@types/node": "^20.0.0", | ||
"@typescript-eslint/eslint-plugin": "5.61.0", | ||
"@typescript-eslint/parser": "5.61.0", | ||
"chai": "^4.3.6", | ||
"chai-as-promised": "^7.1.1", | ||
"eslint": "^8.44.0", | ||
"eslint-config-prettier": "9.1.0", | ||
"eslint-plugin-import": "2.27.5", | ||
"eslint-plugin-mocha": "10.4.1", | ||
"eslint-plugin-prettier": "5.2.1", | ||
"json-stream-stringify": "^3.1.4", | ||
"mocha": "^10.0.0", | ||
"prettier": "^3.2.5", | ||
"ts-node": "^10.8.0", | ||
"typescript": "~5.0.0" | ||
}, | ||
"engines": { | ||
"node": ">= 18" | ||
}, | ||
"files": [ | ||
@@ -13,6 +35,4 @@ "index.js", | ||
], | ||
"repository": { | ||
"url": "https://github.com/NomicFoundation/edr.git", | ||
"type": "git" | ||
}, | ||
"license": "MIT", | ||
"main": "index.js", | ||
"napi": { | ||
@@ -33,27 +53,12 @@ "name": "edr", | ||
}, | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@napi-rs/cli": "^2.18.1", | ||
"@types/chai": "^4.2.0", | ||
"@types/chai-as-promised": "^7.1.8", | ||
"@types/mocha": ">=9.1.0", | ||
"@types/node": "^18.0.0", | ||
"chai": "^4.3.6", | ||
"chai-as-promised": "^7.1.1", | ||
"json-stream-stringify": "^3.1.4", | ||
"mocha": "^10.0.0", | ||
"ts-node": "^10.8.0", | ||
"typescript": "~4.5.2" | ||
}, | ||
"engines": { | ||
"node": ">= 18" | ||
}, | ||
"repository": "NomicFoundation/edr.git", | ||
"types": "index.d.ts", | ||
"dependencies": { | ||
"@nomicfoundation/edr-darwin-arm64": "0.5.2", | ||
"@nomicfoundation/edr-darwin-x64": "0.5.2", | ||
"@nomicfoundation/edr-linux-arm64-gnu": "0.5.2", | ||
"@nomicfoundation/edr-linux-arm64-musl": "0.5.2", | ||
"@nomicfoundation/edr-linux-x64-gnu": "0.5.2", | ||
"@nomicfoundation/edr-linux-x64-musl": "0.5.2", | ||
"@nomicfoundation/edr-win32-x64-msvc": "0.5.2" | ||
"@nomicfoundation/edr-darwin-arm64": "0.6.0", | ||
"@nomicfoundation/edr-darwin-x64": "0.6.0", | ||
"@nomicfoundation/edr-linux-arm64-gnu": "0.6.0", | ||
"@nomicfoundation/edr-linux-arm64-musl": "0.6.0", | ||
"@nomicfoundation/edr-linux-x64-gnu": "0.6.0", | ||
"@nomicfoundation/edr-linux-x64-musl": "0.6.0", | ||
"@nomicfoundation/edr-win32-x64-msvc": "0.6.0" | ||
}, | ||
@@ -64,11 +69,15 @@ "scripts": { | ||
"build:debug": "napi build --platform", | ||
"build:scenarios": "napi build --platform --release --features scenarios", | ||
"build:tracing": "napi build --platform --release --features tracing", | ||
"build:scenarios": "napi build --platform --release --features scenarios", | ||
"universal": "napi universal", | ||
"version": "napi version", | ||
"clean": "rm -rf @nomicfoundation/edr.node", | ||
"eslint": "eslint 'test/**/*.ts'", | ||
"lint": "pnpm run prettier && pnpm run eslint", | ||
"lint:fix": "pnpm run prettier --write", | ||
"pretest": "pnpm build", | ||
"prettier": "prettier --check \"test/**.ts\"", | ||
"test": "pnpm tsc && node --max-old-space-size=8192 node_modules/mocha/bin/_mocha --recursive \"test/**/*.ts\"", | ||
"testNoBuild": "pnpm tsc && node --max-old-space-size=8192 node_modules/mocha/bin/_mocha --recursive \"test/**/*.ts\"", | ||
"clean": "rm -rf @nomicfoundation/edr.node" | ||
"universal": "napi universal", | ||
"version": "napi version" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
304093
37
1039
19
2
+ Added@nomicfoundation/edr-darwin-arm64@0.6.0(transitive)
+ Added@nomicfoundation/edr-darwin-x64@0.6.0(transitive)
+ Added@nomicfoundation/edr-linux-arm64-gnu@0.6.0(transitive)
+ Added@nomicfoundation/edr-linux-arm64-musl@0.6.0(transitive)
+ Added@nomicfoundation/edr-linux-x64-gnu@0.6.0(transitive)
+ Added@nomicfoundation/edr-linux-x64-musl@0.6.0(transitive)
+ Added@nomicfoundation/edr-win32-x64-msvc@0.6.0(transitive)
- Removed@nomicfoundation/edr-darwin-arm64@0.5.2(transitive)
- Removed@nomicfoundation/edr-darwin-x64@0.5.2(transitive)
- Removed@nomicfoundation/edr-linux-arm64-gnu@0.5.2(transitive)
- Removed@nomicfoundation/edr-linux-arm64-musl@0.5.2(transitive)
- Removed@nomicfoundation/edr-linux-x64-gnu@0.5.2(transitive)
- Removed@nomicfoundation/edr-linux-x64-musl@0.5.2(transitive)
- Removed@nomicfoundation/edr-win32-x64-msvc@0.5.2(transitive)