fix blockNumber

pull/4255/head
yann300 12 months ago
parent cbedfc3597
commit 2fb4a4bd7f
  1. 4
      libs/remix-lib/src/execution/txRunnerVM.ts
  2. 4
      libs/remix-simulator/src/methods/transactions.ts
  3. 2
      libs/remix-simulator/src/provider.ts
  4. 1
      libs/remix-simulator/src/vm-context.ts

@ -31,13 +31,13 @@ export class TxRunnerVM {
nextNonceForCall: number
getVMObject: () => any
constructor (vmaccounts, api, getVMObject) {
constructor (vmaccounts, api, getVMObject, blockNumber) {
this.event = new EventManager()
this.logsManager = new LogsManager()
// has a default for now for backwards compatibility
this.getVMObject = getVMObject
this.commonContext = this.getVMObject().common
this.blockNumber = 0
this.blockNumber = blockNumber || 0
this.pendingTxs = {}
this.vmaccounts = vmaccounts
this.queusTxs = []

@ -32,7 +32,7 @@ export class Transactions {
this.tags = {}
}
init (accounts) {
init (accounts, blockNumber) {
this.accounts = accounts
const api = {
logMessage: (msg) => {
@ -55,7 +55,7 @@ export class Transactions {
}
}
this.txRunnerVMInstance = new TxRunnerVM(accounts, api, _ => this.vmContext.vmObject())
this.txRunnerVMInstance = new TxRunnerVM(accounts, api, _ => this.vmContext.vmObject(), blockNumber)
this.txRunnerInstance = new TxRunner(this.txRunnerVMInstance, {})
this.txRunnerInstance.vmaccounts = accounts
}

@ -60,7 +60,7 @@ export class Provider {
this.pendingRequests = []
await this.vmContext.init()
await this.Accounts.resetAccounts()
this.Transactions.init(this.Accounts.accounts)
this.Transactions.init(this.Accounts.accounts, this.vmContext.blockNumber)
this.initialized = true
if (this.pendingRequests.length > 0) {
this.pendingRequests.map((req) => {

@ -313,6 +313,7 @@ export class VMContext {
provider: this.nodeUrl,
blockTag: '0x' + block.toString(16)
})
this.blockNumber = block
} else {
stateManager = new CustomEthersStateManager({
provider: this.nodeUrl,

Loading…
Cancel
Save