Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
c77a3e10
Commit
c77a3e10
authored
Mar 15, 2021
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move execution-context
parent
aefc8975
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
36 deletions
+15
-36
blockchain.js
apps/remix-ide/src/blockchain/blockchain.js
+2
-2
execution-context.js
apps/remix-ide/src/blockchain/execution-context.js
+12
-27
txListener.ts
libs/remix-lib/src/execution/txListener.ts
+1
-2
index.ts
libs/remix-lib/src/index.ts
+0
-2
txFormat.ts
libs/remix-lib/test/txFormat.ts
+0
-3
No files found.
apps/remix-ide/src/blockchain/blockchain.js
View file @
c77a3e10
...
...
@@ -7,7 +7,7 @@ const TxRunner = remixLib.execution.TxRunner
const
TxRunnerWeb3
=
remixLib
.
execution
.
TxRunnerWeb3
const
txHelper
=
remixLib
.
execution
.
txHelper
const
EventManager
=
remixLib
.
EventManager
const
executionContext
=
remixLib
.
execution
.
executionContext
const
{
ExecutionContext
}
=
require
(
'./execution-context'
)
const
Web3
=
require
(
'web3'
)
const
async
=
require
(
'async'
)
...
...
@@ -23,7 +23,7 @@ class Blockchain {
// NOTE: the config object will need to be refactored out in remix-lib
constructor
(
config
)
{
this
.
event
=
new
EventManager
()
this
.
executionContext
=
executionContext
this
.
executionContext
=
new
ExecutionContext
()
this
.
events
=
new
EventEmitter
()
this
.
config
=
config
...
...
libs/remix-lib/src/execution/execution-context.t
s
→
apps/remix-ide/src/blockchain/execution-context.j
s
View file @
c77a3e10
/* global ethereum */
'use strict'
import
Web3
from
'web3'
import
{
EventManager
}
from
'../eventManager
'
import
EventManager
from
'../lib/events
'
import
{
rlp
,
keccak
,
bufferToHex
}
from
'ethereumjs-util'
import
{
Web3VmProvider
}
from
'../web3Provider/web3VmProvider'
import
VM
from
'@ethereumjs/vm'
import
Common
from
'@ethereumjs/common'
import
StateManager
from
'@ethereumjs/vm/dist/state/stateManager'
import
{
StorageDump
}
from
'@ethereumjs/vm/dist/state/interface'
declare
let
ethereum
:
any
let
web3
if
(
typeof
window
!==
'undefined'
&&
typeof
window
[
'ethereum'
]
!==
'undefined'
)
{
var
injectedProvider
=
window
[
'ethereum'
]
if
(
typeof
window
!==
'undefined'
&&
typeof
window
.
ethereum
!==
'undefined'
)
{
var
injectedProvider
=
window
.
ethereum
web3
=
new
Web3
(
injectedProvider
)
}
else
{
web3
=
new
Web3
(
new
Web3
.
providers
.
HttpProvider
(
'http://localhost:8545'
))
...
...
@@ -24,12 +22,13 @@ if (typeof window !== 'undefined' && typeof window['ethereum'] !== 'undefined')
*/
class
StateManagerCommonStorageDump
extends
StateManager
{
/*
* dictionary containing keccak(b) as key and b as value. used to get the initial value from its hash
*/
keyHashes
:
{
[
key
:
string
]:
string
}
constructor
()
{
super
()
/*
* dictionary containing keccak(b) as key and b as value. used to get the initial value from its hash.
* type: { [key: string]: string }
*/
this
.
keyHashes
=
{}
}
...
...
@@ -46,7 +45,7 @@ class StateManagerCommonStorageDump extends StateManager {
console
.
log
(
e
)
throw
e
}
return
new
Promise
<
StorageDump
>
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
try
{
const
storage
=
{}
const
stream
=
trie
.
createReadStream
()
...
...
@@ -66,14 +65,14 @@ class StateManagerCommonStorageDump extends StateManager {
})
}
async
getStateRoot
(
force
:
boolean
=
false
):
Promise
<
Buffer
>
{
async
getStateRoot
(
force
=
false
)
{
await
this
.
_cache
.
flush
()
const
stateRoot
=
this
.
_trie
.
root
return
stateRoot
}
async
setStateRoot
(
stateRoot
:
Buffer
):
Promise
<
void
>
{
async
setStateRoot
(
stateRoot
)
{
await
this
.
_cache
.
flush
()
if
(
stateRoot
===
this
.
_trie
.
EMPTY_TRIE_ROOT
)
{
...
...
@@ -98,20 +97,6 @@ class StateManagerCommonStorageDump extends StateManager {
trigger contextChanged, web3EndpointChanged
*/
export
class
ExecutionContext
{
event
blockGasLimitDefault
:
number
blockGasLimit
:
number
customNetWorks
blocks
latestBlockNumber
txs
executionContext
:
string
listenOnLastBlockId
currentFork
:
string
vms
mainNetGenesisHash
:
string
customWeb3
:
{
[
key
:
string
]:
Web3
}
constructor
()
{
this
.
event
=
new
EventManager
()
this
.
executionContext
=
null
...
...
@@ -171,7 +156,7 @@ export class ExecutionContext {
return
this
.
executionContext
===
'vm'
}
setWeb3
(
context
:
string
,
web3
:
W
eb3
)
{
setWeb3
(
context
,
w
eb3
)
{
this
.
customWeb3
[
context
]
=
web3
}
...
...
libs/remix-lib/src/execution/txListener.ts
View file @
c77a3e10
...
...
@@ -4,7 +4,6 @@ import { ethers } from 'ethers'
import
{
toBuffer
}
from
'ethereumjs-util'
import
{
EventManager
}
from
'../eventManager'
import
{
compareByteCode
}
from
'../util'
import
{
ExecutionContext
}
from
'./execution-context'
import
{
decodeResponse
}
from
'./txFormat'
import
{
getFunction
,
getReceiveInterface
,
getConstructorInterface
,
visitContracts
,
makeFullTypeDefinition
}
from
'./txHelper'
...
...
@@ -40,7 +39,7 @@ export class TxListener {
constructor
(
opt
,
executionContext
)
{
this
.
event
=
new
EventManager
()
// has a default for now for backwards compatability
this
.
executionContext
=
executionContext
||
new
ExecutionContext
()
this
.
executionContext
=
executionContext
this
.
_api
=
opt
.
api
this
.
_resolvedTransactions
=
{}
this
.
_resolvedContracts
=
{}
...
...
libs/remix-lib/src/index.ts
View file @
c77a3e10
...
...
@@ -13,7 +13,6 @@ import * as txFormat from './execution/txFormat'
import
{
TxListener
}
from
'./execution/txListener'
import
{
TxRunner
}
from
'./execution/txRunner'
import
{
LogsManager
}
from
'./execution/logsManager'
import
{
ExecutionContext
}
from
'./execution/execution-context'
import
*
as
typeConversion
from
'./execution/typeConversion'
import
{
TxRunnerVM
}
from
'./execution/txRunnerVM'
import
{
TxRunnerWeb3
}
from
'./execution/txRunnerWeb3'
...
...
@@ -40,7 +39,6 @@ function modules () {
EventsDecoder
:
EventsDecoder
,
txExecution
:
txExecution
,
txHelper
:
txHelper
,
executionContext
:
new
ExecutionContext
(),
txFormat
:
txFormat
,
txListener
:
TxListener
,
TxRunner
:
TxRunner
,
...
...
libs/remix-lib/test/txFormat.ts
View file @
c77a3e10
...
...
@@ -5,8 +5,6 @@ import * as txHelper from '../src/execution/txHelper'
import
{
hexToIntArray
}
from
'../src/util'
let
compiler
=
require
(
'solc'
)
import
{
compilerInput
}
from
'../src/helpers/compilerHelper'
import
{
ExecutionContext
}
from
'../src/execution/execution-context'
const
executionContext
=
new
ExecutionContext
()
const
solidityVersion
=
'v0.6.0+commit.26b70077'
/* tape *********************************************************** */
...
...
@@ -151,7 +149,6 @@ function testInvalidTupleInput (st, params) {
/* tape *********************************************************** */
tape
(
'ContractParameters - (TxFormat.buildData) - link Libraries'
,
function
(
t
)
{
executionContext
.
setContext
(
'vm'
,
null
,
null
,
null
)
const
compileData
=
compiler
.
compile
(
compilerInput
(
deploySimpleLib
))
const
fakeDeployedContracts
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment