fix ethereumjs-util dep

pull/3251/head
yann300 2 years ago
parent ab92335ecc
commit 055ca5a4f2
  1. 7
      apps/remix-ide/src/app/tabs/runTab/model/recorder.js
  2. 2
      apps/remix-ide/src/blockchain/blockchain.js
  3. 2
      apps/remix-ide/src/blockchain/providers/injected.js
  4. 2
      apps/remix-ide/src/blockchain/providers/node.js
  5. 3
      apps/remix-ide/src/blockchain/providers/vm.js
  6. 2
      apps/remix-ide/src/lib/helper.js
  7. 2
      libs/remix-analyzer/package.json
  8. 2
      libs/remix-astwalker/package.json
  9. 2
      libs/remix-core-plugin/src/lib/compiler-fetch-and-compile.ts
  10. 2
      libs/remix-debug/package.json
  11. 2
      libs/remix-debug/src/code/disassembler.ts
  12. 3
      libs/remix-debug/src/solidity-decoder/types/ArrayType.ts
  13. 2
      libs/remix-debug/src/solidity-decoder/types/DynamicByteArray.ts
  14. 6
      libs/remix-debug/src/solidity-decoder/types/Mapping.ts
  15. 3
      libs/remix-debug/src/solidity-decoder/types/util.ts
  16. 2
      libs/remix-debug/test/decoder/stateTests/mapping.ts
  17. 13
      libs/remix-debug/test/vmCall.ts
  18. 2
      libs/remix-lib/package.json
  19. 2
      libs/remix-lib/src/execution/txFormat.ts
  20. 2
      libs/remix-lib/src/execution/txListener.ts
  21. 3
      libs/remix-lib/src/execution/txRunnerVM.ts
  22. 3
      libs/remix-lib/src/execution/typeConversion.ts
  23. 206
      libs/remix-lib/src/hash.ts
  24. 2
      libs/remix-lib/src/helpers/txResultHelper.ts
  25. 3
      libs/remix-lib/src/index.ts
  26. 6
      libs/remix-lib/src/util.ts
  27. 3
      libs/remix-lib/test/txResultHelper.ts
  28. 2
      libs/remix-simulator/package.json
  29. 10
      libs/remix-simulator/src/VmProxy.ts
  30. 5
      libs/remix-simulator/src/methods/accounts.ts
  31. 4
      libs/remix-simulator/src/methods/transactions.ts
  32. 6
      libs/remix-simulator/src/vm-context.ts
  33. 2
      libs/remix-solidity/package.json
  34. 2
      libs/remix-tests/package.json
  35. 2
      libs/remix-ui/debugger-ui/src/lib/vm-debugger/global-variables.tsx
  36. 2
      libs/remix-ui/debugger-ui/src/utils/solidityTypeFormatter.ts
  37. 2
      libs/remix-ui/helper/src/lib/remix-ui-helper.ts
  38. 4
      libs/remix-ui/run-tab/src/lib/actions/events.ts
  39. 2
      libs/remix-ui/run-tab/src/lib/components/contractDropdownUI.tsx
  40. 4
      libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx
  41. 2
      libs/remix-ui/run-tab/src/lib/components/value.tsx
  42. 7
      libs/remix-ui/workspace/src/lib/actions/workspace.ts
  43. 1
      package.json

