Merge branch 'master' into fix-circom-parsing

pull/4648/head
Aniket 8 months ago committed by GitHub
commit 5fc450e07e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 34
      apps/remix-ide-e2e/src/tests/debugger.test.ts
  2. 51
      apps/remix-ide-e2e/src/tests/eip1153.test.ts
  3. 4
      apps/remix-ide-e2e/src/tests/etherscan_api.test.ts
  4. 2
      apps/remix-ide-e2e/src/tests/proxy_oz_v5_non_shanghai_runtime.test.ts
  5. 12
      apps/remix-ide-e2e/src/tests/runAndDeploy.test.ts
  6. 4
      apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts
  7. 2
      apps/remix-ide-e2e/src/tests/terminal.test.ts
  8. 53
      apps/remix-ide/ci/downloadsoljson.sh
  9. 4
      apps/remix-ide/src/app.js
  10. 2
      apps/remix-ide/src/app/providers/abstract-provider.tsx
  11. 6
      apps/remix-ide/src/app/providers/mainnet-vm-fork-provider.tsx
  12. 4
      apps/remix-ide/src/app/providers/sepolia-vm-fork-provider.tsx
  13. 26
      apps/remix-ide/src/app/providers/vm-provider.tsx
  14. 6
      apps/remix-ide/src/app/tabs/runTab/model/recorder.js
  15. 9
      apps/remix-ide/src/app/udapp/run-tab.js
  16. 15
      apps/remix-ide/src/assets/list.json
  17. 15
      apps/remix-ide/src/blockchain/blockchain.tsx
  18. 30
      apps/remix-ide/src/blockchain/execution-context.js
  19. 4
      apps/remix-ide/src/blockchain/providers/injected.ts
  20. 6
      apps/remix-ide/src/blockchain/providers/node.ts
  21. 7
      apps/remix-ide/src/blockchain/providers/vm.ts
  22. 4
      apps/remix-ide/src/lib/helper.js
  23. 2
      apps/remix-ide/src/remixAppManager.js
  24. 2
      apps/remix-ide/src/remixEngine.js
  25. 20
      apps/remix-ide/webpack.config.js
  26. 8
      libs/remix-analyzer/package.json
  27. 8
      libs/remix-astwalker/package.json
  28. 10
      libs/remix-debug/package.json
  29. 9
      libs/remix-debug/src/code/codeUtils.ts
  30. 4
      libs/remix-debug/src/code/disassembler.ts
  31. 10
      libs/remix-debug/src/solidity-decoder/types/Mapping.ts
  32. 6
      libs/remix-debug/src/solidity-decoder/types/util.ts
  33. 2
      libs/remix-debug/src/trace/traceHelper.ts
  34. 2
      libs/remix-debug/src/trace/traceManager.ts
  35. 2
      libs/remix-debug/test/decoder/stateTests/mapping.ts
  36. 2
      libs/remix-lib/package.json
  37. 10
      libs/remix-lib/src/execution/forkAt.ts
  38. 20
      libs/remix-lib/src/execution/logsManager.ts
  39. 8
      libs/remix-lib/src/execution/txListener.ts
  40. 77
      libs/remix-lib/src/execution/txRunnerVM.ts
  41. 4
      libs/remix-lib/src/execution/typeConversion.ts
  42. 31
      libs/remix-lib/src/hash.ts
  43. 32
      libs/remix-lib/src/helpers/txResultHelper.ts
  44. 18
      libs/remix-lib/src/util.ts
  45. 6
      libs/remix-lib/test/txResultHelper.ts
  46. 10
      libs/remix-simulator/package.json
  47. 63
      libs/remix-simulator/src/VmProxy.ts
  48. 38
      libs/remix-simulator/src/methods/accounts.ts
  49. 14
      libs/remix-simulator/src/methods/blocks.ts
  50. 39
      libs/remix-simulator/src/methods/transactions.ts
  51. 181
      libs/remix-simulator/src/vm-context.ts
  52. 15
      libs/remix-simulator/test/events.ts
  53. 8
      libs/remix-solidity/package.json
  54. 21
      libs/remix-tests/package.json
  55. 4
      libs/remix-tests/tests/testRunner.cli.spec.ts
  56. 102
      libs/remix-tests/tests/testRunner.spec.ts
  57. 6
      libs/remix-ui/helper/src/lib/remix-ui-helper.ts
  58. 2
      libs/remix-ui/run-tab/src/lib/components/account.tsx
  59. 4
      libs/remix-ui/run-tab/src/lib/reducers/runTab.ts
  60. 3
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  61. 5
      libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx
  62. 6
      libs/remix-ui/workspace/src/lib/actions/workspace.ts
  63. 28
      package.json
  64. 328
      yarn.lock

