diff --git a/libs/remix-lib/src/hash.ts b/libs/remix-lib/src/hash.ts index 4b5fec18cc..b7d56237b1 100644 --- a/libs/remix-lib/src/hash.ts +++ b/libs/remix-lib/src/hash.ts @@ -1,6 +1,6 @@ import { keccak224, keccak384, keccak256 as k256, keccak512 } from 'ethereum-cryptography/keccak' const createHash = require('create-hash') -import * as rlp from 'rlp' +import { encode, Input } from 'rlp' import { toBuffer, setLengthLeft, isHexString } from '@ethereumjs/util' /** @@ -157,8 +157,8 @@ export const ripemd160FromArray = function(a: number[], padded: boolean): Buffer * Creates SHA-3 hash of the RLP encoded version of the input. * @param a The input data */ -export const rlphash = function(a: rlp.Input): Buffer { - return keccak(rlp.encode(a)) +export const rlphash = function(a: Input): Buffer { + return keccak(encode(a)) } /** diff --git a/libs/remix-simulator/src/vm-context.ts b/libs/remix-simulator/src/vm-context.ts index d3b4842fce..4bd9bb2481 100644 --- a/libs/remix-simulator/src/vm-context.ts +++ b/libs/remix-simulator/src/vm-context.ts @@ -2,7 +2,7 @@ 'use strict' import { hash } from '@remix-project/remix-lib' import { bufferToHex } from '@ethereumjs/util' -import rlp from 'rlp' +import { decode } from 'rlp' import { execution } from '@remix-project/remix-lib' const { LogsManager } = execution import { VmProxy } from './VmProxy' @@ -66,7 +66,7 @@ class StateManagerCommonStorageDump extends DefaultStateManager { const stream = trie.createReadStream() stream.on('data', (val) => { - const value = rlp.decode(val.value) + const value = decode(val.value) storage['0x' + val.key.toString('hex')] = { key: this.keyHashes[val.key.toString('hex')], value: '0x' + value.toString('hex')