@nomicfoundation/edr 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Cargo.toml CHANGED
@@ -16,10 +16,9 @@ itertools = { version = "0.12.0", default-features = false }
16
16
  indexmap = { version = "2" }
17
17
  k256 = { version = "0.13.1", default-features = false, features = ["arithmetic", "ecdsa", "pkcs8", "precomputed-tables", "std"] }
18
18
  log = { version = "0.4.20", default-features = false }
19
- # when napi is pinned, be sure to pin napi-derive to the same version
20
19
  # The `async` feature ensures that a tokio runtime is available
21
- napi = { version = "2.16.0", default-features = false, features = ["async", "error_anyhow", "napi8", "serde-json"] }
22
- napi-derive = "2.16.0"
20
+ napi = { version = "2.16.11", default-features = false, features = ["async", "error_anyhow", "napi8", "serde-json"] }
21
+ napi-derive = "2.16.11"
23
22
  edr_defaults = { version = "0.3.5", path = "../edr_defaults" }
24
23
  edr_evm = { version = "0.3.5", path = "../edr_evm", features = ["tracing"]}
25
24
  edr_eth = { version = "0.3.5", path = "../edr_eth" }
package/index.d.ts CHANGED
@@ -346,8 +346,8 @@ export interface SubscriptionEvent {
346
346
  filterId: bigint
347
347
  result: any
348
348
  }