@ -95,7 +95,7 @@ module.exports = {
.waitForElementVisible('#stepdetail') .waitForElementVisible('#stepdetail')
.waitForElementVisible({ .waitForElementVisible({
locateStrategy: 'xpath', locateStrategy: 'xpath',
selector: '//*[@data-id="treeViewLivm trace step" and contains(.,"531")]', selector: '//*[@data-id="treeViewLivm trace step" and contains(.,"475")]',
}) })
.getEditorValue((content) => { .getEditorValue((content) => {
browser.assert.ok(content.indexOf(`constructor (string memory name_, string memory symbol_) { browser.assert.ok(content.indexOf(`constructor (string memory name_, string memory symbol_) {
@ -206,16 +206,40 @@ module.exports = {
}, },
// depends on Should debug using generated sources // depends on Should debug using generated sources
'Should call the debugger api: getTrace #group4': function (browser: NightwatchBrowser) { 'Should call the debugger api: getTrace #group4': function (browser: NightwatchBrowser) {
let txhash
browser browser
.addFile('test_jsGetTrace.js', { content: jsGetTrace }) .clickLaunchIcon('udapp')
.perform((done) => {
browser.getLastTransactionHash((hash) => {
txhash = hash
done()
})
})
.perform((done) => {
browser.addFile('test_jsGetTrace.js', { content: jsGetTrace.replace('<txhash>', txhash) }).perform(() => {
done()
})
})
.executeScriptInTerminal('remix.exeCurrent()') .executeScriptInTerminal('remix.exeCurrent()')
.pause(3000) .pause(3000)
.waitForElementContainsText('*[data-id="terminalJournal"]', '{"gas":"0x5752","return":"0x0000000000000000000000000000000000000000000000000000000000000000","structLogs":', 60000) .waitForElementContainsText('*[data-id="terminalJournal"]', '{"gas":"0x5752","return":"0x0000000000000000000000000000000000000000000000000000000000000000","structLogs":', 60000)
}, },
// depends on Should debug using generated sources // depends on Should debug using generated sources
'Should call the debugger api: debug #group4': function (browser: NightwatchBrowser) { 'Should call the debugger api: debug #group4': function (browser: NightwatchBrowser) {
let txhash
browser browser
.addFile('test_jsDebug.js', { content: jsDebug }) .clickLaunchIcon('udapp')
.perform((done) => {
browser.getLastTransactionHash((hash) => {
txhash = hash
done()
})
})
.perform((done) => {
browser.addFile('test_jsDebug.js', { content: jsDebug.replace('<txhash>', txhash) }).perform(() => {
done()
})
})
.executeScriptInTerminal('remix.exeCurrent()') .executeScriptInTerminal('remix.exeCurrent()')
.pause(3000) .pause(3000)
.clickLaunchIcon('debugger') .clickLaunchIcon('debugger')
@ -495,7 +519,7 @@ const localVariable_step717_ABIEncoder = { // eslint-disable-line
const jsGetTrace = `(async () => { const jsGetTrace = `(async () => {
try { try {
const result = await remix.call('debugger', 'getTrace', '0x00a9f5b1ac2c9cb93e5890ea86c81efbd36b619ef2378136ef74d8c6171ddda6') const result = await remix.call('debugger', 'getTrace', '<txhash>')
console.log('result ', result) console.log('result ', result)
} catch (e) { } catch (e) {
console.log(e.message) console.log(e.message)
@ -504,7 +528,7 @@ const jsGetTrace = `(async () => {
const jsDebug = `(async () => { const jsDebug = `(async () => {
try { try {
const result = await remix.call('debugger', 'debug', '0x00a9f5b1ac2c9cb93e5890ea86c81efbd36b619ef2378136ef74d8c6171ddda6') const result = await remix.call('debugger', 'debug', '<txhash>')
console.log('result ', result) console.log('result ', result)
} catch (e) { } catch (e) {
console.log(e.message) console.log(e.message)

@ -0,0 +1,51 @@
'use strict'
import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'
module.exports = {
'@disabled': true,
before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done)
},
'Should execute a contract that uses transient storage #group1': function (browser: NightwatchBrowser) {
browser
.clickLaunchIcon('udapp')
.switchEnvironment('vm-cancun') // switch to a vm that know this eip.
.addFile('transient_storage.sol', { content: contractTransientStorage })
.clickLaunchIcon('solidity')
.setSolidityCompilerVersion('soljson-v0.8.24+commit.e11b9ed9.js')
.click('*[data-id="scConfigExpander"]')
.setValue('#evmVersionSelector', 'cancun') // set target compilation to cancun
.clickLaunchIcon('solidity')
.verifyContracts(['TestTransientStorage'])
.clickLaunchIcon('udapp')
.createContract('')
.clickInstance(0)
.clickFunction('useTransientStorage - transact (not payable)')
.testFunction('last',
{
status: '0x1 Transaction mined and execution succeed',
'decoded output': {
0: 'uint256: out1 14',
1: 'uint256: out2 15'
}
})
.end()
}
}
const contractTransientStorage = `// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.2 <0.9.0;
contract TestTransientStorage {
function useTransientStorage() public returns (uint out1, uint out2) {
assembly {
tstore(0, 14)
tstore(1, 15)
out1 := tload(0)
out2 := tload(1)
}
}
}`

@ -33,7 +33,7 @@ module.exports = {
.execute(() => { .execute(() => {
(document.querySelector('*[data-id="basic-http-providerModalDialogContainer-react"] input[data-id="modalDialogCustomPromp"]') as any).focus() (document.querySelector('*[data-id="basic-http-providerModalDialogContainer-react"] input[data-id="modalDialogCustomPromp"]') as any).focus()
}, [], () => {}) }, [], () => {})
.setValue('[data-id="modalDialogCustomPromp"]', 'https://rpc.ankr.com/eth_goerli') .setValue('[data-id="modalDialogCustomPromp"]', 'https://go.getblock.io/ee42d0a88f314707be11dd799b122cb9') // sepolia
.modalFooterOKClick('basic-http-provider') .modalFooterOKClick('basic-http-provider')
.clickLaunchIcon('solidity') // compile .clickLaunchIcon('solidity') // compile
.testContracts('Owner_1.sol', { content: verifiedContract }, ['Owner']) .testContracts('Owner_1.sol', { content: verifiedContract }, ['Owner'])
@ -42,7 +42,7 @@ module.exports = {
.frame(0) .frame(0)
.click('[data-id="home"]') .click('[data-id="home"]')
.setValue('select[name="contractName"]', 'Owner') .setValue('select[name="contractName"]', 'Owner')
.setValue('*[name="contractAddress"]', ['0x9981c9d00103da481c3c65b22a79582a3e3ff50b', browser.Keys.TAB]) .setValue('*[name="contractAddress"]', ['0xfF6A41815582cFD18855c5B90efD1d45784fd4f5', browser.Keys.TAB])
.click('[data-id="verify-contract"]') .click('[data-id="verify-contract"]')
.waitForElementVisible('[data-id="verify-result"]') .waitForElementVisible('[data-id="verify-result"]')
.waitForElementContainsText('[data-id="verify-result"]', 'Contract source code already verified', 15000) .waitForElementContainsText('[data-id="verify-result"]', 'Contract source code already verified', 15000)

@ -20,7 +20,7 @@ module.exports = {
'Should show deploy proxy option for UUPS upgradeable contract #group1': function (browser: NightwatchBrowser) { 'Should show deploy proxy option for UUPS upgradeable contract #group1': function (browser: NightwatchBrowser) {
browser browser
.clickLaunchIcon('udapp') .clickLaunchIcon('udapp')
.switchEnvironment('vm-merge') // this runtime doesn't have the PUSH0 opcode. .switchEnvironment('vm-paris') // this runtime doesn't have the PUSH0 opcode.
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.click('.remixui_compilerConfigSection') .click('.remixui_compilerConfigSection')
.setValue('#evmVersionSelector', 'paris') // set an evm version which doesn't have PUSH0 opcode. .setValue('#evmVersionSelector', 'paris') // set an evm version which doesn't have PUSH0 opcode.

@ -33,7 +33,7 @@ module.exports = {
'Should sign message using account key #group2': function (browser: NightwatchBrowser) { 'Should sign message using account key #group2': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="settingsRemixRunSignMsg"]') browser.waitForElementVisible('*[data-id="settingsRemixRunSignMsg"]')
.switchEnvironment('vm-merge') .switchEnvironment('vm-paris')
.pause(2000) .pause(2000)
.click('*[data-id="settingsRemixRunSignMsg"]') .click('*[data-id="settingsRemixRunSignMsg"]')
.pause(2000) .pause(2000)
@ -263,10 +263,10 @@ module.exports = {
.clickFunction('retrieve - call') .clickFunction('retrieve - call')
.waitForElementContainsText('[data-id="treeViewLi0"]', 'uint256: 10') .waitForElementContainsText('[data-id="treeViewLi0"]', 'uint256: 10')
.clickLaunchIcon('filePanel') .clickLaunchIcon('filePanel')
.openFile('.states/vm-shanghai/state.json') .openFile('.states/vm-cancun/state.json')
.getEditorValue((content) => { .getEditorValue((content) => {
browser browser
.assert.ok(content.includes('"latestBlockNumber": "0x02"'), 'State is saved') .assert.ok(content.includes('"latestBlockNumber": "0x2"'), 'State is saved')
}) })
}, },
@ -303,7 +303,7 @@ module.exports = {
.pause(100000) .pause(100000)
.getEditorValue((content) => { .getEditorValue((content) => {
browser browser
.assert.ok(content.includes('"latestBlockNumber": "0x01"'), 'State is saved') .assert.ok(content.includes('"latestBlockNumber": "0x1"'), 'State is saved')
}) })
}, },
@ -321,10 +321,10 @@ module.exports = {
.click('*[data-id="Deploy - transact (not payable)"]') .click('*[data-id="Deploy - transact (not payable)"]')
.pause(5000) .pause(5000)
.clickLaunchIcon('filePanel') .clickLaunchIcon('filePanel')
.openFile('.states/vm-shanghai/state.json') .openFile('.states/vm-cancun/state.json')
.getEditorValue((content) => { .getEditorValue((content) => {
browser browser
.assert.ok(content.includes('"latestBlockNumber": "0x02"'), 'State is unchanged') .assert.ok(content.includes('"latestBlockNumber": "0x2"'), 'State is unchanged')
}) })
.end() .end()
} }

@ -339,10 +339,12 @@ module.exports = {
'Basic Solidity Unit tests with local compiler #group6': function (browser: NightwatchBrowser) { 'Basic Solidity Unit tests with local compiler #group6': function (browser: NightwatchBrowser) {
browser browser
.clickLaunchIcon('udapp')
.switchEnvironment('vm-cancun')
.clickLaunchIcon('solidity') .clickLaunchIcon('solidity')
.setSolidityCompilerVersion('builtin') .setSolidityCompilerVersion('builtin')
.click('.remixui_compilerConfigSection') .click('.remixui_compilerConfigSection')
.setValue('#evmVersionSelector', 'shanghai') // Temporary fix .setValue('#evmVersionSelector', 'cancun') // Temporary fix
.clickLaunchIcon('filePanel') .clickLaunchIcon('filePanel')
.click('*[data-id="treeViewLitreeViewItemcontracts"]') .click('*[data-id="treeViewLitreeViewItemcontracts"]')
.openFile('contracts/3_Ballot.sol') .openFile('contracts/3_Ballot.sol')

@ -319,7 +319,7 @@ module.exports = {
.execute(() => { .execute(() => {
(document.querySelector('*[data-id="vm-custom-forkModalDialogContainer-react"] input[data-id="CustomForkEvmType"]') as any).focus() (document.querySelector('*[data-id="vm-custom-forkModalDialogContainer-react"] input[data-id="CustomForkEvmType"]') as any).focus()
}, [], () => { }) }, [], () => { })
.click('*[data-id="CustomForkEvmType"] [value="merge"]') .click('*[data-id="CustomForkEvmType"] [value="cancun"]')
.pause(5000) .pause(5000)
.modalFooterOKClick('vm-custom-fork') .modalFooterOKClick('vm-custom-fork')
.waitForElementPresent({ .waitForElementPresent({

@ -1,34 +1,45 @@
#!/usr/bin/env bash #!/usr/bin/env bash
echo "Downloading latest soljson.js from https://binaries.soliditylang.org/wasm/list.json" echo "Downloading specified soljson.js version based on defaultVersion in package.json"
set -e set -e
# check if curl is installed
if ! command -v curl &> /dev/null # Check if curl and jq are installed
then if ! command -v curl &> /dev/null; then
echo "curl could not be found" echo "curl could not be found"
exit exit 1
fi fi
# Read the defaultVersion from package.json
defaultVersion=$(grep '"defaultVersion"' package.json | awk -F '"' '{print $4}')
echo "Specified version from package.json: $defaultVersion"
# download https://binaries.soliditylang.org/wasm/list.json as json # Download the list.json file containing available versions
curl -s https://binaries.soliditylang.org/wasm/list.json > list.json curl -s https://binaries.soliditylang.org/wasm/list.json > list.json
# get the latest version without jq
latest=$(grep 'latestRelease' list.json | cut -d '"' -f 4) # Use jq to extract the path for the specified version from the builds array
echo "latest version: $latest" check=$(grep "\"$defaultVersion\"" list.json)
# get url if [ -z "$check" ]; then
url=$(grep "\"$latest\":" list.json | cut -d '"' -f 4) echo "The specified version $defaultVersion could not be found in the list"
echo "url: $url" exit 1
path="https://binaries.soliditylang.org/bin/$url" fi
echo "path: $path"
# download the file to ./apps/remix-ide/src/assets/js/soljson.js echo "Path for the specified version: $defaultVersion"
curl -s $path > ./apps/remix-ide/src/assets/js/soljson.js fullPath="https://binaries.soliditylang.org/bin/$defaultVersion"
# if directory ./apps/remix-ide/src/assets/js/soljson does not exist, create it echo "Download fullPath: $fullPath"
# Ensure the target directory exists
if [ ! -d "./apps/remix-ide/src/assets/js/soljson" ]; then if [ ! -d "./apps/remix-ide/src/assets/js/soljson" ]; then
mkdir ./apps/remix-ide/src/assets/js/soljson mkdir -p ./apps/remix-ide/src/assets/js/soljson
fi fi
cp ./apps/remix-ide/src/assets/js/soljson.js ./apps/remix-ide/src/assets/js/soljson/$url
# Download the file to ./apps/remix-ide/src/assets/js/soljson.js
echo "Downloading soljson.js from "$fullPath" to ./apps/remix-ide/src/assets/js/soljson.js"
curl -s "$fullPath" > ./apps/remix-ide/src/assets/js/soljson.js
# Copy the downloaded soljson.js to the specific version directory
cp ./apps/remix-ide/src/assets/js/soljson.js "./apps/remix-ide/src/assets/js/soljson/$path"
cp list.json ./apps/remix-ide/src/assets/list.json cp list.json ./apps/remix-ide/src/assets/list.json
# remove list.json # Clean up by removing the list.json
rm list.json rm list.json

@ -28,7 +28,7 @@ import {StoragePlugin} from './app/plugins/storage'
import {Layout} from './app/panels/layout' import {Layout} from './app/panels/layout'
import {NotificationPlugin} from './app/plugins/notification' import {NotificationPlugin} from './app/plugins/notification'
import {Blockchain} from './blockchain/blockchain' import {Blockchain} from './blockchain/blockchain'
import {MergeVMProvider, LondonVMProvider, BerlinVMProvider, ShanghaiVMProvider} from './app/providers/vm-provider' import {MergeVMProvider, LondonVMProvider, BerlinVMProvider, ShanghaiVMProvider, CancunVMProvider} from './app/providers/vm-provider'
import {MainnetForkVMProvider} from './app/providers/mainnet-vm-fork-provider' import {MainnetForkVMProvider} from './app/providers/mainnet-vm-fork-provider'
import {SepoliaForkVMProvider} from './app/providers/sepolia-vm-fork-provider' import {SepoliaForkVMProvider} from './app/providers/sepolia-vm-fork-provider'
import {GoerliForkVMProvider} from './app/providers/goerli-vm-fork-provider' import {GoerliForkVMProvider} from './app/providers/goerli-vm-fork-provider'
@ -260,6 +260,7 @@ class AppComponent {
const vmProviderSepoliaFork = new SepoliaForkVMProvider(blockchain) const vmProviderSepoliaFork = new SepoliaForkVMProvider(blockchain)
const vmProviderGoerliFork = new GoerliForkVMProvider(blockchain) const vmProviderGoerliFork = new GoerliForkVMProvider(blockchain)
const vmProviderShanghai = new ShanghaiVMProvider(blockchain) const vmProviderShanghai = new ShanghaiVMProvider(blockchain)
const vmProviderCancun = new CancunVMProvider(blockchain)
const vmProviderMerge = new MergeVMProvider(blockchain) const vmProviderMerge = new MergeVMProvider(blockchain)
const vmProviderBerlin = new BerlinVMProvider(blockchain) const vmProviderBerlin = new BerlinVMProvider(blockchain)
const vmProviderLondon = new LondonVMProvider(blockchain) const vmProviderLondon = new LondonVMProvider(blockchain)
@ -334,6 +335,7 @@ class AppComponent {
dGitProvider, dGitProvider,
storagePlugin, storagePlugin,
vmProviderShanghai, vmProviderShanghai,
vmProviderCancun,
vmProviderMerge, vmProviderMerge,
vmProviderBerlin, vmProviderBerlin,
vmProviderLondon, vmProviderLondon,

@ -119,7 +119,7 @@ export abstract class AbstractProvider extends Plugin implements IProvider {
} }
this.call('notification', 'alert', modalContent) this.call('notification', 'alert', modalContent)
} }
await this.call('udapp', 'setEnvironmentMode', {context: 'vm-merge'}) await this.call('udapp', 'setEnvironmentMode', {context: 'vm-paris'})
return return
} }

@ -8,16 +8,16 @@ export class MainnetForkVMProvider extends BasicVMProvider {
super( super(
{ {
name: 'vm-mainnet-fork', name: 'vm-mainnet-fork',
displayName: 'Mainet fork -Remix VM (London)', displayName: 'Mainnet fork - Remix VM (Cancun)',
kind: 'provider', kind: 'provider',
description: 'Remix VM (London)', description: 'Remix VM (Cancun)',
methods: ['sendAsync', 'init'], methods: ['sendAsync', 'init'],
version: packageJson.version version: packageJson.version
}, },
blockchain blockchain
) )
this.blockchain = blockchain this.blockchain = blockchain
this.fork = 'shanghai' this.fork = 'cancun'
this.nodeUrl = 'https://go.getblock.io/56f8bc5187aa4ac696348f67545acf38' this.nodeUrl = 'https://go.getblock.io/56f8bc5187aa4ac696348f67545acf38'
this.blockNumber = 'latest' this.blockNumber = 'latest'
} }

@ -8,7 +8,7 @@ export class SepoliaForkVMProvider extends BasicVMProvider {
super( super(
{ {
name: 'vm-sepolia-fork', name: 'vm-sepolia-fork',
displayName: 'Sepolia fork - Remix VM (London)', displayName: 'Sepolia fork - Remix VM (Cancun)',
kind: 'provider', kind: 'provider',
description: 'Remix VM (London)', description: 'Remix VM (London)',
methods: ['sendAsync', 'init'], methods: ['sendAsync', 'init'],
@ -17,7 +17,7 @@ export class SepoliaForkVMProvider extends BasicVMProvider {
blockchain blockchain
) )
this.blockchain = blockchain this.blockchain = blockchain
this.fork = 'shanghai' this.fork = 'cancun'
this.nodeUrl = 'https://go.getblock.io/ee42d0a88f314707be11dd799b122cb9' this.nodeUrl = 'https://go.getblock.io/ee42d0a88f314707be11dd799b122cb9'
this.blockNumber = 'latest' this.blockNumber = 'latest'
} }

@ -46,17 +46,17 @@ export class MergeVMProvider extends BasicVMProvider {
constructor(blockchain) { constructor(blockchain) {
super( super(
{ {
name: 'vm-merge', name: 'vm-paris',
displayName: 'Remix VM (Merge)', displayName: 'Remix VM (Paris)',
kind: 'provider', kind: 'provider',
description: 'Remix VM (Merge)', description: 'Remix VM (Paris)',
methods: ['sendAsync', 'init'], methods: ['sendAsync', 'init'],
version: packageJson.version version: packageJson.version
}, },
blockchain blockchain
) )
this.blockchain = blockchain this.blockchain = blockchain
this.fork = 'merge' this.fork = 'paris'
} }
} }
@ -113,3 +113,21 @@ export class ShanghaiVMProvider extends BasicVMProvider {
this.fork = 'shanghai' this.fork = 'shanghai'
} }
} }
export class CancunVMProvider extends BasicVMProvider {
constructor(blockchain) {
super(
{
name: 'vm-cancun',
displayName: 'Remix VM (Cancun)',
kind: 'provider',
description: 'Remix VM (Cancun)',
methods: ['sendAsync', 'init'],
version: packageJson.version
},
blockchain
)
this.blockchain = blockchain
this.fork = 'cancun'
}
}

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

@ -177,13 +177,14 @@ export class RunTab extends ViewPlugin {
// VM // VM
const titleVM = 'Execution environment is local to Remix. Data is only saved to browser memory and will vanish upon reload.' const titleVM = 'Execution environment is local to Remix. Data is only saved to browser memory and will vanish upon reload.'
await addProvider('vm-cancun', 'Remix VM (Cancun)', false, true, 'cancun', 'settingsVMCancunMode', titleVM)
await addProvider('vm-shanghai', 'Remix VM (Shanghai)', false, true, 'shanghai', 'settingsVMShanghaiMode', titleVM) await addProvider('vm-shanghai', 'Remix VM (Shanghai)', false, true, 'shanghai', 'settingsVMShanghaiMode', titleVM)
await addProvider('vm-merge', 'Remix VM (Merge)', false, true, 'merge', 'settingsVMMergeMode', titleVM) await addProvider('vm-paris', 'Remix VM (Paris)', false, true, 'paris', 'settingsVMParisMode', titleVM)
await addProvider('vm-london', 'Remix VM (London)', false, true, 'london', 'settingsVMLondonMode', titleVM) await addProvider('vm-london', 'Remix VM (London)', false, true, 'london', 'settingsVMLondonMode', titleVM)
await addProvider('vm-berlin', 'Remix VM (Berlin)', false, true, 'berlin', 'settingsVMBerlinMode', titleVM) await addProvider('vm-berlin', 'Remix VM (Berlin)', false, true, 'berlin', 'settingsVMBerlinMode', titleVM)
await addProvider('vm-mainnet-fork', 'Remix VM - Mainnet fork', false, true, 'merge', 'settingsVMMainnetMode', titleVM) await addProvider('vm-mainnet-fork', 'Remix VM - Mainnet fork', false, true, 'cancun', 'settingsVMMainnetMode', titleVM)
await addProvider('vm-sepolia-fork', 'Remix VM - Sepolia fork', false, true, 'merge', 'settingsVMSepoliaMode', titleVM) await addProvider('vm-sepolia-fork', 'Remix VM - Sepolia fork', false, true, 'cancun', 'settingsVMSepoliaMode', titleVM)
await addProvider('vm-goerli-fork', 'Remix VM - Goerli fork', false, true, 'merge', 'settingsVMGoerliMode', titleVM) await addProvider('vm-goerli-fork', 'Remix VM - Goerli fork', false, true, 'paris', 'settingsVMGoerliMode', titleVM)
await addProvider('vm-custom-fork', 'Remix VM - Custom fork', false, true, '', 'settingsVMCustomMode', titleVM) await addProvider('vm-custom-fork', 'Remix VM - Custom fork', false, true, '', 'settingsVMCustomMode', titleVM)
// wallet connect // wallet connect

@ -1091,9 +1091,22 @@
"bzzr://c604bdd6384bf73594cd0e5cfbe979048191549ebc88e70996346f3b744c0680", "bzzr://c604bdd6384bf73594cd0e5cfbe979048191549ebc88e70996346f3b744c0680",
"dweb:/ipfs/QmW2SQbEhiz3n2qV5iL8WBgzapv6cXjkLStvTMpCZhvr2x" "dweb:/ipfs/QmW2SQbEhiz3n2qV5iL8WBgzapv6cXjkLStvTMpCZhvr2x"
] ]
},
{
"path": "soljson-v0.8.25+commit.b61c2a91.js",
"version": "0.8.25",
"build": "commit.b61c2a91",
"longVersion": "0.8.25+commit.b61c2a91",
"keccak256": "0x4639103a26b2f669bd3ecc22b1a1665819f2a2956f917ab91380bd9565dbcd01",
"sha256": "0xf8c9554471ff2db3843167dffb7a503293b5dc728c8305b044ef9fd37d626ca7",
"urls": [
"bzzr://d201e60bd46193b11382988a854132b9e7fb0e1574cc766cb7f9efe8e44a680c",
"dweb:/ipfs/QmdduJxmPXungjJk2FBDw1bdDQ6ucHxYGLXRMBJqMFW7h9"
]
} }
], ],
"releases": { "releases": {
"0.8.25": "soljson-v0.8.25+commit.b61c2a91.js",
"0.8.24": "soljson-v0.8.24+commit.e11b9ed9.js", "0.8.24": "soljson-v0.8.24+commit.e11b9ed9.js",
"0.8.23": "soljson-v0.8.23+commit.f704f362.js", "0.8.23": "soljson-v0.8.23+commit.f704f362.js",
"0.8.22": "soljson-v0.8.22+commit.4fc1097e.js", "0.8.22": "soljson-v0.8.22+commit.4fc1097e.js",
@ -1186,5 +1199,5 @@
"0.4.0": "soljson-v0.4.0+commit.acd334c9.js", "0.4.0": "soljson-v0.4.0+commit.acd334c9.js",
"0.3.6": "soljson-v0.3.6+commit.3fc68da5.js" "0.3.6": "soljson-v0.3.6+commit.3fc68da5.js"
}, },
"latestRelease": "0.8.24" "latestRelease": "0.8.25"
} }

@ -1,7 +1,7 @@
import React from 'react' // eslint-disable-line import React from 'react' // eslint-disable-line
import {fromWei, toBigInt, toWei} from 'web3-utils' import {fromWei, toBigInt, toWei} from 'web3-utils'
import {Plugin} from '@remixproject/engine' import {Plugin} from '@remixproject/engine'
import {toBuffer, addHexPrefix} from '@ethereumjs/util' import {toBytes, addHexPrefix} from '@ethereumjs/util'
import {EventEmitter} from 'events' import {EventEmitter} from 'events'
import {format} from 'util' import {format} from 'util'
import {ExecutionContext} from './execution-context' import {ExecutionContext} from './execution-context'
@ -906,9 +906,12 @@ export class Blockchain extends Plugin {
let returnValue = null let returnValue = null
if (isVM) { if (isVM) {
if (!tx.useCall && this.config.get('settings/save-evm-state')) { if (!tx.useCall && this.config.get('settings/save-evm-state')) {
await this.executionContext.getStateDetails().then((state) => { try {
const state = await this.executionContext.getStateDetails()
this.call('fileManager', 'writeFile', `.states/${this.executionContext.getProvider()}/state.json`, state) this.call('fileManager', 'writeFile', `.states/${this.executionContext.getProvider()}/state.json`, state)
}) } catch (e) {
console.error(e)
}
} }
const hhlogs = await this.web3().remix.getHHLogsForTx(txResult.transactionHash) const hhlogs = await this.web3().remix.getHHLogsForTx(txResult.transactionHash)
@ -941,8 +944,8 @@ export class Blockchain extends Plugin {
if (execResult) { if (execResult) {
// if it's not the VM, we don't have return value. We only have the transaction, and it does not contain the return value. // if it's not the VM, we don't have return value. We only have the transaction, and it does not contain the return value.
returnValue = execResult returnValue = execResult
? toBuffer(execResult.returnValue) ? toBytes(execResult.returnValue)
: toBuffer(addHexPrefix(txResult.result) || '0x0000000000000000000000000000000000000000000000000000000000000000') : toBytes(addHexPrefix(txResult.result) || '0x0000000000000000000000000000000000000000000000000000000000000000')
const compiledContracts = await this.call('compilerArtefacts', 'getAllContractDatas') const compiledContracts = await this.call('compilerArtefacts', 'getAllContractDatas')
const vmError = txExecution.checkError({ errorMessage: execResult.exceptionError ? execResult.exceptionError.error : '', errorData: execResult.returnValue }, compiledContracts) const vmError = txExecution.checkError({ errorMessage: execResult.exceptionError ? execResult.exceptionError.error : '', errorData: execResult.returnValue }, compiledContracts)
if (vmError.error) { if (vmError.error) {
@ -951,7 +954,7 @@ export class Blockchain extends Plugin {
} }
} }
if (!isVM && tx && tx.useCall) { if (!isVM && tx && tx.useCall) {
returnValue = toBuffer(addHexPrefix(txResult.result)) returnValue = toBytes(addHexPrefix(txResult.result))
} }
let address = null let address = null

@ -3,7 +3,7 @@
import Web3 from 'web3' import Web3 from 'web3'
import { execution } from '@remix-project/remix-lib' import { execution } from '@remix-project/remix-lib'
import EventManager from '../lib/events' import EventManager from '../lib/events'
import {bufferToHex} from '@ethereumjs/util' import { bytesToHex } from '@ethereumjs/util'
const _paq = window._paq = window._paq || [] const _paq = window._paq = window._paq || []
let web3 let web3
@ -23,11 +23,11 @@ web3.eth.setConfig(config)
export class ExecutionContext { export class ExecutionContext {
constructor () { constructor () {
this.event = new EventManager() this.event = new EventManager()
this.executionContext = 'vm-shanghai' this.executionContext = 'vm-cancun'
this.lastBlock = null this.lastBlock = null
this.blockGasLimitDefault = 4300000 this.blockGasLimitDefault = 4300000
this.blockGasLimit = this.blockGasLimitDefault this.blockGasLimit = this.blockGasLimitDefault
this.currentFork = 'shanghai' this.currentFork = 'cancun'
this.mainNetGenesisHash = '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3' this.mainNetGenesisHash = '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3'
this.customNetWorks = {} this.customNetWorks = {}
this.blocks = {} this.blocks = {}
@ -37,7 +37,7 @@ export class ExecutionContext {
} }
init (config) { init (config) {
this.executionContext = 'vm-shanghai' this.executionContext = 'vm-cancun'
this.event.trigger('contextChanged', [this.executionContext]) this.event.trigger('contextChanged', [this.executionContext])
} }
@ -114,7 +114,7 @@ export class ExecutionContext {
removeProvider (name) { removeProvider (name) {
if (name && this.customNetWorks[name]) { if (name && this.customNetWorks[name]) {
if (this.executionContext === name) this.setContext('vm-merge', null, null, null) if (this.executionContext === name) this.setContext('vm-cancun', null, null, null)
delete this.customNetWorks[name] delete this.customNetWorks[name]
this.event.trigger('removeProvider', [name]) this.event.trigger('removeProvider', [name])
} }
@ -174,7 +174,7 @@ export class ExecutionContext {
try { try {
this.currentFork = execution.forkAt(await web3.eth.net.getId(), block.number) this.currentFork = execution.forkAt(await web3.eth.net.getId(), block.number)
} catch (e) { } catch (e) {
this.currentFork = 'merge' this.currentFork = 'cancun'
console.log(`unable to detect fork, defaulting to ${this.currentFork}..`) console.log(`unable to detect fork, defaulting to ${this.currentFork}..`)
console.error(e) console.error(e)
} }
@ -207,10 +207,10 @@ export class ExecutionContext {
} }
async getStateDetails() { async getStateDetails() {
const db = await this.web3().remix.getStateDb() const stateDb = await this.web3().remix.getStateDb()
const blocksData = await this.web3().remix.getBlocksData() const blocksData = await this.web3().remix.getBlocksData()
const state = { const state = {
db: Object.fromEntries(db._database), db: Object.fromEntries(stateDb.db._database),
blocks: blocksData.blocks, blocks: blocksData.blocks,
latestBlockNumber: blocksData.latestBlockNumber latestBlockNumber: blocksData.latestBlockNumber
} }
@ -218,11 +218,17 @@ export class ExecutionContext {
if (key === 'db') { if (key === 'db') {
return value return value
} else if (key === 'blocks') { } else if (key === 'blocks') {
return value.map(block => bufferToHex(block)) return value.map(block => bytesToHex(block))
}else if (key === '') { } else if (key === '') {
return value return value
} }
return bufferToHex(value) if (typeof value === 'string') {
return value.startsWith('0x') ? value : '0x' + value
} else if (typeof value === 'number') {
return '0x' + value.toString(16)
} else {
return bytesToHex(value)
}
}, '\t') }, '\t')
return stringifyed return stringifyed

@ -1,5 +1,5 @@
import Web3 from 'web3' import Web3 from 'web3'
import { hashPersonalMessage, isHexString } from '@ethereumjs/util' import { hashPersonalMessage, isHexString, bytesToHex } from '@ethereumjs/util'
import { ExecutionContext } from '../execution-context' import { ExecutionContext } from '../execution-context'
export class InjectedProvider { export class InjectedProvider {
@ -42,7 +42,7 @@ export class InjectedProvider {
try { try {
message = isHexString(message) ? message : Web3.utils.utf8ToHex(message) message = isHexString(message) ? message : Web3.utils.utf8ToHex(message)
this.executionContext.web3().eth.personal.sign(message, account).then((error, signedData) => { this.executionContext.web3().eth.personal.sign(message, account).then((error, signedData) => {
cb(error, '0x' + messageHash.toString('hex'), signedData) cb(error, bytesToHex(messageHash), signedData)
}).catch((error => cb(error))) }).catch((error => cb(error)))
} catch (e) { } catch (e) {
cb(e.message) cb(e.message)

@ -1,5 +1,5 @@
import Web3 from 'web3' import Web3 from 'web3'
import { hashPersonalMessage, isHexString } from '@ethereumjs/util' import { hashPersonalMessage, isHexString, bytesToHex } from '@ethereumjs/util'
import { Personal } from 'web3-eth-personal' import { Personal } from 'web3-eth-personal'
import { ExecutionContext } from '../execution-context' import { ExecutionContext } from '../execution-context'
import Config from '../../config' import Config from '../../config'
@ -49,8 +49,8 @@ export class NodeProvider {
const personal = new Personal(this.executionContext.web3().currentProvider) const personal = new Personal(this.executionContext.web3().currentProvider)
message = isHexString(message) ? message : Web3.utils.utf8ToHex(message) message = isHexString(message) ? message : Web3.utils.utf8ToHex(message)
personal.sign(message, account, passphrase) personal.sign(message, account, passphrase)
.then(signedData => cb(undefined, '0x' + messageHash.toString('hex'), signedData)) .then(signedData => cb(undefined, bytesToHex(messageHash), signedData))
.catch(error => cb(error, '0x' + messageHash.toString('hex'), undefined)) .catch(error => cb(error, bytesToHex(messageHash), undefined))
} catch (e) { } catch (e) {
cb(e.message) cb(e.message)
} }

@ -1,8 +1,7 @@
import Web3, { FMT_BYTES, FMT_NUMBER, LegacySendAsyncProvider } from 'web3' import Web3, { FMT_BYTES, FMT_NUMBER, LegacySendAsyncProvider } from 'web3'
import { fromWei, toBigInt } from 'web3-utils' import { fromWei, toBigInt } from 'web3-utils'
import { privateToAddress, hashPersonalMessage, isHexString } from '@ethereumjs/util' import { privateToAddress, hashPersonalMessage, isHexString, bytesToHex } from '@ethereumjs/util'
import { extend, JSONRPCRequestPayload, JSONRPCResponseCallback } from '@remix-project/remix-simulator' import { extend, JSONRPCRequestPayload, JSONRPCResponseCallback } from '@remix-project/remix-simulator'
import {toBuffer} from '@ethereumjs/util'
import { ExecutionContext } from '../execution-context' import { ExecutionContext } from '../execution-context'
export class VMProvider { export class VMProvider {
@ -110,7 +109,7 @@ export class VMProvider {
const { privateKey, balance } = newAccount const { privateKey, balance } = newAccount
this.worker.postMessage({ cmd: 'addAccount', privateKey: privateKey, balance }) this.worker.postMessage({ cmd: 'addAccount', privateKey: privateKey, balance })
const privKey = Buffer.from(privateKey, 'hex') const privKey = Buffer.from(privateKey, 'hex')
return '0x' + privateToAddress(privKey).toString('hex') return bytesToHex(privateToAddress(privKey))
} }
newAccount (_passwordPromptCb, cb) { newAccount (_passwordPromptCb, cb) {
@ -133,7 +132,7 @@ export class VMProvider {
const messageHash = hashPersonalMessage(Buffer.from(message)) const messageHash = hashPersonalMessage(Buffer.from(message))
message = isHexString(message) ? message : Web3.utils.utf8ToHex(message) message = isHexString(message) ? message : Web3.utils.utf8ToHex(message)
this.web3.eth.sign(message, account) this.web3.eth.sign(message, account)
.then(signedData => cb(null, '0x' + messageHash.toString('hex'), signedData)) .then(signedData => cb(null, bytesToHex(messageHash), signedData))
.catch(error => cb(error)) .catch(error => cb(error))
} }

@ -1,5 +1,5 @@
var async = require('async') var async = require('async')
import { toChecksumAddress } from '@ethereumjs/util' import { toChecksumAddress, bytesToHex } from '@ethereumjs/util'
export default { export default {
shortenAddress: function (address, etherBalance) { shortenAddress: function (address, etherBalance) {
@ -9,7 +9,7 @@ export default {
addressToString: function (address) { addressToString: function (address) {
if (!address) return null if (!address) return null
if (typeof address !== 'string') { if (typeof address !== 'string') {
address = address.toString('hex') address = bytesToHex(address)
} }
if (address.indexOf('0x') === -1) { if (address.indexOf('0x') === -1) {
address = '0x' + address address = '0x' + address

@ -62,7 +62,7 @@ let requiredModules = [ // services + layout views + system views
'vm-goerli-fork', 'vm-goerli-fork',
'vm-mainnet-fork', 'vm-mainnet-fork',
'vm-sepolia-fork', 'vm-sepolia-fork',
'vm-merge', 'vm-paris',
'vm-london', 'vm-london',
'vm-berlin', 'vm-berlin',
'vm-shanghai', 'vm-shanghai',

@ -27,7 +27,7 @@ export class RemixEngine extends Engine {
if (name === 'filePanel') return { queueTimeout: 60000 * 20 } if (name === 'filePanel') return { queueTimeout: 60000 * 20 }
if (name === 'fileManager') return { queueTimeout: 60000 * 20 } if (name === 'fileManager') return { queueTimeout: 60000 * 20 }
if (name === 'openaigpt') return { queueTimeout: 60000 * 2 } if (name === 'openaigpt') return { queueTimeout: 60000 * 2 }
if (name === 'cookbookdev') return { queueTimeout: 60000 * 2 } if (name === 'cookbookdev') return { queueTimeout: 60000 * 3 }
return { queueTimeout: 10000 } return { queueTimeout: 10000 }
} }

@ -6,7 +6,7 @@ const version = require('../../package.json').version
const fs = require('fs') const fs = require('fs')
const TerserPlugin = require('terser-webpack-plugin') const TerserPlugin = require('terser-webpack-plugin')
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin') const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
const axios = require('axios') const path = require('path')
const versionData = { const versionData = {
version: version, version: version,
@ -16,9 +16,10 @@ const versionData = {
const loadLocalSolJson = async () => { const loadLocalSolJson = async () => {
//execute apps/remix-ide/ci/downloadsoljson.sh //execute apps/remix-ide/ci/downloadsoljson.sh
console.log('loading local soljson')
const child = require('child_process').execSync('bash ' + __dirname + '/ci/downloadsoljson.sh', { encoding: 'utf8', cwd: process.cwd(), shell: true }) const child = require('child_process').execSync('bash ' + __dirname + '/ci/downloadsoljson.sh', { encoding: 'utf8', cwd: process.cwd(), shell: true })
// show output // show output
//console.log(child) console.log(child)
} }
fs.writeFileSync(__dirname + '/src/assets/version.json', JSON.stringify(versionData)) fs.writeFileSync(__dirname + '/src/assets/version.json', JSON.stringify(versionData))
@ -74,7 +75,7 @@ module.exports = composePlugins(withNx(), withReact(), (config) => {
// add externals // add externals
config.externals = { config.externals = {
...config.externals, ...config.externals,
solc: 'solc' solc: 'solc',
} }
// uncomment this to enable react profiling // uncomment this to enable react profiling
@ -85,6 +86,17 @@ module.exports = composePlugins(withNx(), withReact(), (config) => {
} }
*/ */
// use the web build instead of the node.js build
// we do like that because using "config.resolve.alias" doesn't work
let pkgVerkle = fs.readFileSync(path.resolve(__dirname, '../../node_modules/rust-verkle-wasm/package.json'), 'utf8')
pkgVerkle = pkgVerkle.replace('"main": "./nodejs/rust_verkle_wasm.js",', '"main": "./web/rust_verkle_wasm.js",')
fs.writeFileSync(path.resolve(__dirname, '../../node_modules/rust-verkle-wasm/package.json'), pkgVerkle)
config.resolve.alias = {
...config.resolve.alias,
// 'rust-verkle-wasm$': path.resolve(__dirname, '../../node_modules/rust-verkle-wasm/web/run_verkle_wasm.js')
}
// add public path // add public path
if(process.env.NX_DESKTOP_FROM_DIST){ if(process.env.NX_DESKTOP_FROM_DIST){
@ -112,7 +124,7 @@ module.exports = composePlugins(withNx(), withReact(), (config) => {
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'], Buffer: ['buffer', 'Buffer'],
url: ['url', 'URL'], url: ['url', 'URL'],
process: 'process/browser', process: 'process/browser'
}) })
) )

@ -21,10 +21,10 @@
} }
], ],
"dependencies": { "dependencies": {
"@ethereumjs/block": "^4.2.0", "@ethereumjs/block": "5.2.0",
"@ethereumjs/tx": "^4.1.1", "@ethereumjs/tx": "5.3.0",
"@ethereumjs/util": "^8.0.5", "@ethereumjs/util": "9.0.3",
"@ethereumjs/vm": "^6.4.1", "@ethereumjs/vm": "8.0.0",
"@remix-project/remix-astwalker": "^0.0.74", "@remix-project/remix-astwalker": "^0.0.74",
"@remix-project/remix-lib": "^0.5.51", "@remix-project/remix-lib": "^0.5.51",
"async": "^2.6.2", "async": "^2.6.2",

@ -33,10 +33,10 @@
] ]
}, },
"dependencies": { "dependencies": {
"@ethereumjs/block": "^4.2.0", "@ethereumjs/block": "5.2.0",
"@ethereumjs/tx": "^4.1.1", "@ethereumjs/tx": "5.3.0",
"@ethereumjs/util": "^8.0.5", "@ethereumjs/util": "9.0.3",
"@ethereumjs/vm": "^6.4.1", "@ethereumjs/vm": "8.0.0",
"@remix-project/remix-lib": "^0.5.51", "@remix-project/remix-lib": "^0.5.51",
"@types/tape": "^4.2.33", "@types/tape": "^4.2.33",
"async": "^2.6.2", "async": "^2.6.2",

@ -21,11 +21,11 @@
"test": "./../../node_modules/.bin/ts-node --project ../../tsconfig.base.json --require tsconfig-paths/register ./../../node_modules/.bin/tape ./test/tests.ts" "test": "./../../node_modules/.bin/ts-node --project ../../tsconfig.base.json --require tsconfig-paths/register ./../../node_modules/.bin/tape ./test/tests.ts"
}, },
"dependencies": { "dependencies": {
"@ethereumjs/block": "^4.2.0", "@ethereumjs/block": "5.2.0",
"@ethereumjs/common": "^3.1.1", "@ethereumjs/common": "4.3.0",
"@ethereumjs/tx": "^4.1.1", "@ethereumjs/tx": "5.3.0",
"@ethereumjs/util": "^8.0.5", "@ethereumjs/util": "9.0.3",
"@ethereumjs/vm": "^6.4.1", "@ethereumjs/vm": "8.0.0",
"@remix-project/remix-astwalker": "^0.0.74", "@remix-project/remix-astwalker": "^0.0.74",
"@remix-project/remix-lib": "^0.5.51", "@remix-project/remix-lib": "^0.5.51",
"@remix-project/remix-simulator": "^0.2.44", "@remix-project/remix-simulator": "^0.2.44",

@ -1,6 +1,8 @@
'use strict' 'use strict'
import { bytesToHex } from '@ethereumjs/util'
import { Common } from '@ethereumjs/common' import { Common } from '@ethereumjs/common'
import { getOpcodesForHF, OpcodeList } from '@ethereumjs/evm/dist/opcodes/codes' // TODO fix the import when getOpcodesForHF is exported
import { getOpcodesForHF } from '@ethereumjs/evm'
import getOpcodes from './opcodes' import getOpcodes from './opcodes'
export function nameOpCodes (raw, hardfork) { export function nameOpCodes (raw, hardfork) {
@ -27,7 +29,8 @@ export function nameOpCodes (raw, hardfork) {
i += jumpNum i += jumpNum
} }
const data = (pushData as any).toString('hex') !== '' ? ' ' + (pushData as any).toString('hex') : '' const hexCode = bytesToHex((pushData as any))
const data = hexCode !== '' ? ' ' + hexCode : ''
code.push(pad(pc, roundLog(raw.length, 10)) + ' ' + curOpCode + data) code.push(pad(pc, roundLog(raw.length, 10)) + ' ' + curOpCode + data)
pushData = '' pushData = ''
@ -46,7 +49,7 @@ type Opcode = {
* information about the opcode. * information about the opcode.
*/ */
export function parseCode (raw) { export function parseCode (raw) {
const common = new Common({ chain: 'mainnet', hardfork: 'merge' }) const common = new Common({ chain: 'mainnet', hardfork: 'cancun' })
const opcodes = getOpcodesForHF(common).opcodes const opcodes = getOpcodesForHF(common).opcodes
const code = [] const code = []

@ -2,7 +2,7 @@
import { parseCode } from './codeUtils' import { parseCode } from './codeUtils'
import { util } from '@remix-project/remix-lib' import { util } from '@remix-project/remix-lib'
import { bufferToHex } from '@ethereumjs/util' import { bytesToHex } from '@ethereumjs/util'
function createExpressions (instructions) { function createExpressions (instructions) {
const expressions = [] const expressions = []
@ -37,7 +37,7 @@ function createExpressions (instructions) {
function toString (expr) { function toString (expr) {
if (expr.name.slice(0, 4) === 'PUSH') { if (expr.name.slice(0, 4) === 'PUSH') {
return bufferToHex(expr.pushData) return bytesToHex(expr.pushData)
} else if (expr.name === 'JUMPDEST') { } else if (expr.name === 'JUMPDEST') {
return expr.label + ':' return expr.label + ':'
} else if (expr.args) { } else if (expr.args) {

@ -2,7 +2,7 @@
import { hash } from '@remix-project/remix-lib' import { hash } from '@remix-project/remix-lib'
import { RefType } from './RefType' import { RefType } from './RefType'
import { normalizeHex } from './util' import { normalizeHex } from './util'
import { toBuffer, setLengthLeft, bufferToHex, addHexPrefix } from '@ethereumjs/util' import { toBytes, setLengthLeft, bytesToHex, addHexPrefix } from '@ethereumjs/util'
import BN from 'bn.js' import BN from 'bn.js'
export class Mapping extends RefType { export class Mapping extends RefType {
@ -44,7 +44,7 @@ export class Mapping extends RefType {
} }
async decodeMappingsLocation (preimages, location, storageResolver) { async decodeMappingsLocation (preimages, location, storageResolver) {
const mapSlot = normalizeHex(bufferToHex(location.slot)) const mapSlot = normalizeHex('0x' + location.slot.toString(16))
if (!preimages[mapSlot]) { if (!preimages[mapSlot]) {
return {} return {}
} }
@ -66,11 +66,11 @@ function getMappingLocation (key, position) {
// > the value corresponding to a mapping key k is located at keccak256(k . p) where . is concatenation. // > the value corresponding to a mapping key k is located at keccak256(k . p) where . is concatenation.
// key should be a hex string, and position an int // key should be a hex string, and position an int
const mappingK = toBuffer(addHexPrefix(key)) const mappingK = toBytes(addHexPrefix(key))
let mappingP = toBuffer(addHexPrefix(position)) let mappingP = toBytes(addHexPrefix(position))
mappingP = setLengthLeft(mappingP, 32) mappingP = setLengthLeft(mappingP, 32)
const mappingKeyBuf = concatTypedArrays(mappingK, mappingP) const mappingKeyBuf = concatTypedArrays(mappingK, mappingP)
const mappingStorageLocation: Buffer = hash.keccak(mappingKeyBuf) const mappingStorageLocation: Uint8Array = hash.keccak(mappingKeyBuf)
const mappingStorageLocationinBn: BN = new BN(mappingStorageLocation, 16) const mappingStorageLocationinBn: BN = new BN(mappingStorageLocation, 16)
return mappingStorageLocationinBn return mappingStorageLocationinBn
} }

@ -1,5 +1,5 @@
'use strict' 'use strict'
import { bufferToHex, unpadHexString } from '@ethereumjs/util' import { unpadHex } from '@ethereumjs/util'
import BN from 'bn.js' import BN from 'bn.js'
export function decodeIntFromHex (value, byteLength, signed) { export function decodeIntFromHex (value, byteLength, signed) {
@ -11,7 +11,7 @@ export function decodeIntFromHex (value, byteLength, signed) {
} }
export function readFromStorage (slot, storageResolver): Promise<string> { export function readFromStorage (slot, storageResolver): Promise<string> {
const hexSlot = '0x' + normalizeHex(bufferToHex(slot)) const hexSlot = '0x' + normalizeHex(slot.toString(16))
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
storageResolver.storageSlot(hexSlot, (error, slot) => { storageResolver.storageSlot(hexSlot, (error, slot) => {
if (error) { if (error) {
@ -58,7 +58,7 @@ export function toBN (value) {
if (value instanceof BN) { if (value instanceof BN) {
return value return value
} else if (value.match && value.match(/^(0x)?([a-f0-9]*)$/)) { } else if (value.match && value.match(/^(0x)?([a-f0-9]*)$/)) {
value = unpadHexString(value) value = unpadHex(value)
value = value.replace('0x', '') value = value.replace('0x', '')
value = new BN(value === '' ? '0' : value, 16) value = new BN(value === '' ? '0' : value, 16)
} else if (!isNaN(value)) { } else if (!isNaN(value)) {

@ -44,7 +44,7 @@ export function isSSTOREInstruction (step) {
} }
export function isSHA3Instruction (step) { export function isSHA3Instruction (step) {
return step.op === 'SHA3' return step.op === 'SHA3' || step.op === 'KECCAK256'
} }
export function newContextStorage (step) { export function newContextStorage (step) {

@ -40,7 +40,7 @@ export class TraceManager {
const networkId = await this.web3.eth.net.getId() const networkId = await this.web3.eth.net.getId()
this.fork = execution.forkAt(networkId, tx.blockNumber) this.fork = execution.forkAt(networkId, tx.blockNumber)
} catch (e) { } catch (e) {
this.fork = 'merge' this.fork = 'cancun'
console.log(`unable to detect fork, defaulting to ${this.fork}..`) console.log(`unable to detect fork, defaulting to ${this.fork}..`)
console.error(e) console.error(e)
} }

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

@ -17,7 +17,7 @@
"test": "./../../node_modules/.bin/ts-node --require tsconfig-paths/register ./../../node_modules/.bin/tape ./test/tests.ts" "test": "./../../node_modules/.bin/ts-node --require tsconfig-paths/register ./../../node_modules/.bin/tape ./test/tests.ts"
}, },
"dependencies": { "dependencies": {
"@ethereumjs/util": "^8.0.5", "@ethereumjs/util": "9.0.3",
"async": "^2.1.2", "async": "^2.1.2",
"create-hash": "^1.2.0", "create-hash": "^1.2.0",
"ethers": "^5.7.2", "ethers": "^5.7.2",

@ -61,7 +61,15 @@ const forks = {
}, },
{ {
number: 15537394, number: 15537394,
name: 'merge' name: 'paris'
},
{
number: 17034870,
name: 'shanghai'
},
{
number: 19426587,
name: 'cancun'
} }
], ],
3: [ 3: [

@ -1,6 +1,6 @@
import { eachOf } from 'async' import { eachOf } from 'async'
import { randomBytes } from 'crypto' import { randomBytes } from 'crypto'
import { toChecksumAddress } from '@ethereumjs/util' import { toChecksumAddress, bytesToHex } from '@ethereumjs/util'
export class LogsManager { export class LogsManager {
notificationCallbacks notificationCallbacks
@ -19,7 +19,7 @@ export class LogsManager {
checkBlock (blockNumber, block, web3) { checkBlock (blockNumber, block, web3) {
eachOf(block.transactions, (tx: any, i, next) => { eachOf(block.transactions, (tx: any, i, next) => {
const txHash = '0x' + tx.hash().toString('hex') const txHash = bytesToHex(tx.hash())
web3.eth.getTransactionReceipt(txHash, (_error, receipt) => { web3.eth.getTransactionReceipt(txHash, (_error, receipt) => {
if (!receipt) return next() if (!receipt) return next()
for (const log of receipt.logs) { for (const log of receipt.logs) {
@ -29,8 +29,8 @@ export class LogsManager {
const result = { const result = {
logIndex: '0x1', // 1 logIndex: '0x1', // 1
blockNumber: blockNumber, blockNumber: blockNumber,
blockHash: ('0x' + block.hash().toString('hex')), blockHash: bytesToHex(block.hash()),
transactionHash: ('0x' + tx.hash().toString('hex')), transactionHash: bytesToHex(tx.hash()),
transactionIndex: '0x' + i.toString(16), transactionIndex: '0x' + i.toString(16),
// TODO: if it's a contract deploy, it should be that address instead // TODO: if it's a contract deploy, it should be that address instead
address: log.address, address: log.address,
@ -140,7 +140,7 @@ export class LogsManager {
if (filterType === 'block') { if (filterType === 'block') {
const blocks = this.oldLogs.filter(x => x.type === 'block').filter(x => tracking.block === undefined || x.blockNumber >= tracking.block) const blocks = this.oldLogs.filter(x => x.type === 'block').filter(x => tracking.block === undefined || x.blockNumber >= tracking.block)
tracking.block = blocks[blocks.length - 1] tracking.block = blocks[blocks.length - 1]
return blocks.map(block => ('0x' + block.hash().toString('hex'))) return blocks.map(block => bytesToHex(block.hash()))
} }
if (filterType === 'pendingTransactions') { if (filterType === 'pendingTransactions') {
return [] return []
@ -148,13 +148,13 @@ export class LogsManager {
} }
getLogsByTxHash (hash) { getLogsByTxHash (hash) {
return this.oldLogs.filter((log) => '0x' + log.tx.hash().toString('hex') === hash) return this.oldLogs.filter((log) => bytesToHex(log.tx.hash()) === hash)
.map((log) => { .map((log) => {
return { return {
logIndex: '0x1', // 1 logIndex: '0x1', // 1
blockNumber: log.blockNumber, blockNumber: log.blockNumber,
blockHash: ('0x' + log.block.hash().toString('hex')), blockHash: bytesToHex(log.block.hash()),
transactionHash: ('0x' + log.tx.hash().toString('hex')), transactionHash: bytesToHex(log.tx.hash()),
transactionIndex: '0x' + log.txNumber.toString(16), transactionIndex: '0x' + log.txNumber.toString(16),
// TODO: if it's a contract deploy, it should be that address instead // TODO: if it's a contract deploy, it should be that address instead
address: log.log.address, address: log.log.address,
@ -171,8 +171,8 @@ export class LogsManager {
results.push({ results.push({
logIndex: '0x1', // 1 logIndex: '0x1', // 1
blockNumber: log.blockNumber, blockNumber: log.blockNumber,
blockHash: ('0x' + log.block.hash().toString('hex')), blockHash: bytesToHex(log.block.hash()),
transactionHash: ('0x' + log.tx.hash().toString('hex')), transactionHash: bytesToHex(log.tx.hash()),
transactionIndex: '0x' + log.txNumber.toString(16), transactionIndex: '0x' + log.txNumber.toString(16),
// TODO: if it's a contract deploy, it should be that address instead // TODO: if it's a contract deploy, it should be that address instead
address: log.log.address, address: log.log.address,

@ -1,6 +1,6 @@
'use strict' 'use strict'
import { ethers } from 'ethers' import { ethers } from 'ethers'
import { toBuffer, addHexPrefix } from '@ethereumjs/util' import { toBytes, addHexPrefix } from '@ethereumjs/util'
import { EventManager } from '../eventManager' import { EventManager } from '../eventManager'
import { compareByteCode, getinputParameters } from '../util' import { compareByteCode, getinputParameters } from '../util'
import { decodeResponse } from './txFormat' import { decodeResponse } from './txFormat'
@ -64,9 +64,9 @@ export class TxListener {
let execResult let execResult
if (this.executionContext.isVM()) { if (this.executionContext.isVM()) {
execResult = await this.executionContext.web3().remix.getExecutionResultFromSimulator(txResult.transactionHash) execResult = await this.executionContext.web3().remix.getExecutionResultFromSimulator(txResult.transactionHash)
returnValue = toBuffer(execResult.returnValue) returnValue = toBytes(execResult.returnValue)
} else { } else {
returnValue = toBuffer(addHexPrefix(txResult.result)) returnValue = toBytes(addHexPrefix(txResult.result))
} }
const call = { const call = {
from: from, from: from,
@ -374,7 +374,7 @@ export class TxListener {
} }
_decodeInputParams (data, abi) { _decodeInputParams (data, abi) {
data = toBuffer(addHexPrefix(data)) data = toBytes(addHexPrefix(data))
if (!data.length) data = new Uint8Array(32 * abi.inputs.length) // ensuring the data is at least filled by 0 cause `AbiCoder` throws if there's not enough data if (!data.length) data = new Uint8Array(32 * abi.inputs.length) // ensuring the data is at least filled by 0 cause `AbiCoder` throws if there's not enough data
const inputTypes = [] const inputTypes = []

@ -1,9 +1,10 @@
'use strict' 'use strict'
import { RunBlockResult, RunTxResult } from '@ethereumjs/vm' import { RunBlockResult, RunTxResult } from '@ethereumjs/vm'
import { ConsensusType } from '@ethereumjs/common' import { ConsensusType } from '@ethereumjs/common'
import { Transaction, FeeMarketEIP1559Transaction } from '@ethereumjs/tx' import { LegacyTransaction, FeeMarketEIP1559Transaction } from '@ethereumjs/tx'
import { Block } from '@ethereumjs/block' import { Block } from '@ethereumjs/block'
import { bufferToHex, Address } from '@ethereumjs/util' import { bytesToHex, Address, hexToBytes } from '@ethereumjs/util'
import { EVM } from '@ethereumjs/evm'
import type { Account } from '@ethereumjs/util' import type { Account } from '@ethereumjs/util'
import { EventManager } from '../eventManager' import { EventManager } from '../eventManager'
import { LogsManager } from './logsManager' import { LogsManager } from './logsManager'
@ -13,7 +14,7 @@ export type VMexecutionResult = {
result: RunTxResult, result: RunTxResult,
transactionHash: string transactionHash: string
block: Block, block: Block,
tx: Transaction tx: LegacyTransaction
} }
export type VMExecutionCallBack = (error: string | Error, result?: VMexecutionResult) => void export type VMExecutionCallBack = (error: string | Error, result?: VMexecutionResult) => void
@ -24,20 +25,20 @@ export class TxRunnerVM {
pendingTxs pendingTxs
vmaccounts vmaccounts
queusTxs queusTxs
blocks: Buffer[] blocks: Uint8Array[]
logsManager logsManager
commonContext commonContext
blockParentHash blockParentHash
nextNonceForCall: number nextNonceForCall: number
standaloneTx: boolean
getVMObject: () => any getVMObject: () => any
constructor (vmaccounts, api, getVMObject, blocks: Buffer[] = []) { constructor (vmaccounts, api, getVMObject, blocks: Uint8Array[] = []) {
this.event = new EventManager() this.event = new EventManager()
this.logsManager = new LogsManager() this.logsManager = new LogsManager()
// has a default for now for backwards compatibility // has a default for now for backwards compatibility
this.getVMObject = getVMObject this.getVMObject = getVMObject
this.commonContext = this.getVMObject().common this.commonContext = this.getVMObject().common
this.blockNumber = Array.isArray(blocks) ? blocks.length : 0 // TODO: this should be set to the fetched block number count
this.pendingTxs = {} this.pendingTxs = {}
this.vmaccounts = vmaccounts this.vmaccounts = vmaccounts
this.queusTxs = [] this.queusTxs = []
@ -74,7 +75,7 @@ export class TxRunnerVM {
} }
} }
runInVm (from: string, to: string, data: string, value: string, gasLimit: number, useCall: boolean, callback: VMExecutionCallBack) { async runInVm (from: string, to: string, data: string, value: string, gasLimit: number, useCall: boolean, callback: VMExecutionCallBack) {
let account let account
if (!from && useCall && Object.keys(this.vmaccounts).length) { if (!from && useCall && Object.keys(this.vmaccounts).length) {
from = Object.keys(this.vmaccounts)[0] from = Object.keys(this.vmaccounts)[0]
@ -85,78 +86,90 @@ export class TxRunnerVM {
return callback('Invalid account selected') return callback('Invalid account selected')
} }
this.getVMObject().stateManager.getAccount(Address.fromString(from)).then((res: Account) => { try {
const res = await this.getVMObject().stateManager.getAccount(Address.fromString(from))
const EIP1559 = this.commonContext.hardfork() !== 'berlin' // berlin is the only pre eip1559 fork that we handle. const EIP1559 = this.commonContext.hardfork() !== 'berlin' // berlin is the only pre eip1559 fork that we handle.
let tx let tx
if (!EIP1559) { if (!EIP1559) {
tx = Transaction.fromTxData({ tx = LegacyTransaction.fromTxData({
nonce: useCall ? this.nextNonceForCall : res.nonce, nonce: useCall ? this.nextNonceForCall : res.nonce,
gasPrice: '0x1', gasPrice: '0x1',
gasLimit: gasLimit, gasLimit: gasLimit,
to: to, to: to,
value: value, value: value,
data: Buffer.from(data.slice(2), 'hex') data: hexToBytes(data)
}, { common: this.commonContext }).sign(account.privateKey) }, { common: this.commonContext }).sign(account.privateKey)
} else { } else {
tx = FeeMarketEIP1559Transaction.fromTxData({ tx = FeeMarketEIP1559Transaction.fromTxData({
nonce: useCall ? this.nextNonceForCall : res.nonce, nonce: useCall ? this.nextNonceForCall : res.nonce,
maxPriorityFeePerGas: '0x01', maxPriorityFeePerGas: '0x01',
maxFeePerGas: '0x1', maxFeePerGas: '0x7',
gasLimit: gasLimit, gasLimit: gasLimit,
to: to, to: to,
value: value, value: value,
data: Buffer.from(data.slice(2), 'hex') data: hexToBytes(data)
}).sign(account.privateKey) }).sign(account.privateKey)
} }
if (useCall) this.nextNonceForCall++ if (useCall) this.nextNonceForCall++
const coinbases = ['0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a', '0x8945a1288dc78a6d8952a92c77aee6730b414778', '0x94d76e24f818426ae84aa404140e8d5f60e10e7e'] const coinbases = ['0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a', '0x8945a1288dc78a6d8952a92c77aee6730b414778', '0x94d76e24f818426ae84aa404140e8d5f60e10e7e']
const difficulties = [69762765929000, 70762765929000, 71762765929000] const difficulties = [69762765929000, 70762765929000, 71762765929000]
const difficulty = this.commonContext.consensusType() === ConsensusType.ProofOfStake ? 0 : difficulties[this.blockNumber % difficulties.length] const difficulty = this.commonContext.consensusType() === ConsensusType.ProofOfStake ? 0 : difficulties[this.blocks.length % difficulties.length]
const blocknumber = this.blocks.length
const block = Block.fromBlockData({ const block = Block.fromBlockData({
header: { header: {
timestamp: new Date().getTime() / 1000 | 0, timestamp: new Date().getTime() / 1000 | 0,
number: blocknumber, number: this.blocks.length,
coinbase: coinbases[blocknumber % coinbases.length], coinbase: coinbases[this.blocks.length % coinbases.length],
difficulty, difficulty,
gasLimit, gasLimit,
baseFeePerGas: EIP1559 ? '0x1' : undefined, baseFeePerGas: EIP1559 ? '0x1' : undefined,
parentHash: this.blockParentHash parentHash: this.blockParentHash
}, },
transactions: [tx] transactions: [tx]
}, { common: this.commonContext, hardforkByBlockNumber: false, hardforkByTTD: undefined }) }, { common: this.commonContext })
if (!useCall) { if (!this.standaloneTx) {
this.blockNumber = blocknumber
this.blockParentHash = block.hash() this.blockParentHash = block.hash()
this.runBlockInVm(tx, block, (err, result) => { this.runBlockInVm(tx, block, async (err, result) => {
if (!err) { if (!err) {
this.getVMObject().vm.blockchain.putBlock(block) if (!useCall) {
this.blocks.push(block.serialize()) this.getVMObject().vm.blockchain.putBlock(block)
this.blocks.push(block.serialize())
}
} }
callback(err, result) callback(err, result)
}) })
} else { } else {
this.getVMObject().stateManager.checkpoint().then(() => { await this.getVMObject().vm.evm.journal.checkpoint()
this.runBlockInVm(tx, block, (err, result) => { this.runTxInVm(tx, block, async (err, result) => {
this.getVMObject().stateManager.revert().then(() => { await this.getVMObject().vm.evm.journal.revert()
callback(err, result) callback(err, result)
})
})
}) })
} }
}).catch((e) => { } catch (e) {
callback(e) callback(e)
}
}
runTxInVm (tx, block, callback) {
this.getVMObject().vm.runTx({ tx, skipNonce: true, skipBlockValidation: true, skipBalance: false }).then((result: RunTxResult) => {
callback(null, {
result,
transactionHash: bytesToHex(Buffer.from(tx.hash())),
block,
tx
})
}).catch(function (err) {
callback(err)
}) })
} }
runBlockInVm (tx, block, callback) { runBlockInVm (tx, block, callback) {
this.getVMObject().vm.runBlock({ block: block, generate: true, skipBlockValidation: true, skipBalance: false, skipNonce: true }).then((results: RunBlockResult) => { this.getVMObject().vm.runBlock({ block: block, generate: true, skipNonce: true, skipBlockValidation: true, skipBalance: false }).then((results: RunBlockResult) => {
const result: RunTxResult = results.results[0] const result: RunTxResult = results.results[0]
callback(null, { callback(null, {
result, result,
transactionHash: bufferToHex(Buffer.from(tx.hash())), transactionHash: bytesToHex(Buffer.from(tx.hash())),
block, block,
tx tx
}) })

@ -1,6 +1,6 @@
'use strict' 'use strict'
import { BN } from 'bn.js' import { BN } from 'bn.js'
import { bufferToHex } from '@ethereumjs/util' import { bytesToHex } from '@ethereumjs/util'
import { isBigInt } from 'web3-validator' import { isBigInt } from 'web3-validator'
export function toInt (h) { export function toInt (h) {
@ -27,7 +27,7 @@ function convertToString (v) {
} else if (v._isBigNumber) { } else if (v._isBigNumber) {
return toInt(v._hex) return toInt(v._hex)
} else if (v._isBuffer) { } else if (v._isBuffer) {
return bufferToHex(v) return bytesToHex(v)
} else if (typeof v === 'object') { } else if (typeof v === 'object') {
const retObject = {} const retObject = {}
for (const i in v) { for (const i in v) {

@ -1,27 +1,26 @@
import { keccak224, keccak384, keccak256 as k256, keccak512 } from 'ethereum-cryptography/keccak' import { keccak224, keccak384, keccak256 as k256, keccak512 } from 'ethereum-cryptography/keccak'
const createHash = require('create-hash') const createHash = require('create-hash')
import { encode, Input } from 'rlp' import { encode, Input } from 'rlp'
import { toBuffer, setLengthLeft, isHexString } from '@ethereumjs/util' import { toBytes, setLengthLeft, isHexString } from '@ethereumjs/util'
/** /**
* Creates Keccak hash of a Buffer input * Creates Keccak hash of a Uint8Array input
* @param a The input data (Buffer) * @param a The input data (Uint8Array)
* @param bits (number = 256) The Keccak width * @param bits (number = 256) The Keccak width
*/ */
export const keccak = function(a: Buffer, bits: number = 256): Buffer { export const keccak = function(a: Uint8Array, bits: number = 256): Uint8Array {
assertIsBuffer(a)
switch (bits) { switch (bits) {
case 224: { case 224: {
return toBuffer(keccak224(a)) return toBytes(keccak224(Buffer.from(a)))
} }
case 256: { case 256: {
return toBuffer(k256(a)) return toBytes(k256(Buffer.from(a)))
} }
case 384: { case 384: {
return toBuffer(keccak384(a)) return toBytes(keccak384(Buffer.from(a)))
} }
case 512: { case 512: {
return toBuffer(keccak512(a)) return toBytes(keccak512(Buffer.from(a)))
} }
default: { default: {
throw new Error(`Invalid algorithm: keccak${bits}`) throw new Error(`Invalid algorithm: keccak${bits}`)
@ -33,7 +32,7 @@ export const keccak = function(a: Buffer, bits: number = 256): Buffer {
* Creates Keccak-256 hash of the input, alias for keccak(a, 256). * Creates Keccak-256 hash of the input, alias for keccak(a, 256).
* @param a The input data (Buffer) * @param a The input data (Buffer)
*/ */
export const keccak256 = function(a: Buffer): Buffer { export const keccak256 = function(a: Buffer): Uint8Array {
return keccak(a) return keccak(a)
} }
@ -55,7 +54,7 @@ export const keccakFromString = function(a: string, bits: number = 256) {
*/ */
export const keccakFromHexString = function(a: string, bits: number = 256) { export const keccakFromHexString = function(a: string, bits: number = 256) {
assertIsHexString(a) assertIsHexString(a)
return keccak(toBuffer(a), bits) return keccak(Buffer.from(toBytes(a)), bits)
} }
/** /**
@ -65,7 +64,7 @@ export const keccakFromHexString = function(a: string, bits: number = 256) {
*/ */
export const keccakFromArray = function(a: number[], bits: number = 256) { export const keccakFromArray = function(a: number[], bits: number = 256) {
assertIsArray(a) assertIsArray(a)
return keccak(toBuffer(a), bits) return keccak(Buffer.from(toBytes(a)), bits)
} }
/** /**
@ -73,7 +72,7 @@ export const keccakFromArray = function(a: number[], bits: number = 256) {
* @param a The input data (Buffer|Array|String) * @param a The input data (Buffer|Array|String)
*/ */
const _sha256 = function(a: any): Buffer { const _sha256 = function(a: any): Buffer {
a = toBuffer(a) a = toBytes(a)
return createHash('sha256') return createHash('sha256')
.update(a) .update(a)
.digest() .digest()
@ -112,12 +111,12 @@ export const sha256FromArray = function(a: number[]): Buffer {
* @param padded Whether it should be padded to 256 bits or not * @param padded Whether it should be padded to 256 bits or not
*/ */
const _ripemd160 = function(a: any, padded: boolean): Buffer { const _ripemd160 = function(a: any, padded: boolean): Buffer {
a = toBuffer(a) a = toBytes(a)
const hash = createHash('rmd160') const hash = createHash('rmd160')
.update(a) .update(a)
.digest() .digest()
if (padded === true) { if (padded === true) {
return setLengthLeft(hash, 32) return Buffer.from(setLengthLeft(hash, 32))
} else { } else {
return hash return hash
} }
@ -158,7 +157,7 @@ export const ripemd160FromArray = function(a: number[], padded: boolean): Buffer
* @param a The input data * @param a The input data
*/ */
export const rlphash = function(a: Input): Buffer { export const rlphash = function(a: Input): Buffer {
return keccak(Buffer.from(encode(a))) return Buffer.from(keccak(Buffer.from(encode(a))))
} }
/** /**

@ -1,14 +1,34 @@
'use strict' 'use strict'
import { bufferToHex } from '@ethereumjs/util' import { bytesToHex } from '@ethereumjs/util'
import { isHexString } from 'ethjs-util' import { isHexString } from 'ethjs-util'
import { BN } from 'bn.js'
import { isBigInt } from 'web3-validator'
function convertToPrefixedHex (input) { function convertToPrefixedHex (input) {
if (input === undefined || input === null || isHexString(input)) { if (input === undefined || input === null || isHexString(input)) {
return input return input
} else if (Buffer.isBuffer(input)) {
return bufferToHex(input)
} }
return '0x' + input.toString(16) if ((input.constructor && input.constructor.name === 'BigNumber')
|| BN.isBN(input)
|| isBigInt(input)
|| typeof input === 'number') {
return '0x' + input.toString(16)
}
try {
return bytesToHex(input)
} catch (e) {
console.log(e)
}
try {
// BigNumber
return '0x' + input.toString(16)
} catch (e) {
console.log(e)
}
return input
} }
/* /*
@ -34,10 +54,10 @@ export function resultToRemixTx (txResult, execResult?) {
return { return {
transactionHash, transactionHash,
status, status: convertToPrefixedHex(status),
gasUsed: convertToPrefixedHex(gasUsed), gasUsed: convertToPrefixedHex(gasUsed),
error: errorMessage, error: errorMessage,
return: convertToPrefixedHex(returnValue), return: returnValue ? convertToPrefixedHex(returnValue) : undefined,
createdAddress: convertToPrefixedHex(contractAddress) createdAddress: convertToPrefixedHex(contractAddress)
} }
} }

@ -1,7 +1,9 @@
'use strict' 'use strict'
import { hash } from '@remix-project/remix-lib' import { hash } from '@remix-project/remix-lib'
import { bufferToHex, setLengthLeft, toBuffer, addHexPrefix } from '@ethereumjs/util' import { bytesToHex, setLengthLeft, toBytes, addHexPrefix } from '@ethereumjs/util'
import stringSimilarity from 'string-similarity' import stringSimilarity from 'string-similarity'
import { BN } from 'bn.js'
import { isBigInt } from 'web3-validator'
/* /*
contains misc util: @TODO should be split contains misc util: @TODO should be split
@ -58,7 +60,7 @@ export function toHexPaddedString(v: bigint | string): string {
ints: ints: IntArray ints: ints: IntArray
*/ */
export function formatMemory (mem) { export function formatMemory (mem) {
const hexMem = bufferToHex(mem).substr(2) const hexMem = bytesToHex(mem).substr(2)
const ret = [] const ret = []
for (let k = 0; k < hexMem.length; k += 32) { for (let k = 0; k < hexMem.length; k += 32) {
const row = hexMem.substr(k, 32) const row = hexMem.substr(k, 32)
@ -152,9 +154,15 @@ export function buildCallPath (index, rootCall) {
*/ */
// eslint-disable-next-line camelcase // eslint-disable-next-line camelcase
export function sha3_256 (value) { export function sha3_256 (value) {
value = toBuffer(addHexPrefix(value)) if ((value.constructor && value.constructor.name === 'BigNumber') || BN.isBN(value) || isBigInt(value)) {
const retInBuffer: Buffer = hash.keccak(setLengthLeft(value, 32)) value = value.toString(16)
return bufferToHex(retInBuffer) }
if (typeof value === 'number') {
value = value.toString(16)
}
value = toBytes(addHexPrefix(value))
const retInBuffer: Uint8Array = hash.keccak(Buffer.from(setLengthLeft(value, 32)))
return bytesToHex(retInBuffer)
} }
/** /**

@ -2,16 +2,16 @@
import tape from 'tape' import tape from 'tape'
import { BN } from 'bn.js' import { BN } from 'bn.js'
import { toBuffer } from '@ethereumjs/util' import { toBytes } from '@ethereumjs/util'
import { resultToRemixTx } from '../src/helpers/txResultHelper' import { resultToRemixTx } from '../src/helpers/txResultHelper'
const TRANSACTION_HASH = '0x538ad944d09c2df403f064c1e4556fae877fe3f1b600c567622e330c2bdbbe2e' const TRANSACTION_HASH = '0x538ad944d09c2df403f064c1e4556fae877fe3f1b600c567622e330c2bdbbe2e'
const CONTRACT_ADDRESS_HEX = '0x692a70d2e424a56d2c6c27aa97d1a86395877b3a' const CONTRACT_ADDRESS_HEX = '0x692a70d2e424a56d2c6c27aa97d1a86395877b3a'
const CONTRACT_ADDRESS_BUFFER = toBuffer( const CONTRACT_ADDRESS_BUFFER = toBytes(
[105, 42, 112, 210, 228, 36, 165, 109, 44, 108, 39, 170, 151, 209, 168, [105, 42, 112, 210, 228, 36, 165, 109, 44, 108, 39, 170, 151, 209, 168,
99, 149, 135, 123, 58]) 99, 149, 135, 123, 58])
const RETURN_VALUE_HEX = '0x0000000000000000000000000000000000000000000000000000000000000001' const RETURN_VALUE_HEX = '0x0000000000000000000000000000000000000000000000000000000000000001'
const RETURN_VALUE_BUFFER = toBuffer( const RETURN_VALUE_BUFFER = toBytes(
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1]) 0, 0, 0, 0, 0, 0, 0, 0, 1])
const STATUS_OK = '0x1' const STATUS_OK = '0x1'

@ -17,11 +17,11 @@
"test": "./../../node_modules/.bin/ts-node --project ../../tsconfig.base.json --require tsconfig-paths/register ./../../node_modules/.bin/mocha test/*.ts" "test": "./../../node_modules/.bin/ts-node --project ../../tsconfig.base.json --require tsconfig-paths/register ./../../node_modules/.bin/mocha test/*.ts"
}, },
"dependencies": { "dependencies": {
"@ethereumjs/block": "^4.2.0", "@ethereumjs/block": "5.2.0",
"@ethereumjs/common": "^3.1.1", "@ethereumjs/common": "4.3.0",
"@ethereumjs/tx": "^4.1.1", "@ethereumjs/tx": "5.3.0",
"@ethereumjs/util": "^8.0.5", "@ethereumjs/util": "9.0.3",
"@ethereumjs/vm": "^6.4.1", "@ethereumjs/vm": "8.0.0",
"@remix-project/remix-lib": "^0.5.51", "@remix-project/remix-lib": "^0.5.51",
"ansi-gray": "^0.1.1", "ansi-gray": "^0.1.1",
"async": "^3.1.0", "async": "^3.1.0",

@ -3,13 +3,13 @@ const { toHexPaddedString, formatMemory } = util
import { helpers } from '@remix-project/remix-lib' import { helpers } from '@remix-project/remix-lib'
const { normalizeHexAddress } = helpers.ui const { normalizeHexAddress } = helpers.ui
import { ConsoleLogs, hash } from '@remix-project/remix-lib' import { ConsoleLogs, hash } from '@remix-project/remix-lib'
import { toChecksumAddress, bufferToHex, Address, toBuffer } from '@ethereumjs/util' import { toChecksumAddress, bytesToHex, Address, toBytes, bigIntToHex} from '@ethereumjs/util'
import utils, {toBigInt} from 'web3-utils' import utils, {toBigInt} from 'web3-utils'
import {isBigInt} from 'web3-validator' import {isBigInt} from 'web3-validator'
import { ethers } from 'ethers' import { ethers } from 'ethers'
import { VMContext } from './vm-context' import { VMContext } from './vm-context'
import type { StateManager } from '@ethereumjs/statemanager' import type { EVMStateManagerInterface } from '@ethereumjs/common'
import type { InterpreterStep } from '@ethereumjs/evm/dist/interpreter' import type { EVMResult, InterpreterStep, Message } from '@ethereumjs/evm'
import type { AfterTxEvent, VM } from '@ethereumjs/vm' import type { AfterTxEvent, VM } from '@ethereumjs/vm'
import type { TypedTransaction } from '@ethereumjs/tx' import type { TypedTransaction } from '@ethereumjs/tx'
@ -43,9 +43,11 @@ export class VmProxy {
utils utils
txsMapBlock txsMapBlock
blocks blocks
stateCopy: StateManager stateCopy: EVMStateManagerInterface
flagDoNotRecordEVMSteps: boolean flagrecordVMSteps: boolean
lastMemoryUpdate: Array<string> lastMemoryUpdate: Array<string>
callIncrement: bigint
txRunning: boolean
constructor (vmContext: VMContext) { constructor (vmContext: VMContext) {
this.vmContext = vmContext this.vmContext = vmContext
@ -89,20 +91,26 @@ export class VmProxy {
this.txsMapBlock = {} this.txsMapBlock = {}
this.blocks = {} this.blocks = {}
this.lastMemoryUpdate = [] this.lastMemoryUpdate = []
this.flagrecordVMSteps = true
this.callIncrement = BigInt(1)
this.txRunning = false
} }
setVM (vm) { setVM (vm) {
if (this.vm === vm) return if (this.vm === vm) return
this.vm = vm this.vm = vm
this.vm.evm.events.on('step', async (data: InterpreterStep) => { this.vm.evm.events.on('step', async (data: InterpreterStep, resolve: (result?: any) => void) => {
await this.pushTrace(data) await this.pushTrace(data)
resolve()
}) })
this.vm.events.on('afterTx', async (data: AfterTxEvent, resolve: (result?: any) => void) => { this.vm.events.on('afterTx', async (data: AfterTxEvent, resolve: (result?: any) => void) => {
await this.txProcessed(data) await this.txProcessed(data)
this.txRunning = false
resolve() resolve()
}) })
this.vm.events.on('beforeTx', async (data: TypedTransaction, resolve: (result?: any) => void) => { this.vm.events.on('beforeTx', async (data: TypedTransaction, resolve: (result?: any) => void) => {
await this.txWillProcess(data) this.txRunning = true
await this.txWillProcess(data)
resolve() resolve()
}) })
} }
@ -113,16 +121,16 @@ export class VmProxy {
return ret return ret
} }
flagNextAsDoNotRecordEvmSteps () { recordVMSteps (record) {
this.flagDoNotRecordEVMSteps = true this.flagrecordVMSteps = record
} }
async txWillProcess (data: TypedTransaction) { async txWillProcess (data: TypedTransaction) {
if (this.flagDoNotRecordEVMSteps) return if (!this.flagrecordVMSteps) return
this.lastMemoryUpdate = [] this.lastMemoryUpdate = []
this.stateCopy = await this.vm.stateManager.copy() this.stateCopy = await this.vm.stateManager.shallowCopy()
this.incr++ this.incr++
this.processingHash = bufferToHex(data.hash()) this.processingHash = bytesToHex(data.hash())
this.vmTraces[this.processingHash] = { this.vmTraces[this.processingHash] = {
gas: '0x0', gas: '0x0',
return: '0x0', return: '0x0',
@ -135,7 +143,7 @@ export class VmProxy {
tx['to'] = toChecksumAddress(data.to.toString()) tx['to'] = toChecksumAddress(data.to.toString())
} }
this.processingAddress = tx['to'] this.processingAddress = tx['to']
tx['input'] = bufferToHex(data.data) tx['input'] = bytesToHex(data.data)
tx['gas'] = data.gasLimit.toString(10) tx['gas'] = data.gasLimit.toString(10)
if (data.value) { if (data.value) {
tx['value'] = data.value.toString(10) tx['value'] = data.value.toString(10)
@ -158,10 +166,7 @@ export class VmProxy {
} }
async txProcessed (data: AfterTxEvent) { async txProcessed (data: AfterTxEvent) {
if (this.flagDoNotRecordEVMSteps) { if (!this.flagrecordVMSteps) return
this.flagDoNotRecordEVMSteps = false
return
}
const lastOp = this.vmTraces[this.processingHash].structLogs[this.processingIndex - 1] const lastOp = this.vmTraces[this.processingHash].structLogs[this.processingIndex - 1]
if (lastOp) { if (lastOp) {
lastOp.error = lastOp.op !== 'RETURN' && lastOp.op !== 'STOP' && lastOp.op !== 'DESTRUCT' lastOp.error = lastOp.op !== 'RETURN' && lastOp.op !== 'STOP' && lastOp.op !== 'DESTRUCT'
@ -176,14 +181,14 @@ export class VmProxy {
if (log[1].length > 0) { if (log[1].length > 0) {
for (const k in log[1]) { for (const k in log[1]) {
// @ts-ignore // @ts-ignore
topics.push('0x' + log[1][k].toString('hex')) topics.push(bytesToHex(log[1][k]))
} }
} else { } else {
topics.push('0x') topics.push('0x')
} }
logs.push({ logs.push({
address: toChecksumAddress('0x' + log[0].toString('hex')), address: toChecksumAddress(bytesToHex(log[0])),
data: '0x' + log[2].toString('hex'), data: bytesToHex(log[2]),
topics: topics, topics: topics,
rawVMResponse: log rawVMResponse: log
}) })
@ -216,18 +221,20 @@ export class VmProxy {
this.vmTraces[this.processingHash].return = checksumedAddress this.vmTraces[this.processingHash].return = checksumedAddress
this.txsReceipt[this.processingHash].contractAddress = checksumedAddress this.txsReceipt[this.processingHash].contractAddress = checksumedAddress
} else if (data.execResult.returnValue) { } else if (data.execResult.returnValue) {
this.vmTraces[this.processingHash].return = '0x' + data.execResult.returnValue.toString('hex') this.vmTraces[this.processingHash].return = bytesToHex(data.execResult.returnValue)
} else { } else {
this.vmTraces[this.processingHash].return = '0x' this.vmTraces[this.processingHash].return = '0x'
} }
this.processingIndex = null this.processingIndex = null
this.processingAddress = null this.processingAddress = null
this.processingHash = null
this.previousDepth = 0 this.previousDepth = 0
this.stateCopy = null this.stateCopy = null
} }
async pushTrace (data: InterpreterStep) { async pushTrace (data: InterpreterStep) {
if (this.flagDoNotRecordEVMSteps) return if (!this.flagrecordVMSteps) return
try { try {
const depth = data.depth + 1 // geth starts the depth from 1 const depth = data.depth + 1 // geth starts the depth from 1
if (!this.processingHash) { if (!this.processingHash) {
@ -308,7 +315,7 @@ export class VmProxy {
} }
} }
} }
if (previousOpcode && previousOpcode.op === 'SHA3') { if (previousOpcode && (previousOpcode.op === 'SHA3' || previousOpcode.op === 'KECCAK256')) {
const preimage = this.getSha3Input(previousOpcode.stack, formatMemory(this.lastMemoryUpdate)) const preimage = this.getSha3Input(previousOpcode.stack, formatMemory(this.lastMemoryUpdate))
const imageHash = toHexPaddedString(step.stack[step.stack.length - 1]).replace('0x', '') const imageHash = toHexPaddedString(step.stack[step.stack.length - 1]).replace('0x', '')
this.sha3Preimages[imageHash] = { this.sha3Preimages[imageHash] = {
@ -325,7 +332,7 @@ export class VmProxy {
getCode (address, cb) { getCode (address, cb) {
address = toChecksumAddress(address) address = toChecksumAddress(address)
this.vm.stateManager.getContractCode(Address.fromString(address)).then((result) => { this.vm.stateManager.getContractCode(Address.fromString(address)).then((result) => {
cb(null, bufferToHex(result)) cb(null, bytesToHex(result))
}).catch((error) => { }).catch((error) => {
cb(error) cb(error)
}) })
@ -352,10 +359,10 @@ export class VmProxy {
blockNumber = blockNumber === 'latest' ? this.vmContext.latestBlockNumber : blockNumber blockNumber = blockNumber === 'latest' ? this.vmContext.latestBlockNumber : blockNumber
const block = this.vmContext.blocks[blockNumber] const block = this.vmContext.blocks[blockNumber]
const txHash = '0x' + block.transactions[block.transactions.length - 1].hash().toString('hex') const txHash = bytesToHex(block.transactions[block.transactions.length - 1].hash())
if (this.storageCache['after_' + txHash] && this.storageCache['after_' + txHash][address]) { if (this.storageCache['after_' + txHash] && this.storageCache['after_' + txHash][address]) {
const slot = '0x' + hash.keccak(toBuffer(ethers.utils.hexZeroPad(position, 32))).toString('hex') const slot = bytesToHex(hash.keccak(toBytes(ethers.utils.hexZeroPad(position, 32))))
const storage = this.storageCache['after_' + txHash][address] const storage = this.storageCache['after_' + txHash][address]
return cb(null, storage[slot].value) return cb(null, storage[slot].value)
} }
@ -369,7 +376,7 @@ export class VmProxy {
address = toChecksumAddress(address) address = toChecksumAddress(address)
const block = this.vmContext.blocks[blockNumber] const block = this.vmContext.blocks[blockNumber]
const txHash = '0x' + block.transactions[txIndex].hash().toString('hex') const txHash = bytesToHex(block.transactions[txIndex].hash())
if (this.storageCache[txHash] && this.storageCache[txHash][address]) { if (this.storageCache[txHash] && this.storageCache[txHash][address]) {
const storage = this.storageCache[txHash][address] const storage = this.storageCache[txHash][address]

@ -1,4 +1,4 @@
import { privateToAddress, toChecksumAddress, isValidPrivate, Address } from '@ethereumjs/util' import { privateToAddress, toChecksumAddress, isValidPrivate, Address, toBytes, bytesToHex, Account } from '@ethereumjs/util'
import { privateKeyToAccount } from 'web3-eth-accounts' import { privateKeyToAccount } from 'web3-eth-accounts'
import { toBigInt } from 'web3-utils' import { toBigInt } from 'web3-utils'
import * as crypto from 'crypto' import * as crypto from 'crypto'
@ -36,26 +36,27 @@ export class Web3Accounts {
await this._addAccount('71975fbf7fe448e004ac7ae54cad0a383c3906055a65468714156a07385e96ce', '0x56BC75E2D63100000') await this._addAccount('71975fbf7fe448e004ac7ae54cad0a383c3906055a65468714156a07385e96ce', '0x56BC75E2D63100000')
} }
_addAccount (privateKey, balance) { async _addAccount (privateKey, balance) {
return new Promise((resolve, reject) => { try {
privateKey = Buffer.from(privateKey, 'hex') privateKey = toBytes('0x' + privateKey)
const address: Buffer = privateToAddress(privateKey) const address: Uint8Array = privateToAddress(privateKey)
const addressStr = toChecksumAddress('0x' + address.toString('hex')) const addressStr = toChecksumAddress(bytesToHex(address))
this.accounts[addressStr] = { privateKey, nonce: 0 } this.accounts[addressStr] = { privateKey, nonce: 0 }
this.accountsKeys[addressStr] = '0x' + privateKey.toString('hex') this.accountsKeys[addressStr] = bytesToHex(privateKey)
const stateManager = this.vmContext.vm().stateManager const stateManager = this.vmContext.vm().stateManager
stateManager.getAccount(Address.fromString(addressStr)).then((account) => { const account = await stateManager.getAccount(Address.fromString(addressStr))
if (!account) {
const account = new Account(BigInt(0), toBigInt(balance || '0xf00000000000000001'))
await stateManager.putAccount(Address.fromString(addressStr), account)
} else {
account.balance = toBigInt(balance || '0xf00000000000000001') account.balance = toBigInt(balance || '0xf00000000000000001')
stateManager.putAccount(Address.fromString(addressStr), account).catch((error) => { await stateManager.putAccount(Address.fromString(addressStr), account)
reject(error) }
}).then(() => { } catch (e) {
resolve({}) console.error(e)
}) }
}).catch((error) => {
reject(error)
})
})
} }
newAccount (cb) { newAccount (cb) {
@ -64,7 +65,7 @@ export class Web3Accounts {
privateKey = crypto.randomBytes(32) privateKey = crypto.randomBytes(32)
} while (!isValidPrivate(privateKey)) } while (!isValidPrivate(privateKey))
this._addAccount(privateKey, '0x56BC75E2D63100000') this._addAccount(privateKey, '0x56BC75E2D63100000')
return cb(null, '0x' + privateToAddress(privateKey).toString('hex')) return cb(null, bytesToHex(privateToAddress(privateKey)))
} }
methods (): Record<string, unknown> { methods (): Record<string, unknown> {
@ -82,7 +83,6 @@ export class Web3Accounts {
eth_getBalance (payload, cb) { eth_getBalance (payload, cb) {
const address = payload.params[0] const address = payload.params[0]
this.vmContext.vm().stateManager.getAccount(Address.fromString(address)).then((account) => { this.vmContext.vm().stateManager.getAccount(Address.fromString(address)).then((account) => {
cb(null, toBigInt(account.balance).toString(10)) cb(null, toBigInt(account.balance).toString(10))
}).catch((error) => { }).catch((error) => {

@ -1,6 +1,6 @@
import { toHex } from 'web3-utils' import { toHex } from 'web3-utils'
import { VMContext } from '../vm-context' import { VMContext } from '../vm-context'
import { bigIntToHex } from '@ethereumjs/util' import { bigIntToHex, bytesToHex } from '@ethereumjs/util'
export class Blocks { export class Blocks {
vmContext: VMContext vmContext: VMContext
@ -43,12 +43,12 @@ export class Blocks {
} }
const transactions = block.transactions.map((t) => { const transactions = block.transactions.map((t) => {
const hash = '0x' + t.hash().toString('hex') const hash = bytesToHex(t.hash())
const tx = this.vmContext.txByHash[hash] const tx = this.vmContext.txByHash[hash]
const receipt = this.vmContext.currentVm.web3vm.txsReceipt[hash] const receipt = this.vmContext.currentVm.web3vm.txsReceipt[hash]
if (receipt) { if (receipt) {
return { return {
blockHash: '0x' + block.hash().toString('hex'), blockHash: bytesToHex(block.hash()),
blockNumber: bigIntToHex(block.header.number), blockNumber: bigIntToHex(block.header.number),
from: receipt.from, from: receipt.from,
gas: bigIntToHex(receipt.gas), gas: bigIntToHex(receipt.gas),
@ -89,20 +89,20 @@ export class Blocks {
toHex (value) { toHex (value) {
if (!value) return '0x0' if (!value) return '0x0'
const v = value.toString('hex') const v = bytesToHex(value)
return ((v === '0x' || v === '') ? '0x0' : ('0x' + v)) return ((v === '0x' || v === '') ? '0x0' : v)
} }
eth_getBlockByHash (payload, cb) { eth_getBlockByHash (payload, cb) {
const block = this.vmContext.blocks[payload.params[0]] const block = this.vmContext.blocks[payload.params[0]]
const transactions = block.transactions.map((t) => { const transactions = block.transactions.map((t) => {
const hash = '0x' + t.hash().toString('hex') const hash = bytesToHex(t.hash())
const tx = this.vmContext.txByHash[hash] const tx = this.vmContext.txByHash[hash]
const receipt = this.vmContext.currentVm.web3vm.txsReceipt[hash] const receipt = this.vmContext.currentVm.web3vm.txsReceipt[hash]
if (receipt) { if (receipt) {
return { return {
blockHash: '0x' + block.hash().toString('hex'), blockHash: bytesToHex(block.hash()),
blockNumber: bigIntToHex(block.header.number), blockNumber: bigIntToHex(block.header.number),
from: receipt.from, from: receipt.from,
gas: toHex(receipt.gas), gas: toHex(receipt.gas),

@ -1,5 +1,5 @@
import { toHex, toNumber, toBigInt } from 'web3-utils' import { toHex, toNumber, toBigInt } from 'web3-utils'
import { toChecksumAddress, Address, bigIntToHex } from '@ethereumjs/util' import { toChecksumAddress, Address, bigIntToHex, bytesToHex} from '@ethereumjs/util'
import { processTx } from './txProcess' import { processTx } from './txProcess'
import { execution } from '@remix-project/remix-lib' import { execution } from '@remix-project/remix-lib'
import { ethers } from 'ethers' import { ethers } from 'ethers'
@ -88,9 +88,9 @@ export class Transactions {
processTx(this.txRunnerInstance, payload, false, (error, result: VMexecutionResult) => { processTx(this.txRunnerInstance, payload, false, (error, result: VMexecutionResult) => {
if (!error && result) { if (!error && result) {
this.vmContext.addBlock(result.block) this.vmContext.addBlock(result.block)
const hash = '0x' + result.tx.hash().toString('hex') const hash = bytesToHex(result.tx.hash())
this.vmContext.trackTx(hash, result.block, result.tx) this.vmContext.trackTx(hash, result.block, result.tx)
const returnValue = `0x${result.result.execResult.returnValue.toString('hex') || '0'}` const returnValue = `${bytesToHex(result.result.execResult.returnValue) || '0x0'}`
const execResult: VMExecResult = { const execResult: VMExecResult = {
exceptionError: result.result.execResult.exceptionError, exceptionError: result.result.execResult.exceptionError,
executionGasUsed: result.result.execResult.executionGasUsed, executionGasUsed: result.result.execResult.executionGasUsed,
@ -129,7 +129,7 @@ export class Transactions {
const r: Record <string, unknown> = { const r: Record <string, unknown> = {
transactionHash: receipt.hash, transactionHash: receipt.hash,
transactionIndex: this.TX_INDEX, transactionIndex: this.TX_INDEX,
blockHash: '0x' + txBlock.hash().toString('hex'), blockHash: bytesToHex(txBlock.hash()),
blockNumber: bigIntToHex(txBlock.header.number), blockNumber: bigIntToHex(txBlock.header.number),
gasUsed: receipt.gasUsed, gasUsed: receipt.gasUsed,
cumulativeGasUsed: receipt.gasUsed, // only 1 tx per block cumulativeGasUsed: receipt.gasUsed, // only 1 tx per block
@ -157,13 +157,16 @@ export class Transactions {
} }
payload.params[0].gas = 10000000 * 10 payload.params[0].gas = 10000000 * 10
this.vmContext.web3().flagNextAsDoNotRecordEvmSteps() this.vmContext.web3().recordVMSteps(false)
this.txRunnerInstance.internalRunner.standaloneTx = true
processTx(this.txRunnerInstance, payload, true, (error, value: VMexecutionResult) => { processTx(this.txRunnerInstance, payload, true, (error, value: VMexecutionResult) => {
this.txRunnerInstance.internalRunner.standaloneTx = false
this.vmContext.web3().recordVMSteps(true)
if (error) return cb(error) if (error) return cb(error)
const result: any = value.result const result: any = value.result
if ((result as any).receipt?.status === '0x0' || (result as any).receipt?.status === 0) { if ((result as any).receipt?.status === '0x0' || (result as any).receipt?.status === 0) {
try { try {
const msg = `0x${result.execResult.returnValue.toString('hex') || '0'}` const msg = `${bytesToHex(result.execResult.returnValue) || '0x00'}`
const abiCoder = new ethers.utils.AbiCoder() const abiCoder = new ethers.utils.AbiCoder()
const reason = abiCoder.decode(['string'], '0x' + msg.slice(10))[0] const reason = abiCoder.decode(['string'], '0x' + msg.slice(10))[0]
return cb('revert ' + reason) return cb('revert ' + reason)
@ -201,13 +204,19 @@ export class Transactions {
} }
eth_getStateDb (_, cb) { eth_getStateDb (_, cb) {
cb(null, this.vmContext.currentVm.stateManager.getDb()) const run = async () => {
if ((this.vmContext.currentVm.stateManager as any)._getCodeDB) {
return cb(null, await (this.vmContext.currentVm.stateManager as any)._getCodeDB())
}
throw new Error('current state does not support "getStateDetails"')
}
run()
} }
eth_getBlocksData (_, cb) { eth_getBlocksData (_, cb) {
cb(null, { cb(null, {
blocks: this.txRunnerVMInstance.blocks, blocks: this.txRunnerVMInstance.blocks,
latestBlockNumber: this.txRunnerVMInstance.blockNumber latestBlockNumber: this.txRunnerVMInstance.blocks.length - 1
}) })
} }
@ -225,9 +234,9 @@ export class Transactions {
processTx(this.txRunnerInstance, payload, true, (error, result: VMexecutionResult) => { processTx(this.txRunnerInstance, payload, true, (error, result: VMexecutionResult) => {
if (!error && result) { if (!error && result) {
this.vmContext.addBlock(result.block, null, true) this.vmContext.addBlock(result.block, null, true)
const hash = '0x' + result.tx.hash().toString('hex') const hash = bytesToHex(result.tx.hash())
this.vmContext.trackTx(hash, result.block, result.tx) this.vmContext.trackTx(hash, result.block, result.tx)
const returnValue = `0x${result.result.execResult.returnValue.toString('hex') || '0'}` const returnValue = `${bytesToHex(result.result.execResult.returnValue) || '0x0'}`
const execResult: VMExecResult = { const execResult: VMExecResult = {
exceptionError: result.result.execResult.exceptionError, exceptionError: result.result.execResult.exceptionError,
executionGasUsed: result.result.execResult.executionGasUsed, executionGasUsed: result.result.execResult.executionGasUsed,
@ -278,7 +287,7 @@ export class Transactions {
// TODO: params to add later // TODO: params to add later
const r: Record<string, unknown> = { const r: Record<string, unknown> = {
blockHash: '0x' + txBlock.hash().toString('hex'), blockHash: bytesToHex(txBlock.hash()),
blockNumber: bigIntToHex(txBlock.header.number), blockNumber: bigIntToHex(txBlock.header.number),
from: receipt.from, from: receipt.from,
gas: toHex(BigInt(receipt.gas)), gas: toHex(BigInt(receipt.gas)),
@ -316,7 +325,7 @@ export class Transactions {
const txIndex = payload.params[1] const txIndex = payload.params[1]
const txBlock = this.vmContext.blocks[payload.params[0]] const txBlock = this.vmContext.blocks[payload.params[0]]
const txHash = '0x' + txBlock.transactions[toNumber(txIndex) as number].hash().toString('hex') const txHash = bytesToHex(txBlock.transactions[toNumber(txIndex) as number].hash())
this.vmContext.web3().eth.getTransactionReceipt(txHash, (error, receipt) => { this.vmContext.web3().eth.getTransactionReceipt(txHash, (error, receipt) => {
if (error) { if (error) {
@ -327,7 +336,7 @@ export class Transactions {
// TODO: params to add later // TODO: params to add later
const r: Record<string, unknown> = { const r: Record<string, unknown> = {
blockHash: '0x' + txBlock.hash().toString('hex'), blockHash: bytesToHex(txBlock.hash()),
blockNumber: bigIntToHex(txBlock.header.number), blockNumber: bigIntToHex(txBlock.header.number),
from: receipt.from, from: receipt.from,
gas: toHex(BigInt(receipt.gas)), gas: toHex(BigInt(receipt.gas)),
@ -361,7 +370,7 @@ export class Transactions {
const txIndex = payload.params[1] const txIndex = payload.params[1]
const txBlock = this.vmContext.blocks[payload.params[0]] const txBlock = this.vmContext.blocks[payload.params[0]]
const txHash = '0x' + txBlock.transactions[toNumber(txIndex) as number].hash().toString('hex') const txHash = bytesToHex(txBlock.transactions[toNumber(txIndex) as number].hash())
this.vmContext.web3().eth.getTransactionReceipt(txHash, (error, receipt) => { this.vmContext.web3().eth.getTransactionReceipt(txHash, (error, receipt) => {
if (error) { if (error) {
@ -372,7 +381,7 @@ export class Transactions {
// TODO: params to add later // TODO: params to add later
const r: Record<string, unknown> = { const r: Record<string, unknown> = {
blockHash: '0x' + txBlock.hash().toString('hex'), blockHash: bytesToHex(txBlock.hash()),
blockNumber: bigIntToHex(txBlock.header.number), blockNumber: bigIntToHex(txBlock.header.number),
from: receipt.from, from: receipt.from,
gas: toHex(BigInt(receipt.gas)), gas: toHex(BigInt(receipt.gas)),

@ -1,27 +1,25 @@
/* global ethereum */ /* global ethereum */
'use strict' 'use strict'
import { Cache } from '@ethereumjs/statemanager/dist/cache'
import { hash } from '@remix-project/remix-lib' import { hash } from '@remix-project/remix-lib'
import { bufferToHex, Account, toBuffer, bufferToBigInt, bigIntToHex } from '@ethereumjs/util' import { bytesToHex, Account, bigIntToHex, MapDB, toBytes, bytesToBigInt } from '@ethereumjs/util'
import { keccak256 } from 'ethereum-cryptography/keccak' import { keccak256 } from 'ethereum-cryptography/keccak'
import type { Address } from '@ethereumjs/util' import { Address } from '@ethereumjs/util'
import { decode } from 'rlp' import { decode } from 'rlp'
import { ethers } from 'ethers' import { ethers } from 'ethers'
import { execution } from '@remix-project/remix-lib' import { execution } from '@remix-project/remix-lib'
const { LogsManager } = execution const { LogsManager } = execution
import { VmProxy } from './VmProxy' import { VmProxy } from './VmProxy'
import { VM } from '@ethereumjs/vm' import { VM } from '@ethereumjs/vm'
import type { BigIntLike } from '@ethereumjs/util'
import { Common, ConsensusType } from '@ethereumjs/common' import { Common, ConsensusType } from '@ethereumjs/common'
import { Trie, MapDB } from '@ethereumjs/trie' import { Trie } from '@ethereumjs/trie'
import { DefaultStateManager, StateManager, EthersStateManager, EthersStateManagerOpts } from '@ethereumjs/statemanager' import { DefaultStateManager } from '@ethereumjs/statemanager'
import { StorageDump } from '@ethereumjs/statemanager/dist/interface' import { EVMStateManagerInterface, StorageDump } from '@ethereumjs/common'
import { EVM } from '@ethereumjs/evm' import { EVM } from '@ethereumjs/evm'
import { EEI } from '@ethereumjs/vm'
import { Blockchain } from '@ethereumjs/blockchain' import { Blockchain } from '@ethereumjs/blockchain'
import { Block } from '@ethereumjs/block' import { Block } from '@ethereumjs/block'
import { Transaction } from '@ethereumjs/tx' import { TypedTransaction } from '@ethereumjs/tx'
import { State } from './provider' import { State } from './provider'
import { hexToBytes } from 'web3-utils'
/** /**
* Options for constructing a {@link StateManager}. * Options for constructing a {@link StateManager}.
@ -56,39 +54,46 @@ class StateManagerCommonStorageDump extends DefaultStateManager {
} }
putContractStorage (address, key, value) { putContractStorage (address, key, value) {
this.keyHashes[hash.keccak(key).toString('hex')] = bufferToHex(key) this.keyHashes[bytesToHex(hash.keccak(key))] = bytesToHex(key)
return super.putContractStorage(address, key, value) return super.putContractStorage(address, key, value)
} }
copy(): StateManagerCommonStorageDump { shallowCopy(): StateManagerCommonStorageDump {
const copyState = new StateManagerCommonStorageDump({ const copyState = new StateManagerCommonStorageDump({
trie: this._trie.copy(false), trie: this._trie.shallowCopy(false),
}) })
copyState.keyHashes = this.keyHashes copyState.keyHashes = this.keyHashes
return copyState return copyState
} }
async dumpStorage (address): Promise<StorageDump> { async dumpStorage (address): Promise<StorageDump> {
await this.flush()
const account = await this.getAccount(address)
if (!account) {
throw new Error(`dumpStorage f() can only be called for an existing account`)
}
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this._getStorageTrie(address) try {
.then((trie) => { const trie = this._getStorageTrie(address, account)
const storage = {} const storage = {}
const stream = trie.createReadStream() const stream = trie.createReadStream()
stream.on('data', (val) => { stream.on('data', (val) => {
const value: any = decode(val.value) const value: any = decode(val.value)
storage['0x' + val.key.toString('hex')] = { storage[bytesToHex(val.key)] = {
key: this.keyHashes[val.key.toString('hex')], key: this.keyHashes[bytesToHex(val.key)],
value: '0x' + value.toString('hex') value: bytesToHex(value)
} }
}) })
stream.on('end', () => { stream.on('end', () => {
resolve(storage) resolve(storage)
})
}) })
.catch((e) => { stream.on('error', (e) => {
reject(e) reject(e)
}) })
} catch (e) {
reject(e)
}
}) })
} }
} }
@ -105,6 +110,7 @@ export interface CustomEthersStateManagerOpts {
class CustomEthersStateManager extends StateManagerCommonStorageDump { class CustomEthersStateManager extends StateManagerCommonStorageDump {
private provider: ethers.providers.StaticJsonRpcProvider | ethers.providers.JsonRpcProvider private provider: ethers.providers.StaticJsonRpcProvider | ethers.providers.JsonRpcProvider
private blockTag: string private blockTag: string
constructor(opts: CustomEthersStateManagerOpts) { constructor(opts: CustomEthersStateManagerOpts) {
super(opts) super(opts)
if (typeof opts.provider === 'string') { if (typeof opts.provider === 'string') {
@ -116,32 +122,6 @@ class CustomEthersStateManager extends StateManagerCommonStorageDump {
} }
this.blockTag = opts.blockTag this.blockTag = opts.blockTag
/*
* For a custom StateManager implementation adopt these
* callbacks passed to the `Cache` instantiated to perform
* the `get`, `put` and `delete` operations with the
* desired backend.
*/
const getCb = async (address) => {
const rlp = await this._trie.get(address.buf)
if (rlp) {
const ac = Account.fromRlpSerializedAccount(rlp)
return ac
} else {
const ac = await this.getAccountFromProvider(address)
return ac
}
}
const putCb = async (keyBuf, accountRlp) => {
const trie = this._trie
await trie.put(keyBuf, accountRlp)
}
const deleteCb = async (keyBuf: Buffer) => {
const trie = this._trie
await trie.del(keyBuf)
}
this._cache = new Cache({ getCb, putCb, deleteCb })
} }
/** /**
@ -153,11 +133,11 @@ class CustomEthersStateManager extends StateManagerCommonStorageDump {
this.blockTag = blockTag === 'earliest' ? blockTag : bigIntToHex(blockTag) this.blockTag = blockTag === 'earliest' ? blockTag : bigIntToHex(blockTag)
} }
copy(): CustomEthersStateManager { shallowCopy(): CustomEthersStateManager {
const newState = new CustomEthersStateManager({ const newState = new CustomEthersStateManager({
provider: this.provider, provider: this.provider,
blockTag: this.blockTag, blockTag: this.blockTag,
trie: this._trie.copy(false), trie: this._trie.shallowCopy(false),
}) })
return newState return newState
} }
@ -168,11 +148,11 @@ class CustomEthersStateManager extends StateManagerCommonStorageDump {
* @returns {Promise<Buffer>} - Resolves with the code corresponding to the provided address. * @returns {Promise<Buffer>} - Resolves with the code corresponding to the provided address.
* Returns an empty `Buffer` if the account has no associated code. * Returns an empty `Buffer` if the account has no associated code.
*/ */
async getContractCode(address: Address): Promise<Buffer> { async getContractCode(address: Address): Promise<Uint8Array> {
const code = await super.getContractCode(address) const code = await super.getContractCode(address)
if (code && code.length > 0) return code if (code && code.length > 0) return code
else { else {
const code = toBuffer(await this.provider.getCode(address.toString(), this.blockTag)) const code = toBytes(await this.provider.getCode(address.toString(), this.blockTag))
await super.putContractCode(address, code) await super.putContractCode(address, code)
return code return code
} }
@ -187,13 +167,13 @@ class CustomEthersStateManager extends StateManagerCommonStorageDump {
* corresponding to the provided address at the provided key. * corresponding to the provided address at the provided key.
* If this does not exist an empty `Buffer` is returned. * If this does not exist an empty `Buffer` is returned.
*/ */
async getContractStorage(address: Address, key: Buffer): Promise<Buffer> { async getContractStorage(address: Address, key: Buffer): Promise<Uint8Array> {
let storage = await super.getContractStorage(address, key) let storage = await super.getContractStorage(address, key)
if (storage && storage.length > 0) return storage if (storage && storage.length > 0) return storage
else { else {
storage = toBuffer(await this.provider.getStorageAt( storage = toBytes(await this.provider.getStorageAt(
address.toString(), address.toString(),
bufferToBigInt(key), bytesToBigInt(key),
this.blockTag) this.blockTag)
) )
await super.putContractStorage(address, key, storage) await super.putContractStorage(address, key, storage)
@ -206,19 +186,30 @@ class CustomEthersStateManager extends StateManagerCommonStorageDump {
* @param address - Address of the `account` to check * @param address - Address of the `account` to check
*/ */
async accountExists(address: Address): Promise<boolean> { async accountExists(address: Address): Promise<boolean> {
const localAccount = this._cache.get(address) const account = await super.getAccount(address)
if (!localAccount.isEmpty()) return true if (!account.isEmpty()) return true
// Get merkle proof for `address` from provider // Get merkle proof for `address` from provider
const proof = await this.provider.send('eth_getProof', [address.toString(), [], this.blockTag]) const proof = await this.provider.send('eth_getProof', [address.toString(), [], this.blockTag])
const proofBuf = proof.accountProof.map((proofNode: string) => toBuffer(proofNode)) const proofBuf = proof.accountProof.map((proofNode: string) => toBytes(proofNode))
const trie = new Trie({ useKeyHashing: true }) const trie = new Trie({ useKeyHashing: true })
const verified = await trie.verifyProof( const verified = await trie.verifyProof(
Buffer.from(keccak256(proofBuf[0])), Buffer.from(keccak256(proofBuf[0])),
address.buf, address.bytes,
proofBuf proofBuf
) )
if (verified) {
const codeHash = proof.codeHash === '0x0000000000000000000000000000000000000000000000000000000000000000' ? '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470' : proof.codeHash
const account = Account.fromAccountData({
balance: BigInt(proof.balance),
nonce: BigInt(proof.nonce),
codeHash: hexToBytes(codeHash)
// storageRoot: toBuffer([]), // we have to remove this in order to force the creation of the Trie in the local state.
})
super.putAccount(address, account)
}
// if not verified (i.e. verifyProof returns null), account does not exist // if not verified (i.e. verifyProof returns null), account does not exist
return verified === null ? false : true return verified === null ? false : true
} }
@ -244,14 +235,14 @@ class CustomEthersStateManager extends StateManagerCommonStorageDump {
account = Account.fromAccountData({ account = Account.fromAccountData({
balance: BigInt(0), balance: BigInt(0),
nonce: BigInt(0), nonce: BigInt(0),
codeHash: toBuffer('0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470') codeHash: hexToBytes('0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470')
}) })
} else { } else {
const codeHash = accountData.codeHash === '0x0000000000000000000000000000000000000000000000000000000000000000' ? '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470' : accountData.codeHash const codeHash = accountData.codeHash === '0x0000000000000000000000000000000000000000000000000000000000000000' ? '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470' : accountData.codeHash
account = Account.fromAccountData({ account = Account.fromAccountData({
balance: BigInt(accountData.balance), balance: BigInt(accountData.balance),
nonce: BigInt(accountData.nonce), nonce: BigInt(accountData.nonce),
codeHash: toBuffer(codeHash) codeHash: hexToBytes(codeHash)
// storageRoot: toBuffer([]), // we have to remove this in order to force the creation of the Trie in the local state. // storageRoot: toBuffer([]), // we have to remove this in order to force the creation of the Trie in the local state.
}) })
} }
@ -259,29 +250,21 @@ class CustomEthersStateManager extends StateManagerCommonStorageDump {
} }
} }
export type CurrentVm = { export type CurrentVm = {
vm: VM, vm: VM,
web3vm: VmProxy, web3vm: VmProxy,
stateManager: StateManagerCommonStorageDump, stateManager: EVMStateManagerInterface,
common: Common common: Common
} }
export class VMCommon extends Common { export class VMCommon extends Common {
/** /**
* Override "setHardforkByBlockNumber" to disable updating the original fork state * Always return the fork set at initialization
* */
* @param blockNumber setHardforkBy() {
* @param td return this._hardfork;
* @param timestamp
* @returns The name of the HF set
*/
setHardforkByBlockNumber(
blockNumber: BigIntLike,
td?: BigIntLike,
timestamp?: BigIntLike
): string {
return this.hardfork()
} }
} }
@ -295,21 +278,21 @@ export class VMContext {
blocks: Record<string, Block> blocks: Record<string, Block>
latestBlockNumber: string latestBlockNumber: string
blockByTxHash: Record<string, Block> blockByTxHash: Record<string, Block>
txByHash: Record<string, Transaction> txByHash: Record<string, TypedTransaction>
currentVm: CurrentVm currentVm: CurrentVm
web3vm: VmProxy web3vm: VmProxy
logsManager: any // LogsManager logsManager: any // LogsManager
exeResults: Record<string, Transaction> exeResults: Record<string, TypedTransaction>
nodeUrl: string nodeUrl: string
blockNumber: number | 'latest' blockNumber: number | 'latest'
stateDb: State stateDb: State
rawBlocks: string[] rawBlocks: string[]
serializedBlocks: Buffer[] serializedBlocks: Uint8Array[]
constructor (fork?: string, nodeUrl?: string, blockNumber?: number | 'latest', stateDb?: State, blocksData?: string[]) { constructor (fork?: string, nodeUrl?: string, blockNumber?: number | 'latest', stateDb?: State, blocksData?: string[]) {
this.blockGasLimitDefault = 4300000 this.blockGasLimitDefault = 4300000
this.blockGasLimit = this.blockGasLimitDefault this.blockGasLimit = this.blockGasLimitDefault
this.currentFork = fork || 'merge' this.currentFork = fork || 'cancun'
this.nodeUrl = nodeUrl this.nodeUrl = nodeUrl
this.stateDb = stateDb this.stateDb = stateDb
this.blockNumber = blockNumber this.blockNumber = blockNumber
@ -328,7 +311,7 @@ export class VMContext {
} }
async createVm (hardfork) { async createVm (hardfork) {
let stateManager: StateManagerCommonStorageDump let stateManager: EVMStateManagerInterface
if (this.nodeUrl) { if (this.nodeUrl) {
let block = this.blockNumber let block = this.blockNumber
if (this.blockNumber === 'latest') { if (this.blockNumber === 'latest') {
@ -342,11 +325,11 @@ export class VMContext {
} else { } else {
stateManager = new CustomEthersStateManager({ stateManager = new CustomEthersStateManager({
provider: this.nodeUrl, provider: this.nodeUrl,
blockTag: '0x' + this.blockNumber.toString(16) blockTag: '0x' + block.toString(16)
}) })
} }
} else{ } else {
const db = this.stateDb ? new Map(Object.entries(this.stateDb).map(([k, v]) => [k, toBuffer(v)])) : new Map() const db = this.stateDb ? new Map(Object.entries(this.stateDb).map(([k, v]) => [k, hexToBytes(v)])) : new Map()
const mapDb = new MapDB(db) const mapDb = new MapDB(db)
const trie = await Trie.create({ useKeyHashing: true, db: mapDb, useRootPersistence: true }) const trie = await Trie.create({ useKeyHashing: true, db: mapDb, useRootPersistence: true })
@ -358,8 +341,7 @@ export class VMContext {
const common = new VMCommon({ chain: 'mainnet', hardfork }) const common = new VMCommon({ chain: 'mainnet', hardfork })
const blocks = (this.rawBlocks || []).map(block => { const blocks = (this.rawBlocks || []).map(block => {
const serializedBlock = toBuffer(block) const serializedBlock = hexToBytes(block)
this.serializedBlocks.push(serializedBlock) this.serializedBlocks.push(serializedBlock)
return Block.fromRLPSerializedBlock(serializedBlock, { common }) return Block.fromRLPSerializedBlock(serializedBlock, { common })
}) })
@ -371,15 +353,14 @@ export class VMContext {
difficulty, difficulty,
gasLimit: 8000000 gasLimit: 8000000
} }
}, { common, hardforkByBlockNumber: false, hardforkByTTD: undefined }) }, { common })
const blockchain = await Blockchain.create({ common, validateBlocks: false, validateConsensus: false, genesisBlock }) const blockchain = await Blockchain.create({ common, validateBlocks: false, validateConsensus: false, genesisBlock })
const eei = new EEI(stateManager, common, blockchain) const evm = await EVM.create({ common, allowUnlimitedContractSize: true, stateManager, blockchain })
const evm = new EVM({ common, eei, allowUnlimitedContractSize: true })
const vm = await VM.create({ const vm = await VM.create({
common, common,
activatePrecompiles: true, activatePrecompiles: true,
hardforkByBlockNumber: false,
stateManager, stateManager,
blockchain, blockchain,
evm evm
@ -390,10 +371,10 @@ export class VMContext {
web3vm.setVM(vm) web3vm.setVM(vm)
this.addBlock(genesisBlock, true) this.addBlock(genesisBlock, true)
if (blocks.length > 0) blocks.splice(0, 1) if (blocks.length > 0) blocks.splice(0, 1)
blocks.forEach(block => { for (const block of blocks) {
blockchain.putBlock(block) await blockchain.putBlock(block)
this.addBlock(block, false, false, web3vm) this.addBlock(block, false, false, web3vm)
}) }
return { vm, web3vm, stateManager, common, blocks } return { vm, web3vm, stateManager, common, blocks }
} }
@ -419,7 +400,7 @@ export class VMContext {
blockNumber = '0x0' blockNumber = '0x0'
} }
this.blocks['0x' + block.hash().toString('hex')] = block this.blocks[bytesToHex(block.hash())] = block
this.blocks[blockNumber] = block this.blocks[blockNumber] = block
this.latestBlockNumber = blockNumber this.latestBlockNumber = blockNumber

@ -19,20 +19,20 @@ describe('Events', () => {
from: accounts[0], from: accounts[0],
gas: 1000000, gas: 1000000,
data: '0x608060405234801561001057600080fd5b506101ea806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80632801617e14610030575b600080fd5b61004a6004803603810190610045919061015d565b61004c565b005b8073ffffffffffffffffffffffffffffffffffffffff1663a6f9dae1306040518263ffffffff1660e01b81526004016100859190610199565b600060405180830381600087803b15801561009f57600080fd5b505af11580156100b3573d6000803e3d6000fd5b50505050607b7fdcd9c7fa0342f01013bd0bf2bec103a81936162dcebd1f0c38b1d4164c17e0fc60405160405180910390a250565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610118826100ed565b9050919050565b600061012a8261010d565b9050919050565b61013a8161011f565b811461014557600080fd5b50565b60008135905061015781610131565b92915050565b600060208284031215610173576101726100e8565b5b600061018184828501610148565b91505092915050565b6101938161010d565b82525050565b60006020820190506101ae600083018461018a565b9291505056fea2646970667358221220cf5368dd204d44a75752e8ba7512b73d2f54b09f6ca6147e376dd3cf2942b96464736f6c63430008120033' data: '0x608060405234801561001057600080fd5b506101ea806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80632801617e14610030575b600080fd5b61004a6004803603810190610045919061015d565b61004c565b005b8073ffffffffffffffffffffffffffffffffffffffff1663a6f9dae1306040518263ffffffff1660e01b81526004016100859190610199565b600060405180830381600087803b15801561009f57600080fd5b505af11580156100b3573d6000803e3d6000fd5b50505050607b7fdcd9c7fa0342f01013bd0bf2bec103a81936162dcebd1f0c38b1d4164c17e0fc60405160405180910390a250565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610118826100ed565b9050919050565b600061012a8261010d565b9050919050565b61013a8161011f565b811461014557600080fd5b50565b60008135905061015781610131565b92915050565b600060208284031215610173576101726100e8565b5b600061018184828501610148565b91505092915050565b6101938161010d565b82525050565b60006020820190506101ae600083018461018a565b9291505056fea2646970667358221220cf5368dd204d44a75752e8ba7512b73d2f54b09f6ca6147e376dd3cf2942b96464736f6c63430008120033'
}) }, null, { checkRevertBeforeSending: false, ignoreGasPricing: true })
// deploy the contract "owner", this will trigger an event. // deploy the contract "owner", this will trigger an event.
const receiptOwner = await web3.eth.sendTransaction({ const receiptOwner = await web3.eth.sendTransaction({
from: accounts[0], from: accounts[0],
gas: 1000000, gas: 1000000,
data: '0x608060405234801561001057600080fd5b5061005a6040518060400160405280601b81526020017f4f776e657220636f6e7472616374206465706c6f7965642062793a00000000008152503361011a60201b61015b1760201c565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a361034d565b6101b882826040516024016101309291906102ee565b6040516020818303038152906040527f319af333000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506101bc60201b60201c565b5050565b6101dd816101d86101e060201b6101f71761020160201b60201c565b60201c565b50565b60006a636f6e736f6c652e6c6f679050600080835160208501845afa505050565b61021360201b61023d17819050919050565b61021b61031e565b565b600081519050919050565b600082825260208201905092915050565b60005b8381101561025757808201518184015260208101905061023c565b60008484015250505050565b6000601f19601f8301169050919050565b600061027f8261021d565b6102898185610228565b9350610299818560208601610239565b6102a281610263565b840191505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006102d8826102ad565b9050919050565b6102e8816102cd565b82525050565b600060408201905081810360008301526103088185610274565b905061031760208301846102df565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052605160045260246000fd5b6104268061035c6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063893d20e81461003b578063a6f9dae114610059575b600080fd5b610043610075565b6040516100509190610288565b60405180910390f35b610073600480360381019061006e91906102d4565b61009e565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6101f38282604051602401610171929190610391565b6040516020818303038152906040527f319af333000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050610218565b5050565b60006a636f6e736f6c652e6c6f679050600080835160208501845afa505050565b61022f816102276101f7610232565b63ffffffff16565b50565b61023d819050919050565b6102456103c1565b565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061027282610247565b9050919050565b61028281610267565b82525050565b600060208201905061029d6000830184610279565b92915050565b600080fd5b6102b181610267565b81146102bc57600080fd5b50565b6000813590506102ce816102a8565b92915050565b6000602082840312156102ea576102e96102a3565b5b60006102f8848285016102bf565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561033b578082015181840152602081019050610320565b60008484015250505050565b6000601f19601f8301169050919050565b600061036382610301565b61036d818561030c565b935061037d81856020860161031d565b61038681610347565b840191505092915050565b600060408201905081810360008301526103ab8185610358565b90506103ba6020830184610279565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052605160045260246000fdfea2646970667358221220cb7beb012e0831cc632ed85a11a8652f72efc03360c81beb1fcd842a7782c3cb64736f6c63430008120033' data: '0x608060405234801561001057600080fd5b5061005a6040518060400160405280601b81526020017f4f776e657220636f6e7472616374206465706c6f7965642062793a00000000008152503361011a60201b61015b1760201c565b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a361034d565b6101b882826040516024016101309291906102ee565b6040516020818303038152906040527f319af333000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506101bc60201b60201c565b5050565b6101dd816101d86101e060201b6101f71761020160201b60201c565b60201c565b50565b60006a636f6e736f6c652e6c6f679050600080835160208501845afa505050565b61021360201b61023d17819050919050565b61021b61031e565b565b600081519050919050565b600082825260208201905092915050565b60005b8381101561025757808201518184015260208101905061023c565b60008484015250505050565b6000601f19601f8301169050919050565b600061027f8261021d565b6102898185610228565b9350610299818560208601610239565b6102a281610263565b840191505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006102d8826102ad565b9050919050565b6102e8816102cd565b82525050565b600060408201905081810360008301526103088185610274565b905061031760208301846102df565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052605160045260246000fd5b6104268061035c6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063893d20e81461003b578063a6f9dae114610059575b600080fd5b610043610075565b6040516100509190610288565b60405180910390f35b610073600480360381019061006e91906102d4565b61009e565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a73560405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6101f38282604051602401610171929190610391565b6040516020818303038152906040527f319af333000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050610218565b5050565b60006a636f6e736f6c652e6c6f679050600080835160208501845afa505050565b61022f816102276101f7610232565b63ffffffff16565b50565b61023d819050919050565b6102456103c1565b565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061027282610247565b9050919050565b61028281610267565b82525050565b600060208201905061029d6000830184610279565b92915050565b600080fd5b6102b181610267565b81146102bc57600080fd5b50565b6000813590506102ce816102a8565b92915050565b6000602082840312156102ea576102e96102a3565b5b60006102f8848285016102bf565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561033b578082015181840152602081019050610320565b60008484015250505050565b6000601f19601f8301169050919050565b600061036382610301565b61036d818561030c565b935061037d81856020860161031d565b61038681610347565b840191505092915050565b600060408201905081810360008301526103ab8185610358565b90506103ba6020830184610279565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052605160045260246000fdfea2646970667358221220cb7beb012e0831cc632ed85a11a8652f72efc03360c81beb1fcd842a7782c3cb64736f6c63430008120033'
}) }, null, { checkRevertBeforeSending: false, ignoreGasPricing: true })
// call function set(Owner p) from "test", this will trigger 2 events, one from each contract. // call function set(Owner p) from "test", this will trigger 2 events, one from each contract.
await web3.eth.sendTransaction({ await web3.eth.sendTransaction({
from: accounts[0], from: accounts[0],
to: receiptTest.contractAddress, to: receiptTest.contractAddress,
gas: 1000000, gas: 1000000,
data: '0x2801617e' + web3.utils.padLeft(receiptOwner.contractAddress, 64).replace('0x', '') data: '0x2801617e' + web3.utils.padLeft(receiptOwner.contractAddress, 64).replace('0x', '')
}) }, null, { checkRevertBeforeSending: false, ignoreGasPricing: true })
const testLogs = await web3.eth.getPastLogs({ const testLogs = await web3.eth.getPastLogs({
address: receiptTest.contractAddress, address: receiptTest.contractAddress,
@ -47,9 +47,10 @@ describe('Events', () => {
toBlock: 'latest', toBlock: 'latest',
topics: ['0x342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a735', '0xdcd9c7fa0342f01013bd0bf2bec103a81936162dcebd1f0c38b1d4164c17e0fc'] topics: ['0x342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a735', '0xdcd9c7fa0342f01013bd0bf2bec103a81936162dcebd1f0c38b1d4164c17e0fc']
}) })
// this should include the event triggered by the "set" transaction call. // this should include the event triggered by the "set" transaction call.
assert.equal(testLogs.length, 1) assert.equal(testLogs.length, 1, '1) testLogs length should be equal to 1')
assert.equal(ownerLogs.length, 1) assert.equal(ownerLogs.length, 1, '2) ownerLogs length should be equal to 1')
ownerLogs = await web3.eth.getPastLogs({ ownerLogs = await web3.eth.getPastLogs({
address: receiptOwner.contractAddress, address: receiptOwner.contractAddress,
@ -58,7 +59,7 @@ describe('Events', () => {
topics: ['0x342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a735', '0xdcd9c7fa0342f01013bd0bf2bec103a81936162dcebd1f0c38b1d4164c17e0fc'] topics: ['0x342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a735', '0xdcd9c7fa0342f01013bd0bf2bec103a81936162dcebd1f0c38b1d4164c17e0fc']
}) })
// this should include the event triggered from the ctor. // this should include the event triggered from the ctor.
assert.equal(ownerLogs.length, 2) assert.equal(ownerLogs.length, 2, '3) ownerLogs length should be equal to 2')
ownerLogs = await web3.eth.getPastLogs({ ownerLogs = await web3.eth.getPastLogs({
address: receiptOwner.contractAddress, address: receiptOwner.contractAddress,
@ -67,7 +68,7 @@ describe('Events', () => {
topics: ['0x342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a735', '0xdcd9c7fa0342f01013bd0bf2bec103a81936162dcebd1f0c38b1d4164c17e0fc'] topics: ['0x342827c97908e5e2f71151c08502a66d44b6f758e3ac2f1de95f02eb95f0a735', '0xdcd9c7fa0342f01013bd0bf2bec103a81936162dcebd1f0c38b1d4164c17e0fc']
}) })
// this should only include the event triggered from the ctor. // this should only include the event triggered from the ctor.
assert.equal(ownerLogs.length, 1) assert.equal(ownerLogs.length, 1, '4) ownerLogs length should be equal to 1')
}) })
}) })
}) })

@ -15,10 +15,10 @@
} }
], ],
"dependencies": { "dependencies": {
"@ethereumjs/block": "^4.2.0", "@ethereumjs/block": "5.2.0",
"@ethereumjs/tx": "^4.1.1", "@ethereumjs/tx": "5.3.0",
"@ethereumjs/util": "^8.0.5", "@ethereumjs/util": "9.0.3",
"@ethereumjs/vm": "^6.4.1", "@ethereumjs/vm": "8.0.0",
"@remix-project/remix-lib": "^0.5.51", "@remix-project/remix-lib": "^0.5.51",
"async": "^2.6.2", "async": "^2.6.2",
"eslint-scope": "^5.0.0", "eslint-scope": "^5.0.0",

@ -36,11 +36,11 @@
"homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-tests#readme", "homepage": "https://github.com/ethereum/remix-project/tree/master/libs/remix-tests#readme",
"dependencies": { "dependencies": {
"@erebos/bzz-node": "^0.13.0", "@erebos/bzz-node": "^0.13.0",
"@ethereumjs/block": "^4.2.0", "@ethereumjs/block": "5.2.0",
"@ethereumjs/common": "^3.1.1", "@ethereumjs/common": "4.3.0",
"@ethereumjs/tx": "^4.1.1", "@ethereumjs/tx": "5.3.0",
"@ethereumjs/util": "^8.0.5", "@ethereumjs/util": "9.0.3",
"@ethereumjs/vm": "^6.4.1", "@ethereumjs/vm": "8.0.0",
"@remix-project/remix-lib": "^0.5.51", "@remix-project/remix-lib": "^0.5.51",
"@remix-project/remix-simulator": "^0.2.44", "@remix-project/remix-simulator": "^0.2.44",
"@remix-project/remix-solidity": "^0.5.30", "@remix-project/remix-solidity": "^0.5.30",
@ -77,6 +77,17 @@
"ts-node": "^8.0.2", "ts-node": "^8.0.2",
"typescript": "^3.3.1" "typescript": "^3.3.1"
}, },
"resolutions": {
"@ethereumjs/blockchain": "7.2.0",
"@ethereumjs/block": "5.2.0",
"@ethereumjs/common": "4.3.0",
"@ethereumjs/evm": "3.0.0",
"@ethereumjs/statemanager": "2.3.0",
"@ethereumjs/tx": "5.3.0",
"@ethereumjs/util": "9.0.3",
"@ethereumjs/vm": "8.0.0",
"@ethereumjs/trie": "6.2.0"
},
"typings": "src/index.d.ts", "typings": "src/index.d.ts",
"gitHead": "751c821c0264dec832ee8739800e32b79b09c00a" "gitHead": "751c821c0264dec832ee8739800e32b79b09c00a"
} }

@ -26,11 +26,12 @@ describe('testRunner: remix-tests CLI', function(){
it('remix-tests version', () => { it('remix-tests version', () => {
const res = spawnSync(executablePath, ['-V']) const res = spawnSync(executablePath, ['-V'])
// eslint-disable-next-line @typescript-eslint/no-var-requires // eslint-disable-next-line @typescript-eslint/no-var-requires
expect(res.stdout.toString().trim()).to.equal(require('../package.json').version) expect(res.stdout.toString().trim()).to.equal(require('../package.json').version, `actual value: ${res.stdout.toString()}`)
}) })
it('remix-tests help', () => { it('remix-tests help', () => {
const res = spawnSync(executablePath, ['-h']) const res = spawnSync(executablePath, ['-h'])
console.log(res.stdout.toString())
const expectedHelp = `Usage: remix-tests [options] [command] <file_path> const expectedHelp = `Usage: remix-tests [options] [command] <file_path>
Arguments: Arguments:
@ -62,6 +63,7 @@ Commands:
const res = spawnSync(executablePath, [resolve(__dirname + '/examples_0/assert_ok_test.sol')]) const res = spawnSync(executablePath, [resolve(__dirname + '/examples_0/assert_ok_test.sol')])
//console.log(res.stdout.toString()) //console.log(res.stdout.toString())
// match initial lines // match initial lines
console.log(res.stdout.toString())
expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/) expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/)
expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../) expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../)
// match test result // match test result

@ -161,18 +161,18 @@ describe('testRunner', function () {
deepEqualExcluding(tests, [ deepEqualExcluding(tests, [
{ type: 'accountList', value: accounts }, { type: 'accountList', value: accounts },
{ type: 'contract', value: 'AssertEqualTest', filename: __dirname + '/examples_0/assert_equal_test.sol' }, { type: 'contract', value: 'AssertEqualTest', filename: __dirname + '/examples_0/assert_equal_test.sol' },
{ type: 'testPass', debugTxHash: '0x233b8d91f0fa068b1a4deae1141178bc3eb79c3d2a6786160595a358363a157c', value: 'Equal uint pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, { type: 'testPass', debugTxHash: '0x15b52a9081653c9d6d910378c30386f36c5740ffd25ad62e0c92c08e654560f5', value: 'Equal uint pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' },
{ type: 'testFailure', debugTxHash: '0xa5e39c78663c2e5071c08467047ba5b2650d16081b50369700d46d7f90c4d94b', value: 'Equal uint fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalUintFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '273:57:0', expected: '2', returned: '1' }, { type: 'testFailure', debugTxHash: '0xaaf89bcdad7a5cf283c122ed5e3d18fae5da45c2244ee225b3758822f89f3286', value: 'Equal uint fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalUintFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '273:57:0', expected: '2', returned: '1' },
{ type: 'testPass', debugTxHash: '0x57af51c2c19db390a4ccf72fa3d32347fb3d998e70820909c7876bd8ccebf8a3', value: 'Equal int pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, { type: 'testPass', debugTxHash: '0xffd078476f9d569cdc81ac9657d0cba539f2242bc55ea8e00c9a5f79202962bd', value: 'Equal int pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' },
{ type: 'testFailure', debugTxHash: '0x710f3a54a561c009fcf0277273b8fe337b2c493e9e83e0ae02786d487339ca7b', value: 'Equal int fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalIntFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '493:45:0', expected: '2', returned: '-1' }, { type: 'testFailure', debugTxHash: '0xe5825fe29fc517cd5838bcdcd8d4b265ec7ea1e26f1436a2449358b7c4e6265f', value: 'Equal int fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalIntFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '493:45:0', expected: '2', returned: '-1' },
{ type: 'testPass', debugTxHash: '0x10c1ed8651110ad5de6adcad8e1284aa5c1fd3a998a1e863bbecc0ec855fcd7b', value: 'Equal bool pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, { type: 'testPass', debugTxHash: '0xdf0c7136558a8575ffbacde38f66a510524871c1159983fb66971825f0ccf01c', value: 'Equal bool pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' },
{ type: 'testFailure', debugTxHash: '0x004871a82968f43e02278eab9dd3d7eb0bbe88b64d459efa50065e5996fe5fad', value: 'Equal bool fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalBoolFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '708:52:0', expected: false, returned: true }, { type: 'testFailure', debugTxHash: '0xc4d5cb36e53aac58193d7811388f572eeedf67def1e73f7b99c30ec40a93f500', value: 'Equal bool fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalBoolFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '708:52:0', expected: false, returned: true },
{ type: 'testPass', debugTxHash: '0x64a4d4853ab7907712912cf2120ac2bfd2e08b4767b375250f0e907757546454', value: 'Equal address pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, { type: 'testPass', debugTxHash: '0xfe0f0c759c5dd07135dfbc249d4e963cc442e454bb46d760623642a2b7eb6dbe', value: 'Equal address pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' },
{ type: 'testFailure', debugTxHash: '0xcf62fb76e3b2eb95d92aa2671a9e81e30fefb944f55e2fb8b97096c45fc74a38', value: 'Equal address fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalAddressFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '1015:130:0', expected: '0x1c6637567229159d1eFD45f95A6675e77727E013', returned: '0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9' }, { type: 'testFailure', debugTxHash: '0xf482704ba6fb1e3a21f014e085bd6974efea4be7a57a0d7998c2809c5aee65c4', value: 'Equal address fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalAddressFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '1015:130:0', expected: '0x1c6637567229159d1eFD45f95A6675e77727E013', returned: '0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9' },
{ type: 'testPass', debugTxHash: '0x18ef613acc128a21282e09cf920b32ef3be648bb35c0299471ddbbbeeb0faf8c', value: 'Equal bytes32 pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, { type: 'testPass', debugTxHash: '0x615af0a14d8e605944cdd8f938523e093c2d937d4715aee373650028c905385e', value: 'Equal bytes32 pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' },
{ type: 'testFailure', debugTxHash: '0x86fbf2f14e13d228f80a87a947841270d8c55073adddf78e8d4e2ba05d724ec6', value: 'Equal bytes32 fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalBytes32FailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '1670:48:0', expected: '0x72656d6978000000000000000000000000000000000000000000000000000000', returned: '0x72656d6979000000000000000000000000000000000000000000000000000000' }, { type: 'testFailure', debugTxHash: '0x20ff637a0fb28c9f943d0eaa23d9391e9177810d77a9ac5478873f8838719fc5', value: 'Equal bytes32 fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalBytes32FailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '1670:48:0', expected: '0x72656d6978000000000000000000000000000000000000000000000000000000', returned: '0x72656d6979000000000000000000000000000000000000000000000000000000' },
{ type: 'testPass', debugTxHash: '0x80b3465f2504b74359790baa009237ba066685b24afa65a31814f1ad1bc4f99f', value: 'Equal string pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, { type: 'testPass', debugTxHash: '0x2a7c3f1f5d87620d8f1f2a83984e2cae6ff985f25f9cb96a046b507b357941bb', value: 'Equal string pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' },
{ type: 'testFailure', debugTxHash: '0x88b035a85c5f87f54a805334817f3e4599b4190d98f25947fe14d7804facd8b7', value: 'Equal string fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalStringFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '1916:81:0', expected: 'remix-tests', returned: 'remix' } { type: 'testFailure', debugTxHash: '0x7d9381986adb7e9e6d7d65191f82633cb453406556569f77f5e0b4aa39274324', value: 'Equal string fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalStringFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '1916:81:0', expected: 'remix-tests', returned: 'remix' }
], ['time', 'web3']) ], ['time', 'web3'])
}) })
}) })
@ -202,19 +202,19 @@ describe('testRunner', function () {
deepEqualExcluding(tests, [ deepEqualExcluding(tests, [
{ type: 'accountList', value: accounts }, { type: 'accountList', value: accounts },
{ type: 'contract', value: 'AssertNotEqualTest', filename: __dirname + '/examples_0/assert_notEqual_test.sol' }, { type: 'contract', value: 'AssertNotEqualTest', filename: __dirname + '/examples_0/assert_notEqual_test.sol' },
{ type: 'testPass', debugTxHash: '0xdef34ec7fbc6a3e6c6ef619b424bf8ebf16db16ed3f74500d56d8170d3aeca66', value: 'Not equal uint pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, { type: 'testPass', debugTxHash: '0xebc513bd2625be3b228840ebb8f5a9ea53e4f32870f015c97d1b6f91b916b367', value: 'Not equal uint pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' },
{ type: 'testFailure', debugTxHash: '0xfcbd35bc5f460e22e885951d560171d687cf90ccdffc41fb5de1beb7075fe4e9', value: 'Not equal uint fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualUintFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '288:63:0', expected: '1', returned: '1' }, { type: 'testFailure', debugTxHash: '0x2cb59a137f2d3a76eee28bce662cb8618ad9cb9068f6be51935bf24911f90b43', value: 'Not equal uint fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualUintFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '288:63:0', expected: '1', returned: '1' },
{ type: 'testPass', debugTxHash: '0x7f269855c3fc5c677eca416eb85665b8f10df00d3b7ec5dcc00cbf8e6364cba4', value: 'Not equal int pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, { type: 'testPass', debugTxHash: '0xc66c3c63a74463e5ce77311393d143b014ea510fb49992a7a828a78f00f9ca51', value: 'Not equal int pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' },
{ type: 'testFailure', debugTxHash: '0x76555e218571d4ad69496d7d10ae46d30149c4bfd8c6e15ff2a58668ab6fba62', value: 'Not equal int fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualIntFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '525:52:0', expected: '-2', returned: '-2' }, { type: 'testFailure', debugTxHash: '0x1606fcdf8583d0e629125bcadf2f115334228fac79cbbb5d756fafd9ca6b8f06', value: 'Not equal int fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualIntFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '525:52:0', expected: '-2', returned: '-2' },
{ type: 'testPass', debugTxHash: '0x5fe790b3f32b9580c1d5f9a2dbb0e10ddcb62846037d3f5800d47a51bb67cc91', value: 'Not equal bool pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, { type: 'testPass', debugTxHash: '0x8cce267a27b4b7aedb9f50499017b971d4058cd11c7f61a267b9ff159126af6d', value: 'Not equal bool pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' },
{ type: 'testFailure', debugTxHash: '0x660d0a73395e6855aea8f6d3450e63640437dc15071842b417c39f40e1d7ae61', value: 'Not equal bool fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualBoolFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '760:57:0', expected: true, returned: true }, { type: 'testFailure', debugTxHash: '0x2e08b9742bf3d99f08c5563600ab228a54c3b9e432a40912ab6d4a5f3779a671', value: 'Not equal bool fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualBoolFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '760:57:0', expected: true, returned: true },
{ type: 'testPass', debugTxHash: '0x6fddce5573bd6723acf5a3e4137d698ff78f695873a228939276c4323ddfb132', value: 'Not equal address pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, { type: 'testPass', debugTxHash: '0x03cb41ad90b032bb94a994e62828bf03f8042c8b41f51c46f68171a3b4ab36a3', value: 'Not equal address pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' },
// eslint-disable-next-line @typescript-eslint/no-loss-of-precision // eslint-disable-next-line @typescript-eslint/no-loss-of-precision
{ type: 'testFailure', debugTxHash: '0x51479e46db802fb598c61ca0dd630345b9d70cc58667b5a80aa79e8119fa7787', value: 'Not equal address fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualAddressFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '1084:136:0', expected: 0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9, returned: 0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9 }, { type: 'testFailure', debugTxHash: '0xa68c8214a422e42335ba50407f5bc096332c289a9fede3d264ef27e02e6565af', value: 'Not equal address fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualAddressFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '1084:136:0', expected: 0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9, returned: 0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9 },
{ type: 'testPass', debugTxHash: '0xbcaf6d8977b655fdedb280e0e9221d728706d41e85e0973d00c8da1d128022c7', value: 'Not equal bytes32 pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, { type: 'testPass', debugTxHash: '0xb83a9e2dd2bc916b40a87f038b0c96b3be6b2796d65900bbdf1467027d0b4f96', value: 'Not equal bytes32 pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' },
{ type: 'testFailure', debugTxHash: '0x34008ef0ea908fedbf80471424d801f5069e6e46221f8ee4a2ee16776a6eeef6', value: 'Not equal bytes32 fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualBytes32FailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '1756:54:0', expected: '0x72656d6978000000000000000000000000000000000000000000000000000000', returned: '0x72656d6978000000000000000000000000000000000000000000000000000000' }, { type: 'testFailure', debugTxHash: '0x3a8e50586fee6fe4e5d765d1392151e550b28959ea8eb823e8fdf54627fa861e', value: 'Not equal bytes32 fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualBytes32FailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '1756:54:0', expected: '0x72656d6978000000000000000000000000000000000000000000000000000000', returned: '0x72656d6978000000000000000000000000000000000000000000000000000000' },
{ type: 'testPass', debugTxHash: '0x8e0bc9dedea6e088ca7bd82b1e9fab516be5a52f7716a26ccca8197236aae105', value: 'Not equal string pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, { type: 'testPass', debugTxHash: '0x8b84801330bbd44f358aee9089263ad7400ffc738f2f1f9e6b06cf6af20816d1', value: 'Not equal string pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' },
{ type: 'testFailure', debugTxHash: '0x13c6d270c3609ef858dd6d0c79433ca0b43e47b485b2e40ffe363f18f2868ea8', value: 'Not equal string fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualStringFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '2026:81:0', expected: 'remix', returned: 'remix' }, { type: 'testFailure', debugTxHash: '0xb2e1b7cdfdc622e1c39e436054168861ca68bb51147940bff6ebd075f8afd2da', value: 'Not equal string fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualStringFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '2026:81:0', expected: 'remix', returned: 'remix' },
], ['time', 'web3']) ], ['time', 'web3'])
}) })
}) })
@ -241,14 +241,14 @@ describe('testRunner', function () {
deepEqualExcluding(tests, [ deepEqualExcluding(tests, [
{ type: 'accountList', value: accounts }, { type: 'accountList', value: accounts },
{ type: 'contract', value: 'AssertGreaterThanTest', filename: __dirname + '/examples_0/assert_greaterThan_test.sol' }, { type: 'contract', value: 'AssertGreaterThanTest', filename: __dirname + '/examples_0/assert_greaterThan_test.sol' },
{ type: 'testPass', debugTxHash: '0xdc325916fd93227b76231131e52e67f8913d395098c5ac767032db9bd757a91c', value: 'Greater than uint pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, { type: 'testPass', debugTxHash: '0x563a5b040bd6403de8543a8c44f1b11bb99dbece557f428b966fb70d389e602b', value: 'Greater than uint pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' },
{ type: 'testFailure', debugTxHash: '0xf98eea22bb86f13e0bb4072df22b540289a46b332bdb203a1e488d7e14a1dcd4', value: 'Greater than uint fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanUintFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '303:69:0', expected: '4', returned: '1' }, { type: 'testFailure', debugTxHash: '0x14ec758d313b505d92b0505e0ce940df318bc0136ea6ab9b40bba1a94baeaca5', value: 'Greater than uint fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanUintFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '303:69:0', expected: '4', returned: '1' },
{ type: 'testPass', debugTxHash: '0xef5ef38329ba6aac2f868d53d803053c52b1895a2c25b704260435c141a63bfc', value: 'Greater than int pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, { type: 'testPass', debugTxHash: '0x2de3f6fdf2c93f50289dd5fe469a13e03c22961ddcf110e5f3819a7af39e3e25', value: 'Greater than int pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' },
{ type: 'testFailure', debugTxHash: '0x6b9430f3f12c12fb11e5a8d32fef849ab34614e644be20c6b41a25e510453440', value: 'Greater than int fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanIntFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '569:67:0', expected: '1', returned: '-1' }, { type: 'testFailure', debugTxHash: '0xa8b897e011895858be4bc37f20e1e17a490b964d0683df5b430ac648e992bd57', value: 'Greater than int fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanIntFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '569:67:0', expected: '1', returned: '-1' },
{ type: 'testPass', debugTxHash: '0x4c6e10815a5e82bf2c60950606dc886317f680028a9229ba2dda17b5ea36325a', value: 'Greater than uint int pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, { type: 'testPass', debugTxHash: '0xf52652ef6020ae091022455df8713d20cb00a35de8bf485e177128a457a50d6c', value: 'Greater than uint int pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' },
{ type: 'testFailure', debugTxHash: '0x989c405c32c8e270a5dea69e6250a514c05dacd6fcf018365a241abc28c2497b', value: 'Greater than uint int fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanUintIntFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '845:71:0', expected: '2', returned: '1' }, { type: 'testFailure', debugTxHash: '0x9f826060a0e5a8c0187d5e9ffe83a153080379a1e1fea0b267745eb8bd52fd6f', value: 'Greater than uint int fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanUintIntFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '845:71:0', expected: '2', returned: '1' },
{ type: 'testPass', debugTxHash: '0x9fed670ae2061929f71780835b7ea3eb7da6d4fb553cd2d5f62950c353165861', value: 'Greater than int uint pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, { type: 'testPass', debugTxHash: '0x04e1703c75cc4beb4b8c9ddfb79489192423fe745089382cadb1811cbf2d915c', value: 'Greater than int uint pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' },
{ type: 'testFailure', debugTxHash: '0xcf394fd279293cdcf58efc42f3a443595fdb171769a45df01b0c84cd76b3a9a2', value: 'Greater than int uint fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanIntUintFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '1125:76:0', expected: '115792089237316195423570985008687907853269984665640564039457584007913129639836', returned: '100' } { type: 'testFailure', debugTxHash: '0xbb5c94a5fc46417a4d3c763994da78d4f27c83dbc5545cb0522a39c3c6017432', value: 'Greater than int uint fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanIntUintFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '1125:76:0', expected: '115792089237316195423570985008687907853269984665640564039457584007913129639836', returned: '100' }
], ['time', 'web3']) ], ['time', 'web3'])
}) })
}) })
@ -276,14 +276,14 @@ describe('testRunner', function () {
deepEqualExcluding(tests, [ deepEqualExcluding(tests, [
{ type: 'accountList', value: accounts }, { type: 'accountList', value: accounts },
{ type: 'contract', value: 'AssertLesserThanTest', filename: __dirname + '/examples_0/assert_lesserThan_test.sol' }, { type: 'contract', value: 'AssertLesserThanTest', filename: __dirname + '/examples_0/assert_lesserThan_test.sol' },
{ type: 'testPass', debugTxHash: '0x524fb46aa0e8a78bc11a99432908d422450c2933d837f858aeacba9b84706d5c', value: 'Lesser than uint pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, { type: 'testPass', debugTxHash: '0x407c27582c0b6b2275d03372907c2efcafa1c9e8a1e6ea8d4e20f88e3222b6c7', value: 'Lesser than uint pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' },
{ type: 'testFailure', debugTxHash: '0x0551a67b10b9e13182e8bdb4e530ed92466d5054ae959f999f2c558da2c39d22', value: 'Lesser than uint fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanUintFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '298:67:0', expected: '2', returned: '4' }, { type: 'testFailure', debugTxHash: '0x6e7fc07decdb5deb71b1177fc7b151bce5b8e42fc6137e1418b4e7277960d972', value: 'Lesser than uint fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanUintFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '298:67:0', expected: '2', returned: '4' },
{ type: 'testPass', debugTxHash: '0x6d63958d8c3230e837d0ca8335e57262c6e0c6b2c07a5b481842b9ad7329ac28', value: 'Lesser than int pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, { type: 'testPass', debugTxHash: '0x353c9bcf4b61abaf4b6ffaae02f18ea0a7fb38a8c3c7a915939561cdf97f2d72', value: 'Lesser than int pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' },
{ type: 'testFailure', debugTxHash: '0x38e96ef44f4e785db4d40a95862a9797e8cef6de0ce1d059da72ff42e2f3ca62', value: 'Lesser than int fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanIntFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '557:65:0', expected: '-1', returned: '1' }, { type: 'testFailure', debugTxHash: '0xccab30c5a154c4c2e8ca9a8966b86a55f08188d606c3519a5c29534b4b64fb47', value: 'Lesser than int fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanIntFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '557:65:0', expected: '-1', returned: '1' },
{ type: 'testPass', debugTxHash: '0x699f9fc2bf7a14134e89b94cd9dc1c537b5d4581a1c26a34a0c3343ddede9608', value: 'Lesser than uint int pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, { type: 'testPass', debugTxHash: '0x8e90fb7f3b8343d037444275cd69d431f75a7fc6b46322c69397373463cee22a', value: 'Lesser than uint int pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' },
{ type: 'testFailure', debugTxHash: '0xce1391dcfbfdc6c611e357e6c1c9f6cd9f257153ee400cb80bd36af6d239c342', value: 'Lesser than uint int fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanUintIntFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '826:71:0', expected: '-1', returned: '115792089237316195423570985008687907853269984665640564039457584007913129639935' }, { type: 'testFailure', debugTxHash: '0x5db60fe115958b767f0defe81eeb6322ee18ec8df690abad0d1581175882136b', value: 'Lesser than uint int fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanUintIntFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '826:71:0', expected: '-1', returned: '115792089237316195423570985008687907853269984665640564039457584007913129639935' },
{ type: 'testPass', debugTxHash: '0x7040e6664c13e6b35ef1daaef93a8cae36a62150d818183892096a98b921800c', value: 'Lesser than int uint pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, { type: 'testPass', debugTxHash: '0x19f79e8c8ec360cd27beee6399e6853a4fe335af78364ed35c93f8fe39e3100c', value: 'Lesser than int uint pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' },
{ type: 'testFailure', debugTxHash: '0x8c58bb433ea41760dcf11114232407d703e8ebf7d5e9637e2923282eae5caee6', value: 'Lesser than int uint fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanIntUintFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '1105:69:0', expected: '1', returned: '1' }, { type: 'testFailure', debugTxHash: '0x520ecba457bf71f42d24f61432d872121da699af0374090e2e9098a6719cb0ce', value: 'Lesser than int uint fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanIntUintFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '1105:69:0', expected: '1', returned: '1' },
], ['time', 'web3']) ], ['time', 'web3'])
}) })
}) })
@ -311,10 +311,10 @@ describe('testRunner', function () {
deepEqualExcluding(tests, [ deepEqualExcluding(tests, [
{ type: 'accountList', value: accounts }, { type: 'accountList', value: accounts },
{ type: 'contract', value: 'MyTest', filename: __dirname + '/examples_1/simple_storage_test.sol' }, { type: 'contract', value: 'MyTest', filename: __dirname + '/examples_1/simple_storage_test.sol' },
{ type: 'testPass', debugTxHash: '0xed5b6898331119c6e3d1185b9de65d87ad7329cc629a8f2d43b966cf180a5dc1', value: 'Initial value should be100', filename: __dirname + '/examples_1/simple_storage_test.sol', context: 'MyTest' }, { type: 'testPass', debugTxHash: '0xd86dbe1efaf707981475a9a4762826c6852cce3e5b0e987827027602d6d6d734', value: 'Initial value should be100', filename: __dirname + '/examples_1/simple_storage_test.sol', context: 'MyTest' },
{ type: 'testPass', debugTxHash: '0x79cae5c4f44edfd7ae3490e01c75df5741b107672cef5e69800e4d30d380a721', value: 'Initial value should not be200', filename: __dirname + '/examples_1/simple_storage_test.sol', context: 'MyTest' }, { type: 'testPass', debugTxHash: '0x1b5cce7f93b78f8c97ba915e24648127b7f28e86008668d20a4c20fd0fde40bc', value: 'Initial value should not be200', filename: __dirname + '/examples_1/simple_storage_test.sol', context: 'MyTest' },
{ type: 'testFailure', debugTxHash: '0x24a20f7643e88f891e469ef495911ab0b75f99e2b09b9b091e688674910d1506', value: 'Should trigger one fail', filename: __dirname + '/examples_1/simple_storage_test.sol', errMsg: 'uint test 1 fails', context: 'MyTest', assertMethod: 'equal', location: '532:51:1', expected: '2', returned: '1' }, { type: 'testFailure', debugTxHash: '0xdb9cbef289c9e53f4119ad60c1f3e29770de930091e17ab987529c7057013628', value: 'Should trigger one fail', filename: __dirname + '/examples_1/simple_storage_test.sol', errMsg: 'uint test 1 fails', context: 'MyTest', assertMethod: 'equal', location: '532:51:1', expected: '2', returned: '1' },
{ type: 'testPass', debugTxHash: '0x08b1f60c908b7e6cf2dd24fc166c755f0fe5336aebfb325cae4ce00ea9bbf932', value: 'Should trigger one pass', filename: __dirname + '/examples_1/simple_storage_test.sol', context: 'MyTest' } { type: 'testPass', debugTxHash: '0x21472600af5de67cd53a489f2435169fdfbe83d7b7dd43c8a0150725fd91e254', value: 'Should trigger one pass', filename: __dirname + '/examples_1/simple_storage_test.sol', context: 'MyTest' }
], ['time', 'web3']) ], ['time', 'web3'])
}) })
}) })
@ -342,8 +342,8 @@ describe('testRunner', function () {
deepEqualExcluding(tests, [ deepEqualExcluding(tests, [
{ type: 'accountList', value: accounts }, { type: 'accountList', value: accounts },
{ type: 'contract', value: 'MyTest', filename: __dirname + '/examples_2/simple_storage_test.sol' }, { type: 'contract', value: 'MyTest', filename: __dirname + '/examples_2/simple_storage_test.sol' },
{ type: 'testPass', debugTxHash: '0xed5b6898331119c6e3d1185b9de65d87ad7329cc629a8f2d43b966cf180a5dc1', value: 'Initial value should be100', filename: __dirname + '/examples_2/simple_storage_test.sol', context: 'MyTest' }, { type: 'testPass', debugTxHash: '0xd86dbe1efaf707981475a9a4762826c6852cce3e5b0e987827027602d6d6d734', value: 'Initial value should be100', filename: __dirname + '/examples_2/simple_storage_test.sol', context: 'MyTest' },
{ type: 'testPass', debugTxHash: '0x8ed5b4858405b43ad4052f5690b4b711c0f6cdeb67a64f54084417d43bc54308', value: 'Value is set200', filename: __dirname + '/examples_2/simple_storage_test.sol', context: 'MyTest' } { type: 'testPass', debugTxHash: '0xa447f168cd1ce406635ea2368b61828b107473905e270957b7ee38b94a12e055', value: 'Value is set200', filename: __dirname + '/examples_2/simple_storage_test.sol', context: 'MyTest' }
], ['time', 'web3']) ], ['time', 'web3'])
}) })
}) })
@ -368,8 +368,8 @@ describe('testRunner', function () {
deepEqualExcluding(tests, [ deepEqualExcluding(tests, [
{ type: 'accountList', value: accounts }, { type: 'accountList', value: accounts },
{ type: 'contract', value: 'StringTest', filename: __dirname + '/examples_3/simple_string_test.sol' }, { type: 'contract', value: 'StringTest', filename: __dirname + '/examples_3/simple_string_test.sol' },
{ type: 'testPass', debugTxHash: '0x3567da76ffbec37e3b43a41987a7ff3e61b41b4c544f35c010d2d4b39568d6d4', value: 'Initial value should be hello world', filename: __dirname + '/examples_3/simple_string_test.sol', context: 'StringTest' }, { type: 'testPass', debugTxHash: '0x0f988e614ae6e9a5f560734e8b63f835de14460a5b797e16fa5c68091452d2c5', value: 'Initial value should be hello world', filename: __dirname + '/examples_3/simple_string_test.sol', context: 'StringTest' },
{ type: 'testPass', debugTxHash: '0x8619b743ccc99be7d5347a064732474b2d1b69844be65b0e7754c6ac1340d275', value: 'Value should not be hello wordl', filename: __dirname + '/examples_3/simple_string_test.sol', context: 'StringTest' } { type: 'testPass', debugTxHash: '0x713ec0ad3cd02ffcd64f54e45b4da5498983d18b5a696ea34e9fb5d01928cb3f', value: 'Value should not be hello wordl', filename: __dirname + '/examples_3/simple_string_test.sol', context: 'StringTest' }
], ['time', 'web3']) ], ['time', 'web3'])
}) })
}) })
@ -394,9 +394,9 @@ describe('testRunner', function () {
deepEqualExcluding(tests, [ deepEqualExcluding(tests, [
{ type: 'accountList', value: accounts }, { type: 'accountList', value: accounts },
{ type: 'contract', value: 'StorageResolveTest', filename: __dirname + '/examples_5/test/simple_storage_test.sol' }, { type: 'contract', value: 'StorageResolveTest', filename: __dirname + '/examples_5/test/simple_storage_test.sol' },
{ type: 'testPass', debugTxHash: '0xed5b6898331119c6e3d1185b9de65d87ad7329cc629a8f2d43b966cf180a5dc1', value: 'Initial value should be100', filename: __dirname + '/examples_5/test/simple_storage_test.sol', context: 'StorageResolveTest' }, { type: 'testPass', debugTxHash: '0xd86dbe1efaf707981475a9a4762826c6852cce3e5b0e987827027602d6d6d734', value: 'Initial value should be100', filename: __dirname + '/examples_5/test/simple_storage_test.sol', context: 'StorageResolveTest' },
{ type: 'testPass', debugTxHash: '0x6893fe4f5a83cc51f03c9237ab93b93ffd826236167d58e20666be4c1b3128a4', value: 'Check if even', filename: __dirname + '/examples_5/test/simple_storage_test.sol', context: 'StorageResolveTest' }, { type: 'testPass', debugTxHash: '0xc9e1523f6f094cdd909b3977d1eef7c83284b15c22b17b9b0a4a632bf59881f6', value: 'Check if even', filename: __dirname + '/examples_5/test/simple_storage_test.sol', context: 'StorageResolveTest' },
{ type: 'testPass', debugTxHash: '0x64e600b32be681b68926660042ddd96f22d07949b424959811b8acb56e72f719', value: 'Check if odd', filename: __dirname + '/examples_5/test/simple_storage_test.sol', context: 'StorageResolveTest' } { type: 'testPass', debugTxHash: '0xe3f415f2cade92243fd795b9988fc9e9c4318983933c0a0b103e968f31c40f55', value: 'Check if odd', filename: __dirname + '/examples_5/test/simple_storage_test.sol', context: 'StorageResolveTest' }
], ['time', 'web3']) ], ['time', 'web3'])
}) })
}) })

@ -1,4 +1,4 @@
import * as ethJSUtil from '@ethereumjs/util' import { bytesToHex, toChecksumAddress } from '@ethereumjs/util'
export const extractNameFromKey = (key: string): string => { export const extractNameFromKey = (key: string): string => {
if (!key) return if (!key) return
@ -97,12 +97,12 @@ export const shortenAddress = (address, etherBalance?) => {
export const addressToString = (address) => { export const addressToString = (address) => {
if (!address) return null if (!address) return null
if (typeof address !== 'string') { if (typeof address !== 'string') {
address = address.toString('hex') address = bytesToHex(address)
} }
if (address.indexOf('0x') === -1) { if (address.indexOf('0x') === -1) {
address = '0x' + address address = '0x' + address
} }
return ethJSUtil.toChecksumAddress(address) return toChecksumAddress(address)
} }
export const is0XPrefixed = (value) => { export const is0XPrefixed = (value) => {

@ -34,7 +34,7 @@ export function AccountUI(props: AccountProps) {
}) })
break break
case 'vm-merge': case 'vm-paris':
setPlusOpt({ setPlusOpt({
classList: '', classList: '',
title: intl.formatMessage({id: 'udapp.createNewAccount'}) title: intl.formatMessage({id: 'udapp.createNewAccount'})

@ -19,7 +19,7 @@ export const runTabInitialState: RunTabState = {
sendValue: '0', sendValue: '0',
sendUnit: 'wei', sendUnit: 'wei',
gasLimit: 3000000, gasLimit: 3000000,
selectExEnv: 'vm-merge', selectExEnv: 'vm-paris',
personalMode: false, personalMode: false,
networkName: 'VM', networkName: 'VM',
providers: { providers: {
@ -173,7 +173,7 @@ export const runTabReducer = (state: RunTabState = runTabInitialState, action: A
return { return {
...state, ...state,
selectExEnv: payload, selectExEnv: payload,
networkName: state.selectExEnv === 'vm-merge' ? 'VM' : state.networkName, networkName: state.selectExEnv === 'vm-paris' ? 'VM' : state.networkName,
accounts: { accounts: {
...state.accounts, ...state.accounts,
selectedAccount: '', selectedAccount: '',

@ -11,6 +11,7 @@ import {getValidLanguage} from '@remix-project/remix-solidity'
import {CopyToClipboard} from '@remix-ui/clipboard' import {CopyToClipboard} from '@remix-ui/clipboard'
import {configFileContent} from './compilerConfiguration' import {configFileContent} from './compilerConfiguration'
import { appPlatformTypes, platformContext, onLineContext } from '@remix-ui/app' import { appPlatformTypes, platformContext, onLineContext } from '@remix-ui/app'
import * as packageJson from '../../../../../package.json'
import './css/style.css' import './css/style.css'
@ -61,7 +62,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
downloaded: [], downloaded: [],
compilerLicense: null, compilerLicense: null,
selectedVersion: null, selectedVersion: null,
defaultVersion: 'soljson-v0.8.24+commit.e11b9ed9.js', // this default version is defined: in makeMockCompiler (for browser test) defaultVersion: packageJson.defaultVersion, // this default version is defined: in makeMockCompiler (for browser test)
runs: '', runs: '',
compiledFileName: '', compiledFileName: '',
includeNightlies: false, includeNightlies: false,

@ -6,7 +6,7 @@ import { Toaster } from '@remix-ui/toaster' // eslint-disable-line
import { ModalDialog } from '@remix-ui/modal-dialog' // eslint-disable-line import { ModalDialog } from '@remix-ui/modal-dialog' // eslint-disable-line
import { Renderer } from '@remix-ui/renderer' // eslint-disable-line import { Renderer } from '@remix-ui/renderer' // eslint-disable-line
import { baseURLBin, baseURLWasm, pathToURL } from '@remix-project/remix-solidity' import { baseURLBin, baseURLWasm, pathToURL } from '@remix-project/remix-solidity'
import * as packageJson from '../../../../../package.json'
import './css/style.css' import './css/style.css'
import { iSolJsonBinData, iSolJsonBinDataBuild } from '@remix-project/remix-lib' import { iSolJsonBinData, iSolJsonBinDataBuild } from '@remix-project/remix-lib'
@ -39,8 +39,9 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
handleHide: null handleHide: null
}, },
solJsonBinData: null, solJsonBinData: null,
defaultVersion: 'soljson-v0.8.24+commit.e11b9ed9.js', // this default version is defined: in makeMockCompiler (for browser test) defaultVersion: packageJson.defaultVersion, // this default version is defined: in makeMockCompiler (for browser test)
}) })
const [currentVersion, setCurrentVersion] = useState('') const [currentVersion, setCurrentVersion] = useState('')
const [hideWarnings, setHideWarnings] = useState<boolean>(false) const [hideWarnings, setHideWarnings] = useState<boolean>(false)
const [compileErrors, setCompileErrors] = useState<Record<string, CompileErrors>>({ [currentFile]: api.compileErrors }) const [compileErrors, setCompileErrors] = useState<Record<string, CompileErrors>>({ [currentFile]: api.compileErrors })

@ -1,5 +1,5 @@
import React from 'react' import React from 'react'
import { bufferToHex } from '@ethereumjs/util' import { bytesToHex } from '@ethereumjs/util'
import { hash } from '@remix-project/remix-lib' import { hash } from '@remix-project/remix-lib'
import { TEMPLATE_METADATA, TEMPLATE_NAMES } from '../utils/constants' import { TEMPLATE_METADATA, TEMPLATE_NAMES } from '../utils/constants'
import { TemplateType } from '../types' import { TemplateType } from '../types'
@ -253,7 +253,7 @@ export const loadWorkspacePreset = async (template: WorkspaceTemplate = 'remixDe
let content let content
if (params.code) { if (params.code) {
const hashed = bufferToHex(hash.keccakFromString(params.code)) const hashed = bytesToHex(hash.keccakFromString(params.code))
path = 'contract-' + hashed.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(decodeURIComponent(params.code)) content = atob(decodeURIComponent(params.code))
@ -272,7 +272,7 @@ export const loadWorkspacePreset = async (template: WorkspaceTemplate = 'remixDe
// authorization: auth // authorization: auth
} }
}) })
const hashed = bufferToHex(hash.keccakFromString(params.shareCode)) const hashed = bytesToHex(hash.keccakFromString(params.shareCode))
path = 'contract-' + hashed.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')
const fileData = ipfs.get(params.shareCode) const fileData = ipfs.get(params.shareCode)

@ -4,6 +4,7 @@
"license": "MIT", "license": "MIT",
"description": "Ethereum Remix Monorepo", "description": "Ethereum Remix Monorepo",
"main": "index.js", "main": "index.js",
"defaultVersion": "soljson-v0.8.25+commit.b61c2a91.js",
"keywords": [ "keywords": [
"ethereum", "ethereum",
"solidity", "solidity",
@ -130,13 +131,13 @@
"@babel/plugin-proposal-class-properties": "^7.16.0", "@babel/plugin-proposal-class-properties": "^7.16.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
"@erebos/bzz-node": "^0.13.0", "@erebos/bzz-node": "^0.13.0",
"@ethereumjs/block": "^4.2.0", "@ethereumjs/block": "5.2.0",
"@ethereumjs/common": "^3.1.1", "@ethereumjs/common": "4.3.0",
"@ethereumjs/evm": "^1.3.1", "@ethereumjs/evm": "3.0.0",
"@ethereumjs/statemanager": "^1.0.4", "@ethereumjs/statemanager": "2.3.0",
"@ethereumjs/tx": "^4.1.1", "@ethereumjs/tx": "5.3.0",
"@ethereumjs/util": "^8.0.5", "@ethereumjs/util": "9.0.3",
"@ethereumjs/vm": "^6.4.1", "@ethereumjs/vm": "8.0.0",
"@ethersphere/bee-js": "^3.2.0", "@ethersphere/bee-js": "^3.2.0",
"@isomorphic-git/lightning-fs": "^4.4.1", "@isomorphic-git/lightning-fs": "^4.4.1",
"@microlink/react-json-view": "^1.23.0", "@microlink/react-json-view": "^1.23.0",
@ -230,11 +231,13 @@
"remark-gfm": "^3.0.1", "remark-gfm": "^3.0.1",
"rlp": "^3.0.0", "rlp": "^3.0.0",
"rss-parser": "^3.12.0", "rss-parser": "^3.12.0",
"rustbn-wasm": "^0.4.0",
"signale": "^1.4.0", "signale": "^1.4.0",
"snarkjs": "^0.7.0", "snarkjs": "^0.7.0",
"sol2uml": "^2.4.3", "sol2uml": "^2.4.3",
"string-similarity": "^4.0.4", "string-similarity": "^4.0.4",
"svg2pdf.js": "^2.2.1", "svg2pdf.js": "^2.2.1",
"text-encoding": "^0.7.0",
"time-stamp": "^2.2.0", "time-stamp": "^2.2.0",
"toml": "^3.0.0", "toml": "^3.0.0",
"tree-kill": "^1.2.2", "tree-kill": "^1.2.2",
@ -402,6 +405,15 @@
"webpack-cli": "^4.10.0" "webpack-cli": "^4.10.0"
}, },
"resolutions": { "resolutions": {
"@types/react": "^18.2.0" "@types/react": "^18.2.0",
"@ethereumjs/blockchain": "7.2.0",
"@ethereumjs/block": "5.2.0",
"@ethereumjs/common": "4.3.0",
"@ethereumjs/evm": "3.0.0",
"@ethereumjs/statemanager": "2.3.0",
"@ethereumjs/tx": "5.3.0",
"@ethereumjs/util": "9.0.3",
"@ethereumjs/vm": "8.0.0",
"@ethereumjs/trie": "6.2.0"
} }
} }

@ -1819,11 +1819,6 @@
resolved "https://registry.yarnpkg.com/@chainsafe/as-sha256/-/as-sha256-0.3.1.tgz#3639df0e1435cab03f4d9870cc3ac079e57a6fc9" resolved "https://registry.yarnpkg.com/@chainsafe/as-sha256/-/as-sha256-0.3.1.tgz#3639df0e1435cab03f4d9870cc3ac079e57a6fc9"
integrity sha512-hldFFYuf49ed7DAakWVXSJODuq3pzJEguD8tQ7h+sGkM18vja+OFoJI9krnGmgzyuZC2ETX0NOIcCTy31v2Mtg== integrity sha512-hldFFYuf49ed7DAakWVXSJODuq3pzJEguD8tQ7h+sGkM18vja+OFoJI9krnGmgzyuZC2ETX0NOIcCTy31v2Mtg==
"@chainsafe/as-sha256@^0.4.1":
version "0.4.1"
resolved "https://registry.yarnpkg.com/@chainsafe/as-sha256/-/as-sha256-0.4.1.tgz#cfc0737e25f8c206767bdb6703e7943e5d44513e"
integrity sha512-IqeeGwQihK6Y2EYLFofqs2eY2ep1I2MvQXHzOAI+5iQN51OZlUkrLgyAugu2x86xZewDk5xas7lNczkzFzF62w==
"@chainsafe/persistent-merkle-tree@^0.4.2": "@chainsafe/persistent-merkle-tree@^0.4.2":
version "0.4.2" version "0.4.2"
resolved "https://registry.yarnpkg.com/@chainsafe/persistent-merkle-tree/-/persistent-merkle-tree-0.4.2.tgz#4c9ee80cc57cd3be7208d98c40014ad38f36f7ff" resolved "https://registry.yarnpkg.com/@chainsafe/persistent-merkle-tree/-/persistent-merkle-tree-0.4.2.tgz#4c9ee80cc57cd3be7208d98c40014ad38f36f7ff"
@ -1838,14 +1833,6 @@
dependencies: dependencies:
"@chainsafe/as-sha256" "^0.3.1" "@chainsafe/as-sha256" "^0.3.1"
"@chainsafe/persistent-merkle-tree@^0.6.1":
version "0.6.1"
resolved "https://registry.yarnpkg.com/@chainsafe/persistent-merkle-tree/-/persistent-merkle-tree-0.6.1.tgz#37bde25cf6cbe1660ad84311aa73157dc86ec7f2"
integrity sha512-gcENLemRR13+1MED2NeZBMA7FRS0xQPM7L2vhMqvKkjqtFT4YfjSVADq5U0iLuQLhFUJEMVuA8fbv5v+TN6O9A==
dependencies:
"@chainsafe/as-sha256" "^0.4.1"
"@noble/hashes" "^1.3.0"
"@chainsafe/ssz@^0.10.0": "@chainsafe/ssz@^0.10.0":
version "0.10.2" version "0.10.2"
resolved "https://registry.yarnpkg.com/@chainsafe/ssz/-/ssz-0.10.2.tgz#c782929e1bb25fec66ba72e75934b31fd087579e" resolved "https://registry.yarnpkg.com/@chainsafe/ssz/-/ssz-0.10.2.tgz#c782929e1bb25fec66ba72e75934b31fd087579e"
@ -1854,14 +1841,6 @@
"@chainsafe/as-sha256" "^0.3.1" "@chainsafe/as-sha256" "^0.3.1"
"@chainsafe/persistent-merkle-tree" "^0.5.0" "@chainsafe/persistent-merkle-tree" "^0.5.0"
"@chainsafe/ssz@^0.11.1":
version "0.11.1"
resolved "https://registry.yarnpkg.com/@chainsafe/ssz/-/ssz-0.11.1.tgz#d4aec883af2ec5196ae67b96242c467da20b2476"
integrity sha512-cB8dBkgGN6ZoeOKuk+rIRHKN0L5i9JLGeC0Lui71QX0TuLcQKwgbfkUexpyJxnGFatWf8yeJxlOjozMn/OTP0g==
dependencies:
"@chainsafe/as-sha256" "^0.4.1"
"@chainsafe/persistent-merkle-tree" "^0.6.1"
"@chainsafe/ssz@^0.9.2": "@chainsafe/ssz@^0.9.2":
version "0.9.4" version "0.9.4"
resolved "https://registry.yarnpkg.com/@chainsafe/ssz/-/ssz-0.9.4.tgz#696a8db46d6975b600f8309ad3a12f7c0e310497" resolved "https://registry.yarnpkg.com/@chainsafe/ssz/-/ssz-0.9.4.tgz#696a8db46d6975b600f8309ad3a12f7c0e310497"
@ -2284,165 +2263,148 @@
resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.44.0.tgz#961a5903c74139390478bdc808bcde3fc45ab7af" resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.44.0.tgz#961a5903c74139390478bdc808bcde3fc45ab7af"
integrity sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw== integrity sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw==
"@ethereumjs/block@^4.2.0", "@ethereumjs/block@^4.2.2": "@ethereumjs/block@5.2.0", "@ethereumjs/block@^5.2.0":
version "4.2.2" version "5.2.0"
resolved "https://registry.yarnpkg.com/@ethereumjs/block/-/block-4.2.2.tgz#fddecd34ed559f84ab8eb13098a6dee51a1360ae" resolved "https://registry.yarnpkg.com/@ethereumjs/block/-/block-5.2.0.tgz#f6722dcce597150a7a8fc32803f5e8dcdfdeebeb"
integrity sha512-kMxjeUwJSuLMwnavok5W17ayMNXXsu3hWsllK33XtZgoqt4ywvGo6ABh+xVEqwq/nn/iKuryCpDYYKEyXeFOlA== integrity sha512-NuVDtD58zyjm5lO3AKPaelzX9VywNwRpDF7WTCY0SKFlD5OeewK5Rdb6LWhwmdQ0ngiIg0Nh/36AQ/8W1nEhjw==
dependencies: dependencies:
"@ethereumjs/common" "^3.1.2" "@ethereumjs/common" "^4.3.0"
"@ethereumjs/rlp" "^4.0.1" "@ethereumjs/rlp" "^5.0.2"
"@ethereumjs/trie" "^5.0.5" "@ethereumjs/trie" "^6.2.0"
"@ethereumjs/tx" "^4.1.2" "@ethereumjs/tx" "^5.3.0"
"@ethereumjs/util" "^8.0.6" "@ethereumjs/util" "^9.0.3"
ethereum-cryptography "^2.0.0" ethereum-cryptography "^2.1.3"
"@ethereumjs/blockchain@^6.2.2": "@ethereumjs/blockchain@7.2.0", "@ethereumjs/blockchain@^7.2.0":
version "6.2.2" version "7.2.0"
resolved "https://registry.yarnpkg.com/@ethereumjs/blockchain/-/blockchain-6.2.2.tgz#68897a802839b217967083958022601a12afa0ed" resolved "https://registry.yarnpkg.com/@ethereumjs/blockchain/-/blockchain-7.2.0.tgz#11f03b12a18b9995d6c13431bfa92c4bf01d8a57"
integrity sha512-w1Zjskk35hr0qe0Zfwb88qrEFQJNMo73YrsqtJuBap+WamibEsw0rVuN4Ch+o8Dc66An+8rpk5SxEIK7PHF7KQ== integrity sha512-VIylDQR81n1a0BpDZwihGNYHQdxPpz2LfQ4m2jGRtLnY6mu3PEdrriikVN4VKjRDsWInr5Pcz2u2CJsriVXusQ==
dependencies: dependencies:
"@ethereumjs/block" "^4.2.2" "@ethereumjs/block" "^5.2.0"
"@ethereumjs/common" "^3.1.2" "@ethereumjs/common" "^4.3.0"
"@ethereumjs/ethash" "^2.0.5" "@ethereumjs/ethash" "^3.0.3"
"@ethereumjs/rlp" "^4.0.1" "@ethereumjs/rlp" "^5.0.2"
"@ethereumjs/trie" "^5.0.5" "@ethereumjs/trie" "^6.2.0"
"@ethereumjs/tx" "^4.1.2" "@ethereumjs/tx" "^5.3.0"
"@ethereumjs/util" "^8.0.6" "@ethereumjs/util" "^9.0.3"
abstract-level "^1.0.3"
debug "^4.3.3" debug "^4.3.3"
ethereum-cryptography "^2.0.0" ethereum-cryptography "^2.1.3"
level "^8.0.0" lru-cache "10.1.0"
lru-cache "^5.1.1"
memory-level "^1.0.0"
"@ethereumjs/common@^3.1.1", "@ethereumjs/common@^3.1.2": "@ethereumjs/common@4.3.0", "@ethereumjs/common@^4.3.0":
version "3.1.2" version "4.3.0"
resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-3.1.2.tgz#c810301b78bcb7526bd690c6d7eb3f4a3c70839d" resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-4.3.0.tgz#5b45eec7dcf521fa4ddaf0b383072fbcf9913553"
integrity sha512-YV+bZfRlFhAXg+FfwC5r4UQKVj4OG7vDP5/JvvNXLLbYpNplH5Vca9jD0L+ab8y0YlTYJMQM1ALyHFu3AE3eBA== integrity sha512-shBNJ0ewcPNTUfZduHiczPmqkfJDn0Dh/9BR5fq7xUFTuIq7Fu1Vx00XDwQVIrpVL70oycZocOhBM6nDO+4FEQ==
dependencies:
"@ethereumjs/util" "^8.0.6"
crc-32 "^1.2.0"
"@ethereumjs/common@^3.2.0":
version "3.2.0"
resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-3.2.0.tgz#b71df25845caf5456449163012074a55f048e0a0"
integrity sha512-pksvzI0VyLgmuEF2FA/JR/4/y6hcPq8OUail3/AvycBaW1d5VSauOZzqGvJ3RTmR4MU35lWE8KseKOsEhrFRBA==
dependencies: dependencies:
"@ethereumjs/util" "^8.1.0" "@ethereumjs/util" "^9.0.3"
crc-32 "^1.2.0"
"@ethereumjs/ethash@^2.0.5": "@ethereumjs/ethash@^3.0.3":
version "2.0.5" version "3.0.3"
resolved "https://registry.yarnpkg.com/@ethereumjs/ethash/-/ethash-2.0.5.tgz#577b9d470eea6b61f77d624b58ac90929d6e857d" resolved "https://registry.yarnpkg.com/@ethereumjs/ethash/-/ethash-3.0.3.tgz#2b8131bdcdae16b71773b442beeefed5fefeb3e0"
integrity sha512-JIPr39Zd9lULLftyzPGHUQmdziElqNWk0EkO1BAw3yns4TVx+BxCYZOkRQ55fuIFeKcXBupAI9V+7xdvIT2CPw== integrity sha512-AYW1HviuHmmgl/DlbzC50i7P5/XxMofxXSMfGmC8717WO3fvjAClYrwsHETtpuETkwwVNW4sY+4m2HR13K226w==
dependencies: dependencies:
"@ethereumjs/block" "^4.2.2" "@ethereumjs/block" "^5.2.0"
"@ethereumjs/rlp" "^4.0.1" "@ethereumjs/rlp" "^5.0.2"
"@ethereumjs/util" "^8.0.6" "@ethereumjs/util" "^9.0.3"
abstract-level "^1.0.3"
bigint-crypto-utils "^3.2.2" bigint-crypto-utils "^3.2.2"
ethereum-cryptography "^2.0.0" ethereum-cryptography "^2.1.3"
"@ethereumjs/evm@^1.3.1", "@ethereumjs/evm@^1.3.2": "@ethereumjs/evm@3.0.0", "@ethereumjs/evm@^3.0.0":
version "1.3.2" version "3.0.0"
resolved "https://registry.yarnpkg.com/@ethereumjs/evm/-/evm-1.3.2.tgz#3123190b0d021122b183534d7b040a3b241905b8" resolved "https://registry.yarnpkg.com/@ethereumjs/evm/-/evm-3.0.0.tgz#ab7795fac5a45b85eada06d9a0b53d55ce05ad0c"
integrity sha512-9PzshkvwO8YBkSD9+vyhJuzM6hxfZlljGnuUbXQlTSGEod7we8BRyzJW53W7nw/WRw5U6wf9Q2fpWypfZFkrbw== integrity sha512-hG5VajXG28UWab0LkptDun8ZnUnB1y2cZeNTjrmnz9Q0+UZxFJaU8RaFqaIoOOOoAt3vqMI7tXvnc+VPdNnhLg==
dependencies: dependencies:
"@ethereumjs/common" "^3.1.2" "@ethereumjs/common" "^4.3.0"
"@ethereumjs/tx" "^4.1.2" "@ethereumjs/statemanager" "^2.3.0"
"@ethereumjs/util" "^8.0.6" "@ethereumjs/tx" "^5.3.0"
"@ethersproject/providers" "^5.7.1" "@ethereumjs/util" "^9.0.3"
"@types/debug" "^4.1.9"
debug "^4.3.3" debug "^4.3.3"
ethereum-cryptography "^2.0.0" ethereum-cryptography "^2.1.3"
mcl-wasm "^0.7.1" rustbn-wasm "^0.4.0"
rustbn.js "~0.2.0"
"@ethereumjs/rlp@^4.0.1": "@ethereumjs/rlp@^4.0.1":
version "4.0.1" version "4.0.1"
resolved "https://registry.yarnpkg.com/@ethereumjs/rlp/-/rlp-4.0.1.tgz#626fabfd9081baab3d0a3074b0c7ecaf674aaa41" resolved "https://registry.yarnpkg.com/@ethereumjs/rlp/-/rlp-4.0.1.tgz#626fabfd9081baab3d0a3074b0c7ecaf674aaa41"
integrity sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw== integrity sha512-tqsQiBQDQdmPWE1xkkBq4rlSW5QZpLOUJ5RJh2/9fug+q9tnUhuZoVLk7s0scUIKTOzEtR72DFBXI4WiZcMpvw==
"@ethereumjs/statemanager@^1.0.4", "@ethereumjs/statemanager@^1.0.5": "@ethereumjs/rlp@^5.0.2":
version "1.0.5" version "5.0.2"
resolved "https://registry.yarnpkg.com/@ethereumjs/statemanager/-/statemanager-1.0.5.tgz#4496a315d27e60d9a3a036dbe82899f6f20dd2df" resolved "https://registry.yarnpkg.com/@ethereumjs/rlp/-/rlp-5.0.2.tgz#c89bd82f2f3bec248ab2d517ae25f5bbc4aac842"
integrity sha512-TVkx9Kgc2NtObCzUTTqrpUggNLnftdmxZybzKPd565Bh98FJJB30FrVkWdPwaIV8oB1d9ADtthttfx5Y/kY9gw== integrity sha512-DziebCdg4JpGlEqEdGgXmjqcFoJi+JGulUXwEjsZGAscAQ7MyD/7LE/GVCP29vEQxKc7AAwjT3A2ywHp2xfoCA==
dependencies:
"@ethereumjs/common" "^3.1.2" "@ethereumjs/statemanager@2.3.0", "@ethereumjs/statemanager@^2.3.0":
"@ethereumjs/rlp" "^4.0.1" version "2.3.0"
resolved "https://registry.yarnpkg.com/@ethereumjs/statemanager/-/statemanager-2.3.0.tgz#d0ef028b1f44a9c57f98ef6eb0481db3add325d3"
integrity sha512-mHxbtvjN126qwT+dqA5Vev99QR4L+RD/BeZEnFbPsEDrBflMssLMaXZahKzQnMu5iqGOc1KLtT0g1ONl6+JpCA==
dependencies:
"@ethereumjs/common" "^4.3.0"
"@ethereumjs/rlp" "^5.0.2"
"@ethereumjs/trie" "^6.2.0"
"@ethereumjs/util" "^9.0.3"
"@ethereumjs/verkle" "^0.0.2"
debug "^4.3.3" debug "^4.3.3"
ethereum-cryptography "^2.0.0" ethereum-cryptography "^2.1.3"
ethers "^5.7.1"
js-sdsl "^4.1.4" js-sdsl "^4.1.4"
lru-cache "10.1.0"
"@ethereumjs/trie@^5.0.5": "@ethereumjs/trie@6.2.0", "@ethereumjs/trie@^6.2.0":
version "5.0.5" version "6.2.0"
resolved "https://registry.yarnpkg.com/@ethereumjs/trie/-/trie-5.0.5.tgz#c232a4913871ffc45bf52cccd214fe5aa24cb3e2" resolved "https://registry.yarnpkg.com/@ethereumjs/trie/-/trie-6.2.0.tgz#1ebcece0c962f90c15c189fb67b90a1409422d19"
integrity sha512-H3gHtYxJVGfkT4H05LTJfD1W6h9WZYNkfhTUyAYruNZKFitkSHUM/bEFWH/GIhxt5SAkf283F5uJOx7X2Fr6pQ== integrity sha512-4k9SrfIBTMi8MROXglKxk+jS15qcELUeLwI+NnKJOTCdci2ArhoQpiuRHT6aeXB+2P2cWX2OQHbSVtW9AqabDQ==
dependencies: dependencies:
"@ethereumjs/rlp" "^4.0.1" "@ethereumjs/rlp" "^5.0.2"
"@ethereumjs/util" "^8.0.6" "@ethereumjs/util" "^9.0.3"
"@types/readable-stream" "^2.3.13" "@types/readable-stream" "^2.3.13"
ethereum-cryptography "^2.0.0" debug "^4.3.4"
ethereum-cryptography "^2.1.3"
lru-cache "10.1.0"
readable-stream "^3.6.0" readable-stream "^3.6.0"
"@ethereumjs/tx@^4.1.1", "@ethereumjs/tx@^4.1.2": "@ethereumjs/tx@5.3.0", "@ethereumjs/tx@^4.1.2", "@ethereumjs/tx@^4.2.0", "@ethereumjs/tx@^5.3.0":
version "4.1.2" version "5.3.0"
resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-4.1.2.tgz#10bc6741b74d2404331b82b87f9b2c26177b6f90" resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-5.3.0.tgz#473f351729ef4e30eaa3a3fb5aaccd4405a7ee41"
integrity sha512-PWWyO9lAFOiLwk7nB9OQisoJUsuvMz2PN2v4/ILbBpzamC5Ug79OddVq9r4rKvIDLPY+bn4NFerxBJg29+sjaA== integrity sha512-uv++XYuIfuqYbvymL3/o14hHuC6zX0nRQ1nI2FHsbkkorLZ2ChEIDqVeeVk7Xc9/jQNU/22sk9qZZkRlsveXxw==
dependencies: dependencies:
"@chainsafe/ssz" "^0.11.1" "@ethereumjs/common" "^4.3.0"
"@ethereumjs/common" "^3.1.2" "@ethereumjs/rlp" "^5.0.2"
"@ethereumjs/rlp" "^4.0.1" "@ethereumjs/util" "^9.0.3"
"@ethereumjs/util" "^8.0.6" ethereum-cryptography "^2.1.3"
ethereum-cryptography "^2.0.0"
"@ethereumjs/tx@^4.2.0": "@ethereumjs/util@9.0.3", "@ethereumjs/util@^9.0.3":
version "4.2.0" version "9.0.3"
resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-4.2.0.tgz#5988ae15daf5a3b3c815493bc6b495e76009e853" resolved "https://registry.yarnpkg.com/@ethereumjs/util/-/util-9.0.3.tgz#c2709e6127a85bbe23a71937ac78358ac93e7241"
integrity sha512-1nc6VO4jtFd172BbSnTnDQVr9IYBFl1y4xPzZdtkrkKIncBCkdbgfdRV+MiTkJYAtTxvV12GRZLqBFT1PNK6Yw== integrity sha512-PmwzWDflky+7jlZIFqiGsBPap12tk9zK5SVH9YW2OEnDN7OEhCjUOMzbOqwuClrbkSIkM2ERivd7sXZ48Rh/vg==
dependencies:
"@ethereumjs/common" "^3.2.0"
"@ethereumjs/rlp" "^4.0.1"
"@ethereumjs/util" "^8.1.0"
ethereum-cryptography "^2.0.0"
"@ethereumjs/util@^8.0.5", "@ethereumjs/util@^8.0.6":
version "8.0.6"
resolved "https://registry.yarnpkg.com/@ethereumjs/util/-/util-8.0.6.tgz#f9716ed34235ea05eff8353bc5d483e5a6455989"
integrity sha512-zFLG/gXtF3QUC7iKFn4PT6HCr+DEnlCbwUGKGtXoqjA+64T+e0FuqMjlo4bQIY2ngRzk3EtudKdGYC4g31ehhg==
dependencies: dependencies:
"@chainsafe/ssz" "^0.11.1" "@ethereumjs/rlp" "^5.0.2"
"@ethereumjs/rlp" "^4.0.1" ethereum-cryptography "^2.1.3"
ethereum-cryptography "^2.0.0"
micro-ftch "^0.3.1"
"@ethereumjs/util@^8.1.0": "@ethereumjs/verkle@^0.0.2":
version "8.1.0" version "0.0.2"
resolved "https://registry.yarnpkg.com/@ethereumjs/util/-/util-8.1.0.tgz#299df97fb6b034e0577ce9f94c7d9d1004409ed4" resolved "https://registry.yarnpkg.com/@ethereumjs/verkle/-/verkle-0.0.2.tgz#1c3c3d23e859e15b61c3d60a125962e761f3e135"
integrity sha512-zQ0IqbdX8FZ9aw11vP+dZkKDkS+kgIvQPHnSAXzP9pLu+Rfu3D3XEeLbicvoXJTYnhZiPmsZUxgdzXwNKxRPbA== integrity sha512-uUVdUJnkugHBHz6aNRBzQZCqZGtjDigfMYtJ7GfjWN0g7hIftnNWn1NEWRU7Fi+ypD8fvedrV5wcZ20Uofmz2Q==
dependencies: dependencies:
"@ethereumjs/rlp" "^4.0.1" "@ethereumjs/rlp" "^5.0.2"
ethereum-cryptography "^2.0.0" "@ethereumjs/util" "^9.0.3"
micro-ftch "^0.3.1" lru-cache "^10.0.0"
rust-verkle-wasm "^0.0.1"
"@ethereumjs/vm@^6.4.1": "@ethereumjs/vm@8.0.0":
version "6.4.2" version "8.0.0"
resolved "https://registry.yarnpkg.com/@ethereumjs/vm/-/vm-6.4.2.tgz#9898105a96f0975d561db69319331944db4bfafc" resolved "https://registry.yarnpkg.com/@ethereumjs/vm/-/vm-8.0.0.tgz#fdb495214340b0bbc3e17bec67c04b8cfc37daba"
integrity sha512-kTzOvJfNpUQHi2a0SbglYNWHIEOg5j3NlN80KU0IrdagWAeaEqz6Jj5XVN5lBs4VAfwXNdf+56xYtMg8Nate7Q== integrity sha512-eC5ghbSYKSG7qQZHlKh/tBTWEYOHx/ZAm8tmwt29e5N33m/FR2i9Rjx7Bb3Y3j+hlkR53FBFRGG6VQl0eiA4sw==
dependencies: dependencies:
"@ethereumjs/block" "^4.2.2" "@ethereumjs/block" "^5.2.0"
"@ethereumjs/blockchain" "^6.2.2" "@ethereumjs/blockchain" "^7.2.0"
"@ethereumjs/common" "^3.1.2" "@ethereumjs/common" "^4.3.0"
"@ethereumjs/evm" "^1.3.2" "@ethereumjs/evm" "^3.0.0"
"@ethereumjs/rlp" "^4.0.1" "@ethereumjs/rlp" "^5.0.2"
"@ethereumjs/statemanager" "^1.0.5" "@ethereumjs/statemanager" "^2.3.0"
"@ethereumjs/trie" "^5.0.5" "@ethereumjs/trie" "^6.2.0"
"@ethereumjs/tx" "^4.1.2" "@ethereumjs/tx" "^5.3.0"
"@ethereumjs/util" "^8.0.6" "@ethereumjs/util" "^9.0.3"
debug "^4.3.3" debug "^4.3.3"
ethereum-cryptography "^2.0.0" ethereum-cryptography "^2.1.3"
mcl-wasm "^0.7.1"
rustbn.js "~0.2.0"
"@ethersphere/bee-js@^3.2.0": "@ethersphere/bee-js@^3.2.0":
version "3.2.0" version "3.2.0"
@ -4220,17 +4182,24 @@
dependencies: dependencies:
"@noble/hashes" "1.3.0" "@noble/hashes" "1.3.0"
"@noble/curves@1.3.0", "@noble/curves@~1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.3.0.tgz#01be46da4fd195822dab821e72f71bf4aeec635e"
integrity sha512-t01iSXPuN+Eqzb4eBX0S5oubSqXbK/xXa1Ne18Hj8f9pStxztHCE2gfboSp/dZRLSqfuLpRK2nDXDK+W9puocA==
dependencies:
"@noble/hashes" "1.3.3"
"@noble/hashes@1.2.0", "@noble/hashes@~1.2.0": "@noble/hashes@1.2.0", "@noble/hashes@~1.2.0":
version "1.2.0" version "1.2.0"
resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.2.0.tgz#a3150eeb09cc7ab207ebf6d7b9ad311a9bdbed12" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.2.0.tgz#a3150eeb09cc7ab207ebf6d7b9ad311a9bdbed12"
integrity sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ== integrity sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ==
"@noble/hashes@1.3.0", "@noble/hashes@^1.3.0", "@noble/hashes@~1.3.0": "@noble/hashes@1.3.0", "@noble/hashes@~1.3.0":
version "1.3.0" version "1.3.0"
resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.0.tgz#085fd70f6d7d9d109671090ccae1d3bec62554a1" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.0.tgz#085fd70f6d7d9d109671090ccae1d3bec62554a1"
integrity sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg== integrity sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==
"@noble/hashes@^1.3.1": "@noble/hashes@1.3.3", "@noble/hashes@^1.3.1", "@noble/hashes@~1.3.2":
version "1.3.3" version "1.3.3"
resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.3.tgz#39908da56a4adc270147bb07968bf3b16cfe1699" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.3.tgz#39908da56a4adc270147bb07968bf3b16cfe1699"
integrity sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA== integrity sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==
@ -5564,7 +5533,7 @@
estree-walker "^2.0.1" estree-walker "^2.0.1"
picomatch "^2.2.2" picomatch "^2.2.2"
"@scure/base@^1.1.3": "@scure/base@^1.1.3", "@scure/base@^1.1.5", "@scure/base@~1.1.4":
version "1.1.5" version "1.1.5"
resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.5.tgz#1d85d17269fe97694b9c592552dd9e5e33552157" resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.5.tgz#1d85d17269fe97694b9c592552dd9e5e33552157"
integrity sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ== integrity sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==
@ -5592,6 +5561,15 @@
"@noble/hashes" "~1.3.0" "@noble/hashes" "~1.3.0"
"@scure/base" "~1.1.0" "@scure/base" "~1.1.0"
"@scure/bip32@1.3.3":
version "1.3.3"
resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.3.tgz#a9624991dc8767087c57999a5d79488f48eae6c8"
integrity sha512-LJaN3HwRbfQK0X1xFSi0Q9amqOgzQnnDngIt+ZlsBC3Bm7/nE7K0kwshZHyaru79yIVRv/e1mQAjZyuZG6jOFQ==
dependencies:
"@noble/curves" "~1.3.0"
"@noble/hashes" "~1.3.2"
"@scure/base" "~1.1.4"
"@scure/bip39@1.1.1": "@scure/bip39@1.1.1":
version "1.1.1" version "1.1.1"
resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.1.1.tgz#b54557b2e86214319405db819c4b6a370cf340c5" resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.1.1.tgz#b54557b2e86214319405db819c4b6a370cf340c5"
@ -5608,6 +5586,14 @@
"@noble/hashes" "~1.3.0" "@noble/hashes" "~1.3.0"
"@scure/base" "~1.1.0" "@scure/base" "~1.1.0"
"@scure/bip39@1.2.2":
version "1.2.2"
resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.2.tgz#f3426813f4ced11a47489cbcf7294aa963966527"
integrity sha512-HYf9TUXG80beW+hGAt3TRM8wU6pQoYur9iNypTROm42dorCGmLnFe3eWjz3gOq6G62H2WRh0FCzAR1PI+29zIA==
dependencies:
"@noble/hashes" "~1.3.2"
"@scure/base" "~1.1.4"
"@sentry/core@5.30.0": "@sentry/core@5.30.0":
version "5.30.0" version "5.30.0"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.30.0.tgz#6b203664f69e75106ee8b5a2fe1d717379b331f3" resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.30.0.tgz#6b203664f69e75106ee8b5a2fe1d717379b331f3"
@ -6184,7 +6170,7 @@
dependencies: dependencies:
"@types/ms" "*" "@types/ms" "*"
"@types/debug@^4.1.7": "@types/debug@^4.1.7", "@types/debug@^4.1.9":
version "4.1.12" version "4.1.12"
resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.12.tgz#a155f21690871953410df4b6b6f53187f0500917" resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.12.tgz#a155f21690871953410df4b6b6f53187f0500917"
integrity sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ== integrity sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==
@ -13800,6 +13786,16 @@ ethereum-cryptography@^2.0.0:
"@scure/bip32" "1.3.0" "@scure/bip32" "1.3.0"
"@scure/bip39" "1.2.0" "@scure/bip39" "1.2.0"
ethereum-cryptography@^2.1.3:
version "2.1.3"
resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-2.1.3.tgz#1352270ed3b339fe25af5ceeadcf1b9c8e30768a"
integrity sha512-BlwbIL7/P45W8FGW2r7LGuvoEZ+7PWsniMvQ4p5s2xCyw9tmaDlpfsN9HjAucbF+t/qpVHwZUisgfK24TCW8aA==
dependencies:
"@noble/curves" "1.3.0"
"@noble/hashes" "1.3.3"
"@scure/bip32" "1.3.3"
"@scure/bip39" "1.2.2"
ethereumjs-abi@^0.6.8: ethereumjs-abi@^0.6.8:
version "0.6.8" version "0.6.8"
resolved "https://registry.yarnpkg.com/ethereumjs-abi/-/ethereumjs-abi-0.6.8.tgz#71bc152db099f70e62f108b7cdfca1b362c6fcae" resolved "https://registry.yarnpkg.com/ethereumjs-abi/-/ethereumjs-abi-0.6.8.tgz#71bc152db099f70e62f108b7cdfca1b362c6fcae"
@ -19819,7 +19815,7 @@ lowercase-keys@^2.0.0:
resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479" resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479"
integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA== integrity sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==
lru-cache@^10.0.0, lru-cache@^10.0.2: lru-cache@10.1.0, lru-cache@^10.0.0, lru-cache@^10.0.2:
version "10.1.0" version "10.1.0"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.1.0.tgz#2098d41c2dc56500e6c88584aa656c84de7d0484" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.1.0.tgz#2098d41c2dc56500e6c88584aa656c84de7d0484"
integrity sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag== integrity sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==
@ -20371,11 +20367,6 @@ methods@~1.1.2:
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=
micro-ftch@^0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/micro-ftch/-/micro-ftch-0.3.1.tgz#6cb83388de4c1f279a034fb0cf96dfc050853c5f"
integrity sha512-/0LLxhzP0tfiR5hcQebtudP56gUurs2CLkGarnCiB/OqEyUFQ6U3paQi/tgLv0hBJYt2rnr9MNpxz4fiiugstg==
micromark-core-commonmark@^1.0.0, micromark-core-commonmark@^1.0.1: micromark-core-commonmark@^1.0.0, micromark-core-commonmark@^1.0.1:
version "1.0.6" version "1.0.6"
resolved "https://registry.yarnpkg.com/micromark-core-commonmark/-/micromark-core-commonmark-1.0.6.tgz#edff4c72e5993d93724a3c206970f5a15b0585ad" resolved "https://registry.yarnpkg.com/micromark-core-commonmark/-/micromark-core-commonmark-1.0.6.tgz#edff4c72e5993d93724a3c206970f5a15b0585ad"
@ -25954,6 +25945,18 @@ run@^1.4.0:
dependencies: dependencies:
minimatch "*" minimatch "*"
rust-verkle-wasm@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/rust-verkle-wasm/-/rust-verkle-wasm-0.0.1.tgz#fd8396a7060d8ee8ea10da50ab6e862948095a74"
integrity sha512-BN6fiTsxcd2dCECz/cHtGTt9cdLJR925nh7iAuRcj8ymKw7OOaPmCneQZ7JePOJ/ia27TjEL91VdOi88Yf+mcA==
rustbn-wasm@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/rustbn-wasm/-/rustbn-wasm-0.4.0.tgz#fe5601c8d795dd9aa91c19cfad9637ec1df941b0"
integrity sha512-C2ujvPv05hXC69MD7YwSsoUEsT/X/dKHkkgwN9B0ZTgb0OXDC9yaHhE6Pq+uaRAzMyW0Y97bwc4JO4cqPDzVuQ==
dependencies:
"@scure/base" "^1.1.5"
rustbn.js@~0.2.0: rustbn.js@~0.2.0:
version "0.2.0" version "0.2.0"
resolved "https://registry.yarnpkg.com/rustbn.js/-/rustbn.js-0.2.0.tgz#8082cb886e707155fd1cb6f23bd591ab8d55d0ca" resolved "https://registry.yarnpkg.com/rustbn.js/-/rustbn.js-0.2.0.tgz#8082cb886e707155fd1cb6f23bd591ab8d55d0ca"
@ -27951,6 +27954,11 @@ test-exclude@^6.0.0:
glob "^7.1.4" glob "^7.1.4"
minimatch "^3.0.4" minimatch "^3.0.4"
text-encoding@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/text-encoding/-/text-encoding-0.7.0.tgz#f895e836e45990624086601798ea98e8f36ee643"
integrity sha512-oJQ3f1hrOnbRLOcwKz0Liq2IcrvDeZRHXhd9RgLrsT+DjWY/nty1Hi7v3dtkaEYbPYe0mUoOfzRrMwfXXwgPUA==
text-extensions@^1.0.0: text-extensions@^1.0.0:
version "1.9.0" version "1.9.0"
resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-1.9.0.tgz#1853e45fee39c945ce6f6c36b2d659b5aabc2a26" resolved "https://registry.yarnpkg.com/text-extensions/-/text-extensions-1.9.0.tgz#1853e45fee39c945ce6f6c36b2d659b5aabc2a26"

Loading…
Cancel
Save