Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
cast to ejs address instead of any
Browse files Browse the repository at this point in the history
  • Loading branch information
MicaiahReid committed Sep 15, 2022
1 parent fdcfd0b commit 27cd6b7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/chains/ethereum/ethereum/src/helpers/run-call.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { RuntimeBlock } from "@ganache/ethereum-block";
import { Quantity, Data, hasOwn, keccak, BUFFER_EMPTY } from "@ganache/utils";
import { Quantity, Data, hasOwn, keccak } from "@ganache/utils";
import { Address } from "@ganache/ethereum-address";
import { Message } from "@ethereumjs/evm";
import { VM } from "@ethereumjs/vm";
import { KECCAK256_NULL } from "@ethereumjs/util";
import { GanacheTrie } from "./trie";
import type { Address as EthereumJsAddress } from "@ethereumjs/util";

export type SimulationTransaction = {
/**
Expand Down Expand Up @@ -66,11 +66,11 @@ export function runCall(
transaction: SimulationTransaction,
gasLeft: bigint
) {
const caller = { buf: transaction.from.toBuffer() } as any;
const caller = { buf: transaction.from.toBuffer() } as EthereumJsAddress;
const to =
transaction.to == null
? undefined
: ({ buf: transaction.to.toBuffer() } as any);
: ({ buf: transaction.to.toBuffer() } as EthereumJsAddress);
const value = transaction.value == null ? 0n : transaction.value.toBigInt();

vm.evm.runCall({
Expand Down Expand Up @@ -126,7 +126,9 @@ export async function applySimulationOverrides(
if (!hasOwn(overrides, address)) continue;
const { balance, nonce, code, state, stateDiff } = overrides[address];

const vmAddr = { buf: Address.from(address).toBuffer() } as any;
const vmAddr = {
buf: Address.from(address).toBuffer()
} as EthereumJsAddress;
// group together overrides that update the account
if (nonce != null || balance != null || code != null) {
const account = await eei.getAccount(vmAddr);
Expand Down

0 comments on commit 27cd6b7

Please sign in to comment.