# ContractInterfaceMismatchError

> For the complete documentation index, see [llms.txt](https://docs.midnight.network/llms.txt)

[**@midnight-ntwrk/compact-runtime v0.19.0**](https://docs.midnight.network/api-reference/compact-runtime.md)

***

[@midnight-ntwrk/compact-runtime](https://docs.midnight.network/api-reference/compact-runtime/globals.md) / ContractInterfaceMismatchError

# Class: ContractInterfaceMismatchError

Thrown when a cross-contract call targets a contract whose deployed verifier key for the called circuit does not match the verifier key of the implementation the caller was compiled against. Under the current model every `contract T` interface resolves to exactly one implementation (its `T.compact`), and the caller's compiled bundle records that implementation's verifier-key fingerprint (`expectedVk`). A mismatch means the address passed for the `T` argument points at a different contract than the one the caller was linked to.

## Extends[​](#extends "Direct link to Extends")

* [`CompactError`](https://docs.midnight.network/api-reference/compact-runtime/classes/CompactError.md)

## Constructors[​](#constructors "Direct link to Constructors")

### Constructor[​](#constructor "Direct link to Constructor")

```
new ContractInterfaceMismatchError(

   calleeAddress, 

   circuitId, 

   expectedVerifierKeyHash, 

   actualVerifierKeyHash): ContractInterfaceMismatchError;
```

#### Parameters[​](#parameters "Direct link to Parameters")

##### calleeAddress[​](#calleeaddress "Direct link to calleeAddress")

`string`

##### circuitId[​](#circuitid "Direct link to circuitId")

`string`

##### expectedVerifierKeyHash[​](#expectedverifierkeyhash "Direct link to expectedVerifierKeyHash")

`string`

##### actualVerifierKeyHash[​](#actualverifierkeyhash "Direct link to actualVerifierKeyHash")

`string`

#### Returns[​](#returns "Direct link to Returns")

`ContractInterfaceMismatchError`

#### Overrides[​](#overrides "Direct link to Overrides")

[`CompactError`](https://docs.midnight.network/api-reference/compact-runtime/classes/CompactError.md).[`constructor`](https://docs.midnight.network/api-reference/compact-runtime/classes/CompactError.md#constructor)

## Properties[​](#properties "Direct link to Properties")

### actualVerifierKeyHash[​](#actualverifierkeyhash-1 "Direct link to actualVerifierKeyHash")

```
readonly actualVerifierKeyHash: string;
```

***

### calleeAddress[​](#calleeaddress-1 "Direct link to calleeAddress")

```
readonly calleeAddress: string;
```

***

### circuitId[​](#circuitid-1 "Direct link to circuitId")

```
readonly circuitId: string;
```

***

### expectedVerifierKeyHash[​](#expectedverifierkeyhash-1 "Direct link to expectedVerifierKeyHash")

```
readonly expectedVerifierKeyHash: string;
```

***

### isCompactError[​](#iscompacterror "Direct link to isCompactError")

```
readonly isCompactError: true = true;
```

#### Inherited from[​](#inherited-from "Direct link to Inherited from")

[`CompactError`](https://docs.midnight.network/api-reference/compact-runtime/classes/CompactError.md).[`isCompactError`](https://docs.midnight.network/api-reference/compact-runtime/classes/CompactError.md#iscompacterror)

***

### message[​](#message "Direct link to message")

```
message: string;
```

#### Inherited from[​](#inherited-from-1 "Direct link to Inherited from")

[`CompactError`](https://docs.midnight.network/api-reference/compact-runtime/classes/CompactError.md).[`message`](https://docs.midnight.network/api-reference/compact-runtime/classes/CompactError.md#message)

***

### name[​](#name "Direct link to name")

```
name: string;
```

#### Inherited from[​](#inherited-from-2 "Direct link to Inherited from")

[`CompactError`](https://docs.midnight.network/api-reference/compact-runtime/classes/CompactError.md).[`name`](https://docs.midnight.network/api-reference/compact-runtime/classes/CompactError.md#name)

***

### stack?[​](#stack "Direct link to stack?")

```
optional stack: string;
```

#### Inherited from[​](#inherited-from-3 "Direct link to Inherited from")

[`CompactError`](https://docs.midnight.network/api-reference/compact-runtime/classes/CompactError.md).[`stack`](https://docs.midnight.network/api-reference/compact-runtime/classes/CompactError.md#stack)

***

### stackTraceLimit[​](#stacktracelimit "Direct link to stackTraceLimit")

```
static stackTraceLimit: number;
```

The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`).

The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured *after* the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

#### Inherited from[​](#inherited-from-4 "Direct link to Inherited from")

[`CompactError`](https://docs.midnight.network/api-reference/compact-runtime/classes/CompactError.md).[`stackTraceLimit`](https://docs.midnight.network/api-reference/compact-runtime/classes/CompactError.md#stacktracelimit)

## Methods[​](#methods "Direct link to Methods")

### captureStackTrace()[​](#capturestacktrace "Direct link to captureStackTrace()")

```
static captureStackTrace(targetObject, constructorOpt?): void;
```

Creates a `.stack` property on `targetObject`, which when accessed returns a string representing the location in the code at which `Error.captureStackTrace()` was called.

```
const myObject = {};

Error.captureStackTrace(myObject);

myObject.stack;  // Similar to `new Error().stack`
```

The first line of the trace will be prefixed with `${myObject.name}: ${myObject.message}`.

The optional `constructorOpt` argument accepts a function. If given, all frames above `constructorOpt`, including `constructorOpt`, will be omitted from the generated stack trace.

The `constructorOpt` argument is useful for hiding implementation details of error generation from the user. For instance:

```
function a() {

  b();

}



function b() {

  c();

}



function c() {

  // Create an error without stack trace to avoid calculating the stack trace twice.

  const { stackTraceLimit } = Error;

  Error.stackTraceLimit = 0;

  const error = new Error();

  Error.stackTraceLimit = stackTraceLimit;



  // Capture the stack trace above function b

  Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace

  throw error;

}



a();
```

#### Parameters[​](#parameters-1 "Direct link to Parameters")

##### targetObject[​](#targetobject "Direct link to targetObject")

`object`

##### constructorOpt?[​](#constructoropt "Direct link to constructorOpt?")

`Function`

#### Returns[​](#returns-1 "Direct link to Returns")

`void`

#### Inherited from[​](#inherited-from-5 "Direct link to Inherited from")

[`CompactError`](https://docs.midnight.network/api-reference/compact-runtime/classes/CompactError.md).[`captureStackTrace`](https://docs.midnight.network/api-reference/compact-runtime/classes/CompactError.md#capturestacktrace)

***

### prepareStackTrace()[​](#preparestacktrace "Direct link to prepareStackTrace()")

```
static prepareStackTrace(err, stackTraces): any;
```

#### Parameters[​](#parameters-2 "Direct link to Parameters")

##### err[​](#err "Direct link to err")

`Error`

##### stackTraces[​](#stacktraces "Direct link to stackTraces")

`CallSite`\[]

#### Returns[​](#returns-2 "Direct link to Returns")

`any`

#### See[​](#see "Direct link to See")

<https://v8.dev/docs/stack-trace-api#customizing-stack-traces>

#### Inherited from[​](#inherited-from-6 "Direct link to Inherited from")

[`CompactError`](https://docs.midnight.network/api-reference/compact-runtime/classes/CompactError.md).[`prepareStackTrace`](https://docs.midnight.network/api-reference/compact-runtime/classes/CompactError.md#preparestacktrace)