349
- export function createModelsAndDecodeBytecodes(solcVersion: string, compilerInput: any, compilerOutput: any): Array<BytecodeWrapper>
350
- export function linkHexStringBytecode(code: string, address: string, position: number): string
349
+ export declare function createModelsAndDecodeBytecodes(solcVersion: string, compilerInput: any, compilerOutput: any): Array<BytecodeWrapper>
350
+ export declare function linkHexStringBytecode(code: string, address: string, position: number): string
351
351
  export const enum ContractFunctionType {
352
352
  CONSTRUCTOR = 0,
353
353
  FUNCTION = 1,
@@ -357,8 +357,8 @@ export const enum ContractFunctionType {
357
357
  MODIFIER = 5,
358
358
  FREE_FUNCTION = 6
359
359
  }
360
- export function printMessageTrace(trace: PrecompileMessageTrace | CallMessageTrace | CreateMessageTrace, depth?: number | undefined | null): void
361
- export function printStackTrace(trace: SolidityStackTrace): void
360
+ export declare function printMessageTrace(trace: PrecompileMessageTrace | CallMessageTrace | CreateMessageTrace, depth?: number | undefined | null): void
361
+ export declare function printStackTrace(trace: SolidityStackTrace): void
362
362
  /** Represents the exit code of the EVM. */
363
363
  export const enum ExitCode {
364
364
  /** Execution was successful. */
@@ -450,7 +450,7 @@ export const enum StackTraceEntryType {
450
450
  INTERNAL_FUNCTION_CALLSTACK_ENTRY = 22,
451
451
  CONTRACT_CALL_RUN_OUT_OF_GAS_ERROR = 23
452
452
  }
453
- export function stackTraceEntryTypeToString(val: StackTraceEntryType): string
453
+ export declare function stackTraceEntryTypeToString(val: StackTraceEntryType): string
454
454
  export const FALLBACK_FUNCTION_NAME: string
455
455
  export const RECEIVE_FUNCTION_NAME: string
456
456
  export const CONSTRUCTOR_FUNCTION_NAME: string
@@ -582,7 +582,7 @@ export interface ContractAndFunctionName {
582
582
  contractName: string
583
583
  functionName: string | undefined
584
584
  }
585
- export function initializeVmTraceDecoder(vmTraceDecoder: VmTraceDecoder, tracingConfig: any): void
585
+ export declare function initializeVmTraceDecoder(vmTraceDecoder: VmTraceDecoder, tracingConfig: any): void
586
586
  export interface TracingMessage {
587
587
  /** Sender address */
588
588
  readonly caller: Buffer
@@ -636,12 +636,12 @@ export interface Withdrawal {
636
636
  /** The value contained in withdrawal */
637
637
  amount: bigint
638
638
  }
639
- export class EdrContext {
639
+ export declare class EdrContext {
640
640
  /**Creates a new [`EdrContext`] instance. Should only be called once! */
641
641
  constructor()
642
642
  }
643
643
  /** A JSON-RPC provider for Ethereum. */
644
- export class Provider {
644
+ export declare class Provider {
645
645
  /**Constructs a new provider with the provided configuration. */
646
646
  static withConfig(context: EdrContext, config: ProviderConfig, loggerConfig: LoggerConfig, subscriberCallback: (event: SubscriptionEvent) => void): Promise<Provider>
647
647
  /**Handles a JSON-RPC request and returns a JSON-RPC response. */
@@ -655,7 +655,7 @@ export class Provider {
655
655
  */
656
656
  setVerboseTracing(verboseTracing: boolean): void
657
657
  }
658
- export class Response {
658
+ export declare class Response {
659
659
  /** Returns the response data as a JSON string or a JSON object. */
660
660
  get data(): string | any
661
661
  get solidityTrace(): RawTrace | null
@@ -665,13 +665,13 @@ export class Response {
665
665
  * Opaque handle to the `Bytecode` struct.
666
666
  * Only used on the JS side by the `VmTraceDecoder` class.
667
667
  */
668
- export class BytecodeWrapper { }
669
- export class Exit {
668
+ export declare class BytecodeWrapper { }
669
+ export declare class Exit {
670
670
  get kind(): ExitCode
671
671
  isError(): boolean
672
672
  getReason(): string
673
673
  }
674
- export class ReturnData {
674
+ export declare class ReturnData {
675
675
  readonly value: Uint8Array
676
676
  constructor(value: Uint8Array)
677
677
  isEmpty(): boolean
@@ -680,12 +680,12 @@ export class ReturnData {
680
680
  decodeError(): string
681
681
  decodePanic(): bigint
682
682
  }
683
- export class SolidityTracer {
683
+ export declare class SolidityTracer {
684
684
 
685
685
  constructor()
686
686
  getStackTrace(trace: PrecompileMessageTrace | CallMessageTrace | CreateMessageTrace): SolidityStackTrace
687
687
  }
688
- export class VmTraceDecoder {
688
+ export declare class VmTraceDecoder {
689
689
  constructor()
690
690
  addBytecode(bytecode: BytecodeWrapper): void
691
691
  tryToDecodeMessageTrace(messageTrace: PrecompileMessageTrace | CallMessageTrace | CreateMessageTrace): PrecompileMessageTrace | CallMessageTrace | CreateMessageTrace
@@ -693,13 +693,13 @@ export class VmTraceDecoder {
693
693
  }
694
694
  export type VMTracer = VmTracer
695
695
  /** N-API bindings for the Rust port of `VMTracer` from Hardhat. */
696
- export class VmTracer {
696
+ export declare class VmTracer {
697
697
  constructor()
698
698
  /** Observes a trace, collecting information about the execution of the EVM. */
699
699
  observe(trace: RawTrace): void
700
700
  getLastTopLevelMessageTrace(): PrecompileMessageTrace | CallMessageTrace | CreateMessageTrace | undefined
701
701
  getLastError(): Error | undefined
702
702
  }
703
- export class RawTrace {
703
+ export declare class RawTrace {
704
704
  trace(): Array<TracingMessage | TracingStep | TracingMessageResult>
705
705
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@nomicfoundation/edr",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "devDependencies": {
5
- "@napi-rs/cli": "^2.18.3",
5
+ "@napi-rs/cli": "^2.18.4",
6
6
  "@types/chai": "^4.2.0",
7
7
  "@types/chai-as-promised": "^7.1.8",
8
8
  "@types/mocha": ">=9.1.0",
@@ -52,13 +52,13 @@
52
52
  "repository": "NomicFoundation/edr.git",
53
53
  "types": "index.d.ts",
54
54
  "dependencies": {
55
- "@nomicfoundation/edr-darwin-arm64": "0.6.0",
56
- "@nomicfoundation/edr-darwin-x64": "0.6.0",
57
- "@nomicfoundation/edr-linux-arm64-gnu": "0.6.0",
58
- "@nomicfoundation/edr-linux-arm64-musl": "0.6.0",
59
- "@nomicfoundation/edr-linux-x64-gnu": "0.6.0",
60
- "@nomicfoundation/edr-linux-x64-musl": "0.6.0",
61
- "@nomicfoundation/edr-win32-x64-msvc": "0.6.0"
55
+ "@nomicfoundation/edr-darwin-arm64": "0.6.2",
56
+ "@nomicfoundation/edr-darwin-x64": "0.6.2",
57
+ "@nomicfoundation/edr-linux-arm64-gnu": "0.6.2",
58
+ "@nomicfoundation/edr-linux-arm64-musl": "0.6.2",
59
+ "@nomicfoundation/edr-linux-x64-gnu": "0.6.2",
60
+ "@nomicfoundation/edr-linux-x64-musl": "0.6.2",
61
+ "@nomicfoundation/edr-win32-x64-msvc": "0.6.2"
62
62
  },
63
63
  "scripts": {
64
64
  "artifacts": "napi artifacts",
@@ -955,8 +955,14 @@ impl ErrorInferrer {
955
955
  return Ok(entry);
956
956
  }
957
957
 
958
+ // This function is only called after we jumped into the initial function in
959
+ // call traces, so there should always be at least a function jumpdest.
958
960
  let trace = match trace {
959
- Either::A(_call) => unreachable!("This shouldn't happen: a call trace has no functionJumpdest but has already jumped into a function"),
961
+ Either::A(_call) => return Err(
962
+ napi::Error::new(
963
+ napi::Status::GenericFailure,
964
+ "This shouldn't happen: a call trace has no functionJumpdest but has already jumped into a function"
965
+ )),
960
966
  Either::B(create) => create,
961
967
  };
962
968
 
@@ -1167,7 +1173,7 @@ impl ErrorInferrer {
1167
1173
  _ => return Ok(false),
1168
1174
  };
1169
1175
 
1170
- let inst = subtrace_bytecode.get_instruction(step.pc)?;
1176
+ let inst = bytecode.get_instruction(step.pc)?;
1171
1177
 
1172
1178
  // All the remaining locations should be valid, as they are part of the inline
1173
1179
  // asm