@ -1,6 +1,7 @@
var async = require('async')
var ethutil = require('ethereumjs-util')
var remixLib = require('@remix-project/remix-lib')
import { bufferToHex } from '@ethereumjs/util'
import { hash } from '@remix-project/remix-lib'
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../../.././../../package.json'
var EventManager = remixLib.EventManager
@ -42,7 +43,7 @@ class Recorder extends Plugin {
}
if (!to) {
var abi = payLoad.contractABI
var keccak = ethutil.bufferToHex(ethutil.keccakFromString(JSON.stringify(abi)))
var keccak = bufferToHex(hash.keccakFromString(JSON.stringify(abi)))
record.abi = keccak
record.contractName = payLoad.contractName
record.bytecode = payLoad.contractBytecode
@ -207,7 +208,7 @@ class Recorder extends Plugin {
// resolve the bytecode and ABI using the contract name, this ensure getting the last compiled one.
const data = await this.call('compilerArtefacts', 'getArtefactsByContractName', tx.record.contractName)
tx.record.bytecode = data.artefact.evm.bytecode.object
const updatedABIKeccak = ethutil.bufferToHex(ethutil.keccakFromString(JSON.stringify(data.artefact.abi)))
const updatedABIKeccak = bufferToHex(hash.keccakFromString(JSON.stringify(data.artefact.abi)))
abis[updatedABIKeccak] = data.artefact.abi
tx.record.abi = updatedABIKeccak
}

@ -2,7 +2,7 @@
import React from 'react' // eslint-disable-line
import Web3 from 'web3'
import { Plugin } from '@remixproject/engine'
import { toBuffer, addHexPrefix } from 'ethereumjs-util'
import { toBuffer, addHexPrefix } from '@ethereumjs/util'
import { EventEmitter } from 'events'
import { format } from 'util'
import { ExecutionContext } from './execution-context'

@ -1,5 +1,5 @@
const Web3 = require('web3')
const { hashPersonalMessage } = require('ethereumjs-util')
const { hashPersonalMessage } = require('@ethereumjs/util')
class InjectedProvider {
constructor (executionContext) {

@ -1,5 +1,5 @@
const Web3 = require('web3')
const { hashPersonalMessage } = require('ethereumjs-util')
const { hashPersonalMessage } = require('@ethereumjs/util')
const Personal = require('web3-eth-personal')
class NodeProvider {

@ -1,5 +1,6 @@
const Web3 = require('web3')
const { BN, privateToAddress, hashPersonalMessage } = require('ethereumjs-util')
const { privateToAddress, hashPersonalMessage } = require('@ethereumjs/util')
import BN from 'bn.js'
const { extend } = require('@remix-project/remix-simulator')
class VMProvider {
constructor (executionContext) {

@ -1,5 +1,5 @@
var async = require('async')
const ethJSUtil = require('ethereumjs-util')
const ethJSUtil = require('@ethereumjs/util')
module.exports = {
shortenAddress: function (address, etherBalance) {

@ -23,11 +23,11 @@
"dependencies": {
"@ethereumjs/block": "^4.0.0",
"@ethereumjs/tx": "^4.0.0",
"@ethereumjs/util": "^8.0.3",
"@ethereumjs/vm": "^6.0.0",
"@remix-project/remix-astwalker": "^0.0.53",
"@remix-project/remix-lib": "^0.5.23",
"async": "^2.6.2",
"ethereumjs-util": "^7.0.10",
"ethers": "^5.4.2",
"ethjs-util": "^0.1.6",
"string-similarity": "^4.0.4",

@ -35,11 +35,11 @@
"dependencies": {
"@ethereumjs/block": "^4.0.0",
"@ethereumjs/tx": "^4.0.0",
"@ethereumjs/util": "^8.0.3",
"@ethereumjs/vm": "^6.0.0",
"@remix-project/remix-lib": "^0.5.23",
"@types/tape": "^4.2.33",
"async": "^2.6.2",
"ethereumjs-util": "^7.0.10",
"ethers": "^5.4.2",
"ethjs-util": "^0.1.6",
"nyc": "^13.3.0",

@ -1,7 +1,7 @@
import { Plugin } from '@remixproject/engine'
import { compile } from '@remix-project/remix-solidity'
import { util } from '@remix-project/remix-lib'
import { toChecksumAddress } from 'ethereumjs-util'
import { toChecksumAddress } from '@ethereumjs/util'
import { fetchContractFromEtherscan } from './helpers/fetch-etherscan'
import { fetchContractFromSourcify } from './helpers/fetch-sourcify'
import { UUPSDeployedByteCode, UUPSCompilerVersion, UUPSOptimize, UUPSRuns, UUPSEvmVersion, UUPSLanguage } from './constants/uups'

@ -24,6 +24,7 @@
"@ethereumjs/block": "^4.0.0",
"@ethereumjs/common": "^3.0.0",
"@ethereumjs/tx": "^4.0.0",
"@ethereumjs/util": "^8.0.3",
"@ethereumjs/vm": "^6.0.0",
"@remix-project/remix-astwalker": "^0.0.53",
"@remix-project/remix-lib": "^0.5.23",
@ -34,7 +35,6 @@
"color-support": "^1.1.3",
"commander": "^9.4.1",
"deep-equal": "^1.0.1",
"ethereumjs-util": "^7.0.10",
"ethers": "^5.4.2",
"ethjs-util": "^0.1.6",
"express-ws": "^4.0.0",

@ -2,7 +2,7 @@
import { parseCode } from './codeUtils'
import { util } from '@remix-project/remix-lib'
import { bufferToHex } from 'ethereumjs-util'
import { bufferToHex } from '@ethereumjs/util'
function createExpressions (instructions) {
const expressions = []

@ -1,7 +1,6 @@
'use strict'
import { add, toBN, extractHexValue } from './util'
import { util } from '@remix-project/remix-lib'
import { BN } from 'ethereumjs-util'
import { RefType } from './RefType'
const sha3256 = util.sha3_256
@ -48,7 +47,7 @@ export class ArrayType extends RefType {
size = toBN('0x' + slotValue)
currentLocation.slot = sha3256(location.slot)
} else {
size = new BN(this.arraySize)
size = toBN(this.arraySize)
}
const k = toBN(0)
for (; k.lt(size) && k.ltn(300); k.iaddn(1)) {

@ -1,7 +1,7 @@
'use strict'
import { extractHexValue, readFromStorage } from './util'
import { util } from '@remix-project/remix-lib'
import { BN } from 'ethereumjs-util'
import { BN } from 'bn.js'
import { RefType } from './RefType'
const sha3256 = util.sha3_256

@ -1,7 +1,9 @@
'use strict'
import { hash } from '@remix-project/remix-lib'
import { RefType } from './RefType'
import { normalizeHex } from './util'
import { toBuffer, setLengthLeft, keccak, BN, bufferToHex, addHexPrefix } from 'ethereumjs-util'
import { toBuffer, setLengthLeft, bufferToHex, addHexPrefix } from '@ethereumjs/util'
import BN from 'bn.js'
export class Mapping extends RefType {
keyType
@ -68,7 +70,7 @@ function getMappingLocation (key, position) {
let mappingP = toBuffer(addHexPrefix(position))
mappingP = setLengthLeft(mappingP, 32)
const mappingKeyBuf = concatTypedArrays(mappingK, mappingP)
const mappingStorageLocation: Buffer = keccak(mappingKeyBuf)
const mappingStorageLocation: Buffer = hash.keccak(mappingKeyBuf)
const mappingStorageLocationinBn: BN = new BN(mappingStorageLocation, 16)
return mappingStorageLocationinBn
}

@ -1,5 +1,6 @@
'use strict'
import { BN, bufferToHex, unpadHexString } from 'ethereumjs-util'
import { bufferToHex, unpadHexString } from '@ethereumjs/util'
import BN from 'bn.js'
export function decodeIntFromHex (value, byteLength, signed) {
let bigNumber = new BN(value, 16)

@ -10,7 +10,7 @@ import { InternalCallTree } from '../../../src/solidity-decoder/internalCallTree
import * as vmCall from '../../vmCall'
import { StorageResolver } from '../../../src/storage/storageResolver'
import { StorageViewer } from '../../../src/storage/storageViewer'
import { Address, bufferToHex } from 'ethereumjs-util'
import { Address, bufferToHex } from '@ethereumjs/util'
module.exports = async function testMappingStorage (st, cb) {
const mappingStorage = require('../contracts/mappingStorage')

@ -1,14 +1,7 @@
'use strict'
import { Block } from '@ethereumjs/block'
import { Transaction } from '@ethereumjs/tx'
import VM from '@ethereumjs/vm'
import { rlp, keccak, bufferToHex } from 'ethereumjs-util'
import { extendWeb3 } from '../src/init'
const utileth = require('ethereumjs-util')
const Tx = require('@ethereumjs/tx').Transaction
const BN = require('ethereumjs-util').BN
const remixLib = require('@remix-project/remix-lib')
const { Provider, extend } = require('@remix-project/remix-simulator')
import { Address } from '@ethereumjs/util'
const { Provider } = require('@remix-project/remix-simulator')
const Web3 = require('web3')
@ -25,7 +18,7 @@ async function sendTx (web3, from, to, value, data, cb) {
try {
cb = cb || (() => {})
const receipt = await web3.eth.sendTransaction({
from: utileth.Address.fromPrivateKey(from.privateKey).toString('hex'),
from: Address.fromPrivateKey(from.privateKey).toString(),
to,
value,
data,

@ -18,7 +18,7 @@
},
"dependencies": {
"async": "^2.1.2",
"ethereumjs-util": "^7.0.10",
"@ethereumjs/util": "^8.0.3",
"ethers": "^4.0.40",
"ethjs-util": "^0.1.6",
"events": "^3.0.0",

@ -3,7 +3,7 @@ import { ethers } from 'ethers'
import { encodeParams as encodeParamsHelper, encodeFunctionId, makeFullTypeDefinition } from './txHelper'
import { eachOfSeries } from 'async'
import { linkBytecode as linkBytecodeSolc } from 'solc/linker'
import { isValidAddress, addHexPrefix } from 'ethereumjs-util'
import { isValidAddress, addHexPrefix } from '@ethereumjs/util'
/**
* build the transaction data

@ -1,6 +1,6 @@
'use strict'
import { ethers } from 'ethers'
import { toBuffer, addHexPrefix } from 'ethereumjs-util'
import { toBuffer, addHexPrefix } from '@ethereumjs/util'
import { EventManager } from '../eventManager'
import { compareByteCode, getinputParameters } from '../util'
import { decodeResponse } from './txFormat'

@ -1,8 +1,9 @@
'use strict'
import BN from 'bn.js'
import { RunBlockResult, RunTxResult } from '@ethereumjs/vm'
import { Transaction, FeeMarketEIP1559Transaction } from '@ethereumjs/tx'
import { Block } from '@ethereumjs/block'
import { BN, bufferToHex, Address } from 'ethereumjs-util'
import { bufferToHex, Address } from '@ethereumjs/util'
import type { Account } from '@ethereumjs/util'
import { EventManager } from '../eventManager'
import { LogsManager } from './logsManager'

@ -1,5 +1,6 @@
'use strict'
import { BN, bufferToHex } from 'ethereumjs-util'
import { BN } from 'bn.js'
import { bufferToHex } from '@ethereumjs/util'
export function toInt (h) {
if (h.indexOf && h.indexOf('0x') === 0) {

@ -0,0 +1,206 @@
import { keccak224, keccak384, keccak256 as k256, keccak512 } from 'ethereum-cryptography/keccak'
const createHash = require('create-hash')
import * as rlp from 'rlp'
import { toBuffer, setLengthLeft, isHexString } from '@ethereumjs/util'
/**
* Creates Keccak hash of a Buffer input
* @param a The input data (Buffer)
* @param bits (number = 256) The Keccak width
*/
export const keccak = function(a: Buffer, bits: number = 256): Buffer {
assertIsBuffer(a)
switch (bits) {
case 224: {
return toBuffer(keccak224(a))
}
case 256: {
return toBuffer(k256(a))
}
case 384: {
return toBuffer(keccak384(a))
}
case 512: {
return toBuffer(keccak512(a))
}
default: {
throw new Error(`Invald algorithm: keccak${bits}`)
}
}
}
/**
* Creates Keccak-256 hash of the input, alias for keccak(a, 256).
* @param a The input data (Buffer)
*/
export const keccak256 = function(a: Buffer): Buffer {
return keccak(a)
}
/**
* Creates Keccak hash of a utf-8 string input
* @param a The input data (String)
* @param bits (number = 256) The Keccak width
*/
export const keccakFromString = function(a: string, bits: number = 256) {
assertIsString(a)
const buf = Buffer.from(a, 'utf8')
return keccak(buf, bits)
}
/**
* Creates Keccak hash of an 0x-prefixed string input
* @param a The input data (String)
* @param bits (number = 256) The Keccak width
*/
export const keccakFromHexString = function(a: string, bits: number = 256) {
assertIsHexString(a)
return keccak(toBuffer(a), bits)
}
/**
* Creates Keccak hash of a number array input
* @param a The input data (number[])
* @param bits (number = 256) The Keccak width
*/
export const keccakFromArray = function(a: number[], bits: number = 256) {
assertIsArray(a)
return keccak(toBuffer(a), bits)
}
/**
* Creates SHA256 hash of an input.
* @param a The input data (Buffer|Array|String)
*/
const _sha256 = function(a: any): Buffer {
a = toBuffer(a)
return createHash('sha256')
.update(a)
.digest()
}
/**
* Creates SHA256 hash of a Buffer input.
* @param a The input data (Buffer)
*/
export const sha256 = function(a: Buffer): Buffer {
assertIsBuffer(a)
return _sha256(a)
}
/**
* Creates SHA256 hash of a string input.
* @param a The input data (string)
*/
export const sha256FromString = function(a: string): Buffer {
assertIsString(a)
return _sha256(a)
}
/**
* Creates SHA256 hash of a number[] input.
* @param a The input data (number[])
*/
export const sha256FromArray = function(a: number[]): Buffer {
assertIsArray(a)
return _sha256(a)
}
/**
* Creates RIPEMD160 hash of the input.
* @param a The input data (Buffer|Array|String|Number)
* @param padded Whether it should be padded to 256 bits or not
*/
const _ripemd160 = function(a: any, padded: boolean): Buffer {
a = toBuffer(a)
const hash = createHash('rmd160')
.update(a)
.digest()
if (padded === true) {
return setLengthLeft(hash, 32)
} else {
return hash
}
}
/**
* Creates RIPEMD160 hash of a Buffer input.
* @param a The input data (Buffer)
* @param padded Whether it should be padded to 256 bits or not
*/
export const ripemd160 = function(a: Buffer, padded: boolean): Buffer {
assertIsBuffer(a)
return _ripemd160(a, padded)
}
/**
* Creates RIPEMD160 hash of a string input.
* @param a The input data (String)
* @param padded Whether it should be padded to 256 bits or not
*/
export const ripemd160FromString = function(a: string, padded: boolean): Buffer {
assertIsString(a)
return _ripemd160(a, padded)
}
/**
* Creates RIPEMD160 hash of a number[] input.
* @param a The input data (number[])
* @param padded Whether it should be padded to 256 bits or not
*/
export const ripemd160FromArray = function(a: number[], padded: boolean): Buffer {
assertIsArray(a)
return _ripemd160(a, padded)
}
/**
* 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))
}
/**
* Throws if a string is not hex prefixed
* @param {string} input string to check hex prefix of
*/
export const assertIsHexString = function(input: string): void {
if (!isHexString(input)) {
const msg = `This method only supports 0x-prefixed hex strings but input was: ${input}`
throw new Error(msg)
}
}
/**
* Throws if input is not a buffer
* @param {Buffer} input value to check
*/
export const assertIsBuffer = function(input: Buffer): void {
if (!Buffer.isBuffer(input)) {
const msg = `This method only supports Buffer but input was: ${input}`
throw new Error(msg)
}
}
/**
* Throws if input is not an array
* @param {number[]} input value to check
*/
export const assertIsArray = function(input: number[]): void {
if (!Array.isArray(input)) {
const msg = `This method only supports number arrays but input was: ${input}`
throw new Error(msg)
}
}
/**
* Throws if input is not a string
* @param {string} input value to check
*/
export const assertIsString = function(input: string): void {
if (typeof input !== 'string') {
const msg = `This method only supports strings but input was: ${input}`
throw new Error(msg)
}
}

@ -1,5 +1,5 @@
'use strict'
import { bufferToHex } from 'ethereumjs-util'
import { bufferToHex } from '@ethereumjs/util'
import { isHexString } from 'ethjs-util'
function convertToPrefixedHex (input) {

@ -2,6 +2,7 @@ import { EventManager } from './eventManager'
import * as uiHelper from './helpers/uiHelper'
import * as compilerHelper from './helpers/compilerHelper'
import * as util from './util'
import * as hash from './hash'
import { Storage } from './storage'
import { EventsDecoder } from './execution/eventsDecoder'
import * as txExecution from './execution/txExecution'
@ -38,4 +39,4 @@ const execution = {
LogsManager,
forkAt
}
export { EventManager, helpers, Storage, util, execution }
export { EventManager, helpers, Storage, util, execution, hash }

@ -1,6 +1,6 @@
'use strict'
import { bufferToHex, keccak, setLengthLeft, toBuffer, addHexPrefix } from 'ethereumjs-util'
import { bigIntToHex } from '@ethereumjs/util'
import { hash } from '@remix-project/remix-lib'
import { bufferToHex, setLengthLeft, toBuffer, addHexPrefix } from '@ethereumjs/util'
import stringSimilarity from 'string-similarity'
/*
@ -153,7 +153,7 @@ export function buildCallPath (index, rootCall) {
// eslint-disable-next-line camelcase
export function sha3_256 (value) {
value = toBuffer(addHexPrefix(value))
const retInBuffer: Buffer = keccak(setLengthLeft(value, 32))
const retInBuffer: Buffer = hash.keccak(setLengthLeft(value, 32))
return bufferToHex(retInBuffer)
}

@ -1,7 +1,8 @@
'use strict'
import tape from 'tape'
import { BN, toBuffer } from 'ethereumjs-util'
import { BN } from 'bn.js'
import { toBuffer } from '@ethereumjs/util'
import { resultToRemixTx } from '../src/helpers/txResultHelper'
const TRANSACTION_HASH = '0x538ad944d09c2df403f064c1e4556fae877fe3f1b600c567622e330c2bdbbe2e'

@ -20,6 +20,7 @@
"@ethereumjs/block": "^4.0.0",
"@ethereumjs/common": "^3.0.0",
"@ethereumjs/tx": "^4.0.0",
"@ethereumjs/util": "^8.0.3",
"@ethereumjs/vm": "^6.0.0",
"@remix-project/remix-lib": "^0.5.23",
"ansi-gray": "^0.1.1",
@ -28,7 +29,6 @@
"color-support": "^1.1.3",
"commander": "^9.4.1",
"cors": "^2.8.5",
"ethereumjs-util": "^7.0.10",
"ethers": "^5.4.2",
"ethjs-util": "^0.1.6",
"express": "^4.16.3",

@ -2,8 +2,10 @@ import { util } from '@remix-project/remix-lib'
const { toHexPaddedString, formatMemory } = util
import { helpers } from '@remix-project/remix-lib'
const { normalizeHexAddress } = helpers.ui
import { ConsoleLogs } from '@remix-project/remix-lib'
import { toChecksumAddress, BN, keccak, bufferToHex, Address, toBuffer } from 'ethereumjs-util'
import { ConsoleLogs, hash } from '@remix-project/remix-lib'
import BN from 'bn.js'
import { isBigNumber } from 'web3-utils'
import { toChecksumAddress, bufferToHex, Address, toBuffer } from '@ethereumjs/util'
import utils from 'web3-utils'
import { ethers } from 'ethers'
import { VMContext } from './vm-context'
@ -276,7 +278,7 @@ export class VmProxy {
}
let consoleArgs = iface.decodeFunctionData(functionDesc, payload)
consoleArgs = consoleArgs.map((value) => {
if (utils.isBigNumber(value)) {
if (isBigNumber(value)) {
return value.toString()
}
return value
@ -352,7 +354,7 @@ export class VmProxy {
const txHash = '0x' + block.transactions[block.transactions.length - 1].hash().toString('hex')
if (this.storageCache['after_' + txHash] && this.storageCache['after_' + txHash][address]) {
const slot = '0x' + keccak(toBuffer(ethers.utils.hexZeroPad(position, 32))).toString('hex')
const slot = '0x' + hash.keccak(toBuffer(ethers.utils.hexZeroPad(position, 32))).toString('hex')
const storage = this.storageCache['after_' + txHash][address]
return cb(null, storage[slot].value)
}

@ -1,5 +1,6 @@
import { BN, privateToAddress, toChecksumAddress, isValidPrivate, Address } from 'ethereumjs-util'
const Web3EthAccounts = require('web3-eth-accounts')
import { privateToAddress, toChecksumAddress, isValidPrivate, Address } from '@ethereumjs/util'
import BN from 'bn.js'
const Web3EthAccounts = require('web3-eth-accounts');
import * as crypto from 'crypto'
export class Web3Accounts {

@ -1,6 +1,6 @@
import { toHex, toDecimal } from 'web3-utils'
import { bigIntToHex } from '@ethereumjs/util'
import { toChecksumAddress, BN, Address } from 'ethereumjs-util'
import BN from 'bn.js'
import { toChecksumAddress, Address, bigIntToHex } from '@ethereumjs/util'
import { processTx } from './txProcess'
import { execution } from '@remix-project/remix-lib'
import { ethers } from 'ethers'

@ -1,6 +1,8 @@
/* global ethereum */
'use strict'
import { rlp, keccak, bufferToHex } from 'ethereumjs-util'
import { hash } from '@remix-project/remix-lib'
import { bufferToHex } from '@ethereumjs/util'
import rlp from 'rlp'
import { execution } from '@remix-project/remix-lib'
const { LogsManager } = execution
import { VmProxy } from './VmProxy'
@ -44,7 +46,7 @@ class StateManagerCommonStorageDump extends DefaultStateManager {
}
putContractStorage (address, key, value) {
this.keyHashes[keccak(key).toString('hex')] = bufferToHex(key)
this.keyHashes[hash.keccak(key).toString('hex')] = bufferToHex(key)
return super.putContractStorage(address, key, value)
}

@ -17,11 +17,11 @@
"dependencies": {
"@ethereumjs/block": "^4.0.0",
"@ethereumjs/tx": "^4.0.0",
"@ethereumjs/util": "^8.0.3",
"@ethereumjs/vm": "^6.0.0",
"@remix-project/remix-lib": "^0.5.23",
"async": "^2.6.2",
"eslint-scope": "^5.0.0",
"ethereumjs-util": "^7.0.10",
"ethers": "^5.4.2",
"ethjs-util": "^0.1.6",
"minixhr": "^3.2.2",

@ -39,6 +39,7 @@
"@ethereumjs/block": "^4.0.0",
"@ethereumjs/common": "^3.0.0",
"@ethereumjs/tx": "^4.0.0",
"@ethereumjs/util": "^8.0.3",
"@ethereumjs/vm": "^6.0.0",
"@remix-project/remix-lib": "^0.5.23",
"@remix-project/remix-simulator": "^0.2.23",
@ -52,7 +53,6 @@
"colors": "1.4.0",
"commander": "^9.4.1",
"deep-equal": "^1.0.1",
"ethereumjs-util": "^7.0.10",
"ethers": "^5.4.2",
"ethjs-util": "^0.1.6",
"express-ws": "^4.0.0",

@ -1,6 +1,6 @@
import React from 'react' // eslint-disable-line
import DropdownPanel from './dropdown-panel' // eslint-disable-line
import { BN } from 'ethereumjs-util'
import { BN } from 'bn.js'
import Web3 from 'web3'
export const GlobalVariables = ({ block, receipt, tx, className }) => {

@ -1,4 +1,4 @@
import { BN } from 'ethereumjs-util'
import { BN } from 'bn.js'
import { ExtractData } from '../types' // eslint-disable-line
export function extractData (item, parent): ExtractData {

@ -1,4 +1,4 @@
import * as ethJSUtil from 'ethereumjs-util'
import * as ethJSUtil from '@ethereumjs/util'
export const extractNameFromKey = (key: string): string => {
if (!key) return

@ -4,7 +4,7 @@ import { setExecutionContext, setFinalContext, updateAccountBalances } from "./a
import { addExternalProvider, addInstance, removeExternalProvider, setNetworkNameFromProvider } from "./actions"
import { addDeployOption, clearAllInstances, clearRecorderCount, fetchContractListSuccess, resetUdapp, setCurrentContract, setCurrentFile, setLoadType, setProxyEnvAddress, setRecorderCount, setRemixDActivated, setSendValue } from "./payload"
import { CompilerAbstract } from '@remix-project/remix-solidity'
import * as ethJSUtil from 'ethereumjs-util'
import BN from 'bn.js'
import Web3 from 'web3'
import { Plugin } from "@remixproject/engine"
const _paq = window._paq = window._paq || []
@ -172,7 +172,7 @@ export const resetAndInit = (plugin: RunTab) => {
},
getGasLimit: (cb) => {
try {
const gasLimit = '0x' + new ethJSUtil.BN(plugin.REACT_API.gasLimit, 10).toString(16)
const gasLimit = '0x' + new BN(plugin.REACT_API.gasLimit, 10).toString(16)
cb(null, gasLimit)
} catch (e) {

@ -3,7 +3,7 @@ import React, { useEffect, useRef, useState } from 'react'
import { FormattedMessage, useIntl } from 'react-intl'
import { ContractDropdownProps, DeployMode } from '../types'
import { ContractData, FuncABI } from '@remix-project/core-plugin'
import * as ethJSUtil from 'ethereumjs-util'
import * as ethJSUtil from '@ethereumjs/util'
import { ContractGUI } from './contractGUI'
import { CustomTooltip, deployWithProxyMsg, upgradeWithProxyMsg } from '@remix-ui/helper'
const _paq = window._paq = window._paq || []

@ -4,10 +4,10 @@ import { UdappProps } from '../types'
import { FuncABI } from '@remix-project/core-plugin'
import { CopyToClipboard } from '@remix-ui/clipboard'
import * as remixLib from '@remix-project/remix-lib'
import * as ethJSUtil from 'ethereumjs-util'
import * as ethJSUtil from '@ethereumjs/util'
import { ContractGUI } from './contractGUI'
import { TreeView, TreeViewItem } from '@remix-ui/tree-view'
import { BN } from 'ethereumjs-util'
import { BN } from 'bn.js'
import { CustomTooltip, is0XPrefixed, isHexadecimal, isNumeric, shortenAddress } from '@remix-ui/helper'
const txHelper = remixLib.execution.txHelper

@ -1,7 +1,7 @@
// eslint-disable-next-line no-use-before-define
import React, { useEffect, useRef, useState } from 'react'
import { FormattedMessage } from 'react-intl'
import { BN } from 'ethereumjs-util'
import { BN } from 'bn.js'
import { CustomTooltip, isNumeric } from '@remix-ui/helper'
import { ValueProps } from '../types'

@ -1,5 +1,6 @@
import React from 'react'
import { bufferToHex, keccakFromString } from 'ethereumjs-util'
import { bufferToHex } from '@ethereumjs/util'
import { hash } from '@remix-project/remix-lib'
import axios, { AxiosResponse } from 'axios'
import { addInputFieldSuccess, cloneRepositoryFailed, cloneRepositoryRequest, cloneRepositorySuccess, createWorkspaceError, createWorkspaceRequest, createWorkspaceSuccess, displayNotification, displayPopUp, fetchWorkspaceDirectoryError, fetchWorkspaceDirectoryRequest, fetchWorkspaceDirectorySuccess, hideNotification, setCurrentWorkspace, setCurrentWorkspaceBranches, setCurrentWorkspaceCurrentBranch, setDeleteWorkspace, setMode, setReadOnlyMode, setRenameWorkspace, setCurrentWorkspaceIsGitRepo, setGitConfig } from './payload'
import { addSlash, checkSlash, checkSpecialChars } from '@remix-ui/helper'
@ -171,9 +172,9 @@ export const loadWorkspacePreset = async (template: WorkspaceTemplate = 'remixDe
let path = ''; let content
if (params.code) {
const hash = bufferToHex(keccakFromString(params.code))
const hashed = bufferToHex(hash.keccakFromString(params.code))
path = 'contract-' + hash.replace('0x', '').substring(0, 10) + (params.language && params.language.toLowerCase() === 'yul' ? '.yul' : '.sol')
path = 'contract-' + hashed.replace('0x', '').substring(0, 10) + (params.language && params.language.toLowerCase() === 'yul' ? '.yul' : '.sol')
content = atob(params.code)
await workspaceProvider.set(path, content)
}

@ -142,6 +142,7 @@
"ansi-gray": "^0.1.1",
"async": "^2.6.2",
"axios": "1.1.2",
"bn.js": "^5.1.2",
"bootstrap": "^5.2.2",
"brace": "^0.8.0",
"change-case": "^4.1.1",

Loading…
Cancel
Save