pull/1122/head
yann300 4 years ago
parent 5442d69616
commit f3c1f27fa4
  1. 1
      libs/remix-debug/src/solidity-decoder/types/Mapping.ts
  2. 47
      libs/remix-lib/src/execution/execution-context.ts
  3. 2
      libs/remix-lib/src/web3Provider/web3VmProvider.ts

@ -2,7 +2,6 @@
import { RefType } from './RefType'
import { normalizeHex } from './util'
import { toBuffer, setLengthLeft, keccak, BN, bufferToHex } from 'ethereumjs-util'
import { intToBuffer } from 'ethjs-util'
export class Mapping extends RefType {
keyType

@ -31,7 +31,6 @@ class StateManagerCommonStorageDump extends StateManager {
this.keyHashes = {}
}
putContractStorage (address, key, value) {
this.keyHashes[keccak(key).toString('hex')] = bufferToHex(key)
return super.putContractStorage(address, key, value)
@ -58,40 +57,40 @@ class StateManagerCommonStorageDump extends StateManager {
})
}
async getStateRoot (force: boolean = false): Promise<Buffer> {
if (!force && this._checkpointCount !== 0) {
async getStateRoot (force: boolean = false): Promise<Buffer> {
if (!force && this._checkpointCount !== 0) {
// throw new Error('Cannot get state root with uncommitted checkpoints')
}
}
await this._cache.flush()
await this._cache.flush()
const stateRoot = this._trie.root
return stateRoot
}
const stateRoot = this._trie.root
return stateRoot
}
async setStateRoot (stateRoot: Buffer): Promise<void> {
if (this._checkpointCount !== 0) {
async setStateRoot (stateRoot: Buffer): Promise<void> {
if (this._checkpointCount !== 0) {
// throw new Error('Cannot set state root with uncommitted checkpoints')
}
}
await this._cache.flush()
await this._cache.flush()
if (stateRoot === this._trie.EMPTY_TRIE_ROOT) {
this._trie.root = stateRoot
this._cache.clear()
this._storageTries = {}
return
}
const hasRoot = await this._trie.checkRoot(stateRoot)
if (!hasRoot) {
throw new Error('State trie does not contain state root')
}
if (stateRoot === this._trie.EMPTY_TRIE_ROOT) {
this._trie.root = stateRoot
this._cache.clear()
this._storageTries = {}
return
}
const hasRoot = await this._trie.checkRoot(stateRoot)
if (!hasRoot) {
throw new Error('State trie does not contain state root')
}
this._trie.root = stateRoot
this._cache.clear()
this._storageTries = {}
}
}
/*

@ -217,7 +217,7 @@ export class Web3VmProvider {
this.lastProcessedStorageTxHash[this.processingAddress] = this.processingHash
} catch (e) {
console.log(e)
}
}
}
}
}

Loading…
Cancel
Save