@ -3,10 +3,8 @@ const { toHexPaddedString, formatMemory } = util
import { helpers } from '@remix-project/remix-lib'
const { normalizeHexAddress } = helpers . ui
import { ConsoleLogs , hash } from '@remix-project/remix-lib'
import BN from 'bn.js'
import { toChecksumAddress , bufferToHex , Address , toBuffer } from '@ethereumjs/util'
import utils from 'web3-utils'
import { toBN } from 'web3-utils-legacy'
import utils , { toBigInt } from 'web3-utils'
import { ethers } from 'ethers'
import { VMContext } from './vm-context'
import type { StateManager } from '@ethereumjs/statemanager'
@ -84,7 +82,7 @@ export class VmProxy {
this . fromDecimal = ( . . . args ) = > utils . fromDecimal . apply ( this , args )
this . fromWei = ( . . . args ) = > utils . fromWei . apply ( this , args )
this . toWei = ( . . . args ) = > utils . toWei . apply ( this , args )
this . toBigNumber = ( . . . args ) = > toBN . apply ( this , args )
this . toBigNumber = ( . . . args ) = > utils . toBigInt . apply ( this , args )
this . isAddress = ( . . . args ) = > utils . isAddress . apply ( this , args )
this . utils = utils
this . txsMapBlock = { }
@ -427,10 +425,10 @@ export class VmProxy {
getSha3Input ( stack , memory ) {
const memoryStart = toHexPaddedString ( stack [ stack . length - 1 ] )
const memoryLength = toHexPaddedString ( stack [ stack . length - 2 ] )
const memStartDec = ( new BN ( memoryStart . replace ( '0x' , '' ) , 16 ) ) . toString ( 10 )
const memStartDec = toBigInt ( memoryStart ) . toString ( 10 )
const memoryStartInt = parseInt ( memStartDec ) * 2
const memLengthDec = ( new BN ( memoryLength . replace ( '0x' , '' ) , 16 ) . toString ( 10 ) )
const memoryLengthInt = parseInt ( memLengthDec ) * 2
const memLengthDec = toBigInt ( memoryLength ) . toString ( 10 )
const memoryLengthInt = parseInt ( memLengthDec . toString ( ) ) * 2
let i = Math . floor ( memoryStartInt / 32 )
const maxIndex = Math . floor ( memoryLengthInt / 32 ) + i