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
5783e74f
Unverified
Commit
5783e74f
authored
Sep 06, 2019
by
yann300
Committed by
GitHub
Sep 06, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into fix-test-reporter
parents
0dbd08ed
80f1a9ac
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
161 additions
and
102 deletions
+161
-102
package.json
package.json
+1
-1
package.json
remix-analyzer/package.json
+2
-2
package.json
remix-astwalker/package.json
+2
-2
package.json
remix-debug/package.json
+2
-2
package.json
remix-lib/package.json
+1
-1
execution-context.js
remix-lib/src/execution/execution-context.js
+18
-14
txRunner.js
remix-lib/src/execution/txRunner.js
+58
-47
universalDapp.js
remix-lib/src/universalDapp.js
+2
-2
util.js
remix-lib/src/util.js
+12
-2
package.json
remix-simulator/package.json
+3
-2
genesis.js
remix-simulator/src/genesis.js
+2
-4
accounts.js
remix-simulator/src/methods/accounts.js
+19
-10
transactions.js
remix-simulator/src/methods/transactions.js
+11
-1
provider.js
remix-simulator/src/provider.js
+7
-1
server.js
remix-simulator/src/server.js
+7
-0
package.json
remix-solidity/package.json
+2
-2
package.json
remix-tests/package.json
+4
-4
runTestSources.ts
remix-tests/src/runTestSources.ts
+6
-4
testRunner.ts
remix-tests/tests/testRunner.ts
+2
-1
No files found.
package.json
View file @
5783e74f
{
{
"version"
:
"0.1.1
6
"
,
"version"
:
"0.1.1
9
"
,
"devDependencies"
:
{
"devDependencies"
:
{
"
gulp
"
:
"^3.9.1"
,
"
gulp
"
:
"^3.9.1"
,
"
lerna
"
:
"^2.10.2"
"
lerna
"
:
"^2.10.2"
...
...
remix-analyzer/package.json
View file @
5783e74f
{
{
"name"
:
"remix-analyzer"
,
"name"
:
"remix-analyzer"
,
"version"
:
"0.3.1
0
"
,
"version"
:
"0.3.1
3
"
,
"description"
:
"Remix Analyzer"
,
"description"
:
"Remix Analyzer"
,
"main"
:
"./index.js"
,
"main"
:
"./index.js"
,
"contributors"
:
[
"contributors"
:
[
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
}
}
],
],
"dependencies"
:
{
"dependencies"
:
{
"remix-lib"
:
"0.4.
9
"
"remix-lib"
:
"0.4.
12
"
},
},
"scripts"
:
{
"scripts"
:
{
"lint"
:
"standard"
,
"lint"
:
"standard"
,
...
...
remix-astwalker/package.json
View file @
5783e74f
{
{
"name"
:
"remix-astwalker"
,
"name"
:
"remix-astwalker"
,
"version"
:
"0.0.
6
"
,
"version"
:
"0.0.
9
"
,
"description"
:
"Remix sub-module for walking through AST"
,
"description"
:
"Remix sub-module for walking through AST"
,
"main"
:
"dist/index.js"
,
"main"
:
"dist/index.js"
,
"scripts"
:
{
"scripts"
:
{
...
@@ -34,7 +34,7 @@
...
@@ -34,7 +34,7 @@
"dependencies"
:
{
"dependencies"
:
{
"@types/tape"
:
"^4.2.33"
,
"@types/tape"
:
"^4.2.33"
,
"nyc"
:
"^13.3.0"
,
"nyc"
:
"^13.3.0"
,
"remix-lib"
:
"0.4.
9
"
,
"remix-lib"
:
"0.4.
12
"
,
"tape"
:
"^4.10.1"
,
"tape"
:
"^4.10.1"
,
"ts-node"
:
"^8.0.3"
,
"ts-node"
:
"^8.0.3"
,
"typescript"
:
"^3.4.3"
"typescript"
:
"^3.4.3"
...
...
remix-debug/package.json
View file @
5783e74f
{
{
"name"
:
"remix-debug"
,
"name"
:
"remix-debug"
,
"version"
:
"0.3.1
1
"
,
"version"
:
"0.3.1
4
"
,
"description"
:
"Ethereum IDE and tools for the web"
,
"description"
:
"Ethereum IDE and tools for the web"
,
"contributors"
:
[
"contributors"
:
[
{
{
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
"ethereumjs-util"
:
"^4.5.0"
,
"ethereumjs-util"
:
"^4.5.0"
,
"ethereumjs-vm"
:
"3.0.0"
,
"ethereumjs-vm"
:
"3.0.0"
,
"fast-async"
:
"^6.1.2"
,
"fast-async"
:
"^6.1.2"
,
"remix-lib"
:
"0.4.
9
"
,
"remix-lib"
:
"0.4.
12
"
,
"web3"
:
"0.20.6"
"web3"
:
"0.20.6"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
...
...
remix-lib/package.json
View file @
5783e74f
{
{
"name"
:
"remix-lib"
,
"name"
:
"remix-lib"
,
"version"
:
"0.4.
9
"
,
"version"
:
"0.4.
12
"
,
"description"
:
"Ethereum IDE and tools for the web"
,
"description"
:
"Ethereum IDE and tools for the web"
,
"contributors"
:
[
"contributors"
:
[
{
{
...
...
remix-lib/src/execution/execution-context.js
View file @
5783e74f
...
@@ -56,6 +56,24 @@ class StateManagerCommonStorageDump extends StateManager {
...
@@ -56,6 +56,24 @@ class StateManagerCommonStorageDump extends StateManager {
})
})
})
})
}
}
getStateRoot
(
cb
)
{
let
checkpoint
=
this
.
_checkpointCount
this
.
_checkpointCount
=
0
super
.
getStateRoot
((
err
,
stateRoot
)
=>
{
this
.
_checkpointCount
=
checkpoint
cb
(
err
,
stateRoot
)
})
}
setStateRoot
(
stateRoot
,
cb
)
{
let
checkpoint
=
this
.
_checkpointCount
this
.
_checkpointCount
=
0
super
.
setStateRoot
(
stateRoot
,
(
err
)
=>
{
this
.
_checkpointCount
=
checkpoint
cb
(
err
)
})
}
}
}
function
createVm
(
hardfork
)
{
function
createVm
(
hardfork
)
{
...
@@ -220,20 +238,6 @@ function ExecutionContext () {
...
@@ -220,20 +238,6 @@ function ExecutionContext () {
}
}
}
}
this
.
checkpointAndCommit
=
function
(
cb
,
checkpointCount
)
{
// due to issue https://github.com/ethereumjs/ethereumjs-vm/issues/567
if
(
this
.
vm
().
stateManager
.
_checkpointCount
>
(
checkpointCount
||
0
))
{
return
this
.
vm
().
stateManager
.
commit
(()
=>
{
cb
()
})
}
this
.
vm
().
stateManager
.
checkpoint
(()
=>
{
this
.
vm
().
stateManager
.
commit
(()
=>
{
cb
()
})
})
}
this
.
currentblockGasLimit
=
function
()
{
this
.
currentblockGasLimit
=
function
()
{
return
this
.
blockGasLimit
return
this
.
blockGasLimit
}
}
...
...
remix-lib/src/execution/txRunner.js
View file @
5783e74f
...
@@ -101,59 +101,70 @@ class TxRunner {
...
@@ -101,59 +101,70 @@ class TxRunner {
return
callback
(
'Invalid account selected'
)
return
callback
(
'Invalid account selected'
)
}
}
var
tx
=
new
EthJSTX
({
executionContext
.
vm
().
stateManager
.
getAccount
(
Buffer
.
from
(
from
.
replace
(
'0x'
,
''
),
'hex'
),
(
err
,
res
)
=>
{
timestamp
:
timestamp
,
if
(
err
)
{
nonce
:
new
BN
(
account
.
nonce
++
),
callback
(
'Account not found'
)
gasPrice
:
new
BN
(
1
),
}
else
{
gasLimit
:
gasLimit
,
var
tx
=
new
EthJSTX
({
to
:
to
,
timestamp
:
timestamp
,
value
:
new
BN
(
value
,
10
),
nonce
:
new
BN
(
res
.
nonce
),
data
:
Buffer
.
from
(
data
.
slice
(
2
),
'hex'
)
gasPrice
:
new
BN
(
1
),
})
gasLimit
:
gasLimit
,
tx
.
sign
(
account
.
privateKey
)
to
:
to
,
value
:
new
BN
(
value
,
10
),
data
:
Buffer
.
from
(
data
.
slice
(
2
),
'hex'
)
})
tx
.
sign
(
account
.
privateKey
)
const
coinbases
=
[
'0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a'
,
'0x8945a1288dc78a6d8952a92c77aee6730b414778'
,
'0x94d76e24f818426ae84aa404140e8d5f60e10e7e'
]
const
coinbases
=
[
'0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a'
,
'0x8945a1288dc78a6d8952a92c77aee6730b414778'
,
'0x94d76e24f818426ae84aa404140e8d5f60e10e7e'
]
const
difficulties
=
[
new
BN
(
'69762765929000'
,
10
),
new
BN
(
'70762765929000'
,
10
),
new
BN
(
'71762765929000'
,
10
)]
const
difficulties
=
[
new
BN
(
'69762765929000'
,
10
),
new
BN
(
'70762765929000'
,
10
),
new
BN
(
'71762765929000'
,
10
)]
var
block
=
new
EthJSBlock
({
var
block
=
new
EthJSBlock
({
header
:
{
header
:
{
timestamp
:
timestamp
||
(
new
Date
().
getTime
()
/
1000
|
0
),
timestamp
:
timestamp
||
(
new
Date
().
getTime
()
/
1000
|
0
),
number
:
self
.
blockNumber
,
number
:
self
.
blockNumber
,
coinbase
:
coinbases
[
self
.
blockNumber
%
coinbases
.
length
],
coinbase
:
coinbases
[
self
.
blockNumber
%
coinbases
.
length
],
difficulty
:
difficulties
[
self
.
blockNumber
%
difficulties
.
length
],
difficulty
:
difficulties
[
self
.
blockNumber
%
difficulties
.
length
],
gasLimit
:
new
BN
(
gasLimit
,
10
).
imuln
(
2
)
gasLimit
:
new
BN
(
gasLimit
,
10
).
imuln
(
2
)
},
},
transactions
:
[
tx
],
transactions
:
[
tx
],
uncleHeaders
:
[]
uncleHeaders
:
[]
})
if
(
!
useCall
)
{
++
self
.
blockNumber
this
.
runBlockInVm
(
tx
,
block
,
callback
)
}
else
{
executionContext
.
vm
().
stateManager
.
checkpoint
(()
=>
{
this
.
runBlockInVm
(
tx
,
block
,
(
err
,
result
)
=>
{
executionContext
.
vm
().
stateManager
.
revert
(()
=>
{
callback
(
err
,
result
)
})
})
})
}
}
})
})
if
(
!
useCall
)
{
}
++
self
.
blockNumber
}
else
{
executionContext
.
vm
().
stateManager
.
checkpoint
(()
=>
{
})
}
executionContext
.
checkpointAndCommit
(()
=>
{
runBlockInVm
(
tx
,
block
,
callback
)
{
executionContext
.
vm
().
runBlock
({
block
:
block
,
generate
:
true
,
skipBlockValidation
:
true
,
skipBalance
:
false
},
function
(
err
,
results
)
{
executionContext
.
vm
().
runBlock
({
block
:
block
,
generate
:
true
,
skipBlockValidation
:
true
,
skipBalance
:
false
},
function
(
err
,
results
)
{
err
=
err
?
err
.
message
:
err
err
=
err
?
err
.
message
:
err
if
(
err
)
{
if
(
err
)
{
return
callback
(
err
)
return
callback
(
err
)
}
}
let
result
=
results
.
results
[
0
]
let
result
=
results
.
results
[
0
]
if
(
useCall
)
{
executionContext
.
vm
().
stateManager
.
revert
(
function
()
{
})
}
if
(
result
)
{
result
.
status
=
'0x'
+
result
.
vm
.
exception
.
toString
(
16
)
}
executionContext
.
addBlock
(
block
)
if
(
result
)
{
executionContext
.
trackTx
(
'0x'
+
tx
.
hash
().
toString
(
'hex'
),
block
)
result
.
status
=
'0x'
+
result
.
vm
.
exception
.
toString
(
16
)
}
callback
(
err
,
{
executionContext
.
addBlock
(
block
)
result
:
result
,
executionContext
.
trackTx
(
'0x'
+
tx
.
hash
().
toString
(
'hex'
),
block
)
transactionHash
:
ethJSUtil
.
bufferToHex
(
Buffer
.
from
(
tx
.
hash
()))
})
callback
(
err
,
{
result
:
result
,
transactionHash
:
ethJSUtil
.
bufferToHex
(
Buffer
.
from
(
tx
.
hash
()))
})
})
}
,
1
)
})
}
}
runInNode
(
from
,
to
,
data
,
value
,
gasLimit
,
useCall
,
confirmCb
,
gasEstimationForceSend
,
promptCb
,
callback
)
{
runInNode
(
from
,
to
,
data
,
value
,
gasLimit
,
useCall
,
confirmCb
,
gasEstimationForceSend
,
promptCb
,
callback
)
{
...
...
remix-lib/src/universalDapp.js
View file @
5783e74f
const
async
=
require
(
'async'
)
const
async
=
require
(
'async'
)
const
{
BN
,
privateToAddress
,
isValidPrivate
,
stripHexPrefix
}
=
require
(
'ethereumjs-util'
)
const
{
BN
,
privateToAddress
,
isValidPrivate
,
stripHexPrefix
,
toChecksumAddress
}
=
require
(
'ethereumjs-util'
)
const
crypto
=
require
(
'crypto'
)
const
crypto
=
require
(
'crypto'
)
const
{
EventEmitter
}
=
require
(
'events'
)
const
{
EventEmitter
}
=
require
(
'events'
)
...
@@ -121,7 +121,7 @@ module.exports = class UniversalDApp {
...
@@ -121,7 +121,7 @@ module.exports = class UniversalDApp {
})
})
})
})
this
.
accounts
[
'0x'
+
address
.
toString
(
'hex'
)]
=
{
privateKey
,
nonce
:
0
}
this
.
accounts
[
toChecksumAddress
(
'0x'
+
address
.
toString
(
'hex'
)
)]
=
{
privateKey
,
nonce
:
0
}
}
}
}
}
...
...
remix-lib/src/util.js
View file @
5783e74f
...
@@ -180,13 +180,23 @@ module.exports = {
...
@@ -180,13 +180,23 @@ module.exports = {
*
*
* @return {RegEx}
* @return {RegEx}
*/
*/
swarmHashExtractionPOC3
:
function
()
{
swarmHashExtractionPOC3
1
:
function
()
{
return
/a265627a7a72315820
([
0-9a-f
]{64})
64736f6c6343
([
0-9a-f
]{6})
0032$/
return
/a265627a7a72315820
([
0-9a-f
]{64})
64736f6c6343
([
0-9a-f
]{6})
0032$/
},
},
/**
* return a regex which extract the swarmhash from the bytecode, from POC 0.3
*
* @return {RegEx}
*/
swarmHashExtractionPOC32
:
function
()
{
return
/a265627a7a72305820
([
0-9a-f
]{64})
64736f6c6343
([
0-9a-f
]{6})
0032$/
},
extractSwarmHash
:
function
(
value
)
{
extractSwarmHash
:
function
(
value
)
{
value
=
value
.
replace
(
this
.
swarmHashExtraction
(),
''
)
value
=
value
.
replace
(
this
.
swarmHashExtraction
(),
''
)
value
=
value
.
replace
(
this
.
swarmHashExtractionPOC3
(),
''
)
value
=
value
.
replace
(
this
.
swarmHashExtractionPOC31
(),
''
)
value
=
value
.
replace
(
this
.
swarmHashExtractionPOC32
(),
''
)
return
value
return
value
},
},
...
...
remix-simulator/package.json
View file @
5783e74f
{
{
"name"
:
"remix-simulator"
,
"name"
:
"remix-simulator"
,
"version"
:
"0.1.9-alpha.
2
"
,
"version"
:
"0.1.9-alpha.
5
"
,
"description"
:
"Ethereum IDE and tools for the web"
,
"description"
:
"Ethereum IDE and tools for the web"
,
"contributors"
:
[
"contributors"
:
[
{
{
...
@@ -18,13 +18,14 @@
...
@@ -18,13 +18,14 @@
"body-parser"
:
"^1.18.2"
,
"body-parser"
:
"^1.18.2"
,
"color-support"
:
"^1.1.3"
,
"color-support"
:
"^1.1.3"
,
"commander"
:
"^2.19.0"
,
"commander"
:
"^2.19.0"
,
"cors"
:
"^2.8.5"
,
"ethereumjs-util"
:
"^5.1.2"
,
"ethereumjs-util"
:
"^5.1.2"
,
"ethereumjs-vm"
:
"3.0.0"
,
"ethereumjs-vm"
:
"3.0.0"
,
"express"
:
"^4.16.3"
,
"express"
:
"^4.16.3"
,
"express-ws"
:
"^4.0.0"
,
"express-ws"
:
"^4.0.0"
,
"fast-async"
:
"^6.3.7"
,
"fast-async"
:
"^6.3.7"
,
"merge"
:
"^1.2.0"
,
"merge"
:
"^1.2.0"
,
"remix-lib"
:
"0.4.
9
"
,
"remix-lib"
:
"0.4.
12
"
,
"standard"
:
"^10.0.3"
,
"standard"
:
"^10.0.3"
,
"time-stamp"
:
"^2.0.0"
,
"time-stamp"
:
"^2.0.0"
,
"web3"
:
"1.0.0-beta.27"
"web3"
:
"1.0.0-beta.27"
...
...
remix-simulator/src/genesis.js
View file @
5783e74f
...
@@ -17,10 +17,8 @@ function generateBlock () {
...
@@ -17,10 +17,8 @@ function generateBlock () {
uncleHeaders
:
[]
uncleHeaders
:
[]
})
})
executionContext
.
checkpointAndCommit
(()
=>
{
executionContext
.
vm
().
runBlock
({
block
:
block
,
generate
:
true
,
skipBlockValidation
:
true
,
skipBalance
:
false
},
function
()
{
executionContext
.
vm
().
runBlock
({
block
:
block
,
generate
:
true
,
skipBlockValidation
:
true
,
skipBalance
:
false
},
function
()
{
executionContext
.
addBlock
(
block
)
executionContext
.
addBlock
(
block
)
})
})
})
}
}
...
...
remix-simulator/src/methods/accounts.js
View file @
5783e74f
...
@@ -12,19 +12,28 @@ var Accounts = function () {
...
@@ -12,19 +12,28 @@ var Accounts = function () {
this
.
accountsKeys
=
{}
this
.
accountsKeys
=
{}
executionContext
.
init
({
get
:
()
=>
{
return
true
}})
executionContext
.
init
({
get
:
()
=>
{
return
true
}})
}
for
(
let
_account
of
this
.
accountsList
)
{
Accounts
.
prototype
.
init
=
async
function
()
{
this
.
accountsKeys
[
_account
.
address
.
toLowerCase
()]
=
_account
.
privateKey
let
setBalance
=
(
account
)
=>
{
this
.
accounts
[
_account
.
address
.
toLowerCase
()]
=
{
privateKey
:
Buffer
.
from
(
_account
.
privateKey
.
replace
(
'0x'
,
''
),
'hex'
),
nonce
:
0
}
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
accountsKeys
[
ethJSUtil
.
toChecksumAddress
(
account
.
address
)]
=
account
.
privateKey
this
.
accounts
[
ethJSUtil
.
toChecksumAddress
(
account
.
address
)]
=
{
privateKey
:
Buffer
.
from
(
account
.
privateKey
.
replace
(
'0x'
,
''
),
'hex'
),
nonce
:
0
}
executionContext
.
vm
().
stateManager
.
getAccount
(
Buffer
.
from
(
_account
.
address
.
toLowerCase
().
replace
(
'0x'
,
''
),
'hex'
),
(
err
,
account
)
=>
{
executionContext
.
vm
().
stateManager
.
getAccount
(
Buffer
.
from
(
account
.
address
.
toLowerCase
().
replace
(
'0x'
,
''
),
'hex'
),
(
err
,
account
)
=>
{
if
(
err
)
{
if
(
err
)
{
throw
new
Error
(
err
)
throw
new
Error
(
err
)
}
}
var
balance
=
'0x56BC75E2D63100000'
var
balance
=
'0x56BC75E2D63100000'
account
.
balance
=
balance
||
'0xf00000000000000001'
account
.
balance
=
balance
||
'0xf00000000000000001'
resolve
()
})
})
})
}
}
for
(
let
_account
of
this
.
accountsList
)
{
await
setBalance
(
_account
)
}
}
}
Accounts
.
prototype
.
methods
=
function
()
{
Accounts
.
prototype
.
methods
=
function
()
{
...
@@ -36,7 +45,7 @@ Accounts.prototype.methods = function () {
...
@@ -36,7 +45,7 @@ Accounts.prototype.methods = function () {
}
}
Accounts
.
prototype
.
eth_accounts
=
function
(
payload
,
cb
)
{
Accounts
.
prototype
.
eth_accounts
=
function
(
payload
,
cb
)
{
return
cb
(
null
,
this
.
accountsList
.
map
((
x
)
=>
x
.
address
))
return
cb
(
null
,
this
.
accountsList
.
map
((
x
)
=>
ethJSUtil
.
toChecksumAddress
(
x
.
address
)
))
}
}
Accounts
.
prototype
.
eth_getBalance
=
function
(
payload
,
cb
)
{
Accounts
.
prototype
.
eth_getBalance
=
function
(
payload
,
cb
)
{
...
...
remix-simulator/src/methods/transactions.js
View file @
5783e74f
...
@@ -5,7 +5,9 @@ var ethJSUtil = require('ethereumjs-util')
...
@@ -5,7 +5,9 @@ var ethJSUtil = require('ethereumjs-util')
var
processTx
=
require
(
'./txProcess.js'
)
var
processTx
=
require
(
'./txProcess.js'
)
var
BN
=
ethJSUtil
.
BN
var
BN
=
ethJSUtil
.
BN
var
Transactions
=
function
(
accounts
)
{
var
Transactions
=
function
()
{}
Transactions
.
prototype
.
init
=
function
(
accounts
)
{
this
.
accounts
=
accounts
this
.
accounts
=
accounts
}
}
...
@@ -24,6 +26,10 @@ Transactions.prototype.methods = function () {
...
@@ -24,6 +26,10 @@ Transactions.prototype.methods = function () {
}
}
Transactions
.
prototype
.
eth_sendTransaction
=
function
(
payload
,
cb
)
{
Transactions
.
prototype
.
eth_sendTransaction
=
function
(
payload
,
cb
)
{
// from might be lowercased address (web3)
if
(
payload
.
params
&&
payload
.
params
.
length
>
0
&&
payload
.
params
[
0
].
from
)
{
payload
.
params
[
0
].
from
=
ethJSUtil
.
toChecksumAddress
(
payload
.
params
[
0
].
from
)
}
processTx
(
this
.
accounts
,
payload
,
false
,
cb
)
processTx
(
this
.
accounts
,
payload
,
false
,
cb
)
}
}
...
@@ -68,6 +74,10 @@ Transactions.prototype.eth_getCode = function (payload, cb) {
...
@@ -68,6 +74,10 @@ Transactions.prototype.eth_getCode = function (payload, cb) {
}
}
Transactions
.
prototype
.
eth_call
=
function
(
payload
,
cb
)
{
Transactions
.
prototype
.
eth_call
=
function
(
payload
,
cb
)
{
// from might be lowercased address (web3)
if
(
payload
.
params
&&
payload
.
params
.
length
>
0
&&
payload
.
params
[
0
].
from
)
{
payload
.
params
[
0
].
from
=
ethJSUtil
.
toChecksumAddress
(
payload
.
params
[
0
].
from
)
}
processTx
(
this
.
accounts
,
payload
,
true
,
cb
)
processTx
(
this
.
accounts
,
payload
,
true
,
cb
)
}
}
...
...
remix-simulator/src/provider.js
View file @
5783e74f
...
@@ -12,18 +12,24 @@ const generateBlock = require('./genesis.js')
...
@@ -12,18 +12,24 @@ const generateBlock = require('./genesis.js')
var
Provider
=
function
(
options
)
{
var
Provider
=
function
(
options
)
{
this
.
Accounts
=
new
Accounts
()
this
.
Accounts
=
new
Accounts
()
this
.
Transactions
=
new
Transactions
()
this
.
methods
=
{}
this
.
methods
=
{}
this
.
methods
=
merge
(
this
.
methods
,
this
.
Accounts
.
methods
())
this
.
methods
=
merge
(
this
.
methods
,
this
.
Accounts
.
methods
())
this
.
methods
=
merge
(
this
.
methods
,
(
new
Blocks
(
options
)).
methods
())
this
.
methods
=
merge
(
this
.
methods
,
(
new
Blocks
(
options
)).
methods
())
this
.
methods
=
merge
(
this
.
methods
,
(
new
Misc
()).
methods
())
this
.
methods
=
merge
(
this
.
methods
,
(
new
Misc
()).
methods
())
this
.
methods
=
merge
(
this
.
methods
,
(
new
Net
()).
methods
())
this
.
methods
=
merge
(
this
.
methods
,
(
new
Net
()).
methods
())
this
.
methods
=
merge
(
this
.
methods
,
(
new
Transactions
(
this
.
Accounts
.
accounts
)).
methods
(
))
this
.
methods
=
merge
(
this
.
methods
,
(
this
.
Transactions
.
methods
()
))
this
.
methods
=
merge
(
this
.
methods
,
(
new
Whisper
()).
methods
())
this
.
methods
=
merge
(
this
.
methods
,
(
new
Whisper
()).
methods
())
generateBlock
()
generateBlock
()
}
}
Provider
.
prototype
.
init
=
async
function
()
{
await
this
.
Accounts
.
init
()
this
.
Transactions
.
init
(
this
.
Accounts
.
accounts
)
}
Provider
.
prototype
.
sendAsync
=
function
(
payload
,
callback
)
{
Provider
.
prototype
.
sendAsync
=
function
(
payload
,
callback
)
{
log
.
info
(
'payload method is '
,
payload
.
method
)
log
.
info
(
'payload method is '
,
payload
.
method
)
...
...
remix-simulator/src/server.js
View file @
5783e74f
const
express
=
require
(
'express'
)
const
express
=
require
(
'express'
)
const
cors
=
require
(
'cors'
)
const
bodyParser
=
require
(
'body-parser'
)
const
bodyParser
=
require
(
'body-parser'
)
const
app
=
express
()
const
app
=
express
()
const
expressWs
=
require
(
'express-ws'
)
const
expressWs
=
require
(
'express-ws'
)
...
@@ -8,11 +9,17 @@ const log = require('./utils/logs.js')
...
@@ -8,11 +9,17 @@ const log = require('./utils/logs.js')
class
Server
{
class
Server
{
constructor
(
options
)
{
constructor
(
options
)
{
this
.
provider
=
new
Provider
(
options
)
this
.
provider
=
new
Provider
(
options
)
this
.
provider
.
init
().
then
(()
=>
{
log
(
'Provider initiated'
)
}).
catch
((
error
)
=>
{
log
(
error
)
})
}
}
start
(
host
,
port
)
{
start
(
host
,
port
)
{
expressWs
(
app
)
expressWs
(
app
)
app
.
use
(
cors
())
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}))
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}))
app
.
use
(
bodyParser
.
json
())
app
.
use
(
bodyParser
.
json
())
...
...
remix-solidity/package.json
View file @
5783e74f
{
{
"name"
:
"remix-solidity"
,
"name"
:
"remix-solidity"
,
"version"
:
"0.3.1
2
"
,
"version"
:
"0.3.1
5
"
,
"description"
:
"Ethereum IDE and tools for the web"
,
"description"
:
"Ethereum IDE and tools for the web"
,
"contributors"
:
[
"contributors"
:
[
{
{
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
"ethereumjs-util"
:
"^4.5.0"
,
"ethereumjs-util"
:
"^4.5.0"
,
"ethereumjs-vm"
:
"3.0.0"
,
"ethereumjs-vm"
:
"3.0.0"
,
"fast-async"
:
"^6.1.2"
,
"fast-async"
:
"^6.1.2"
,
"remix-lib"
:
"0.4.
9
"
,
"remix-lib"
:
"0.4.
12
"
,
"solc"
:
"^0.5.0"
,
"solc"
:
"^0.5.0"
,
"webworkify"
:
"^1.2.1"
"webworkify"
:
"^1.2.1"
},
},
...
...
remix-tests/package.json
View file @
5783e74f
{
{
"name"
:
"remix-tests"
,
"name"
:
"remix-tests"
,
"version"
:
"0.1.1
5
"
,
"version"
:
"0.1.1
8
"
,
"description"
:
"Tests for the Ethereum tool suite Remix"
,
"description"
:
"Tests for the Ethereum tool suite Remix"
,
"main"
:
"./dist/index.js"
,
"main"
:
"./dist/index.js"
,
"types"
:
"./dist/index.d.ts"
,
"types"
:
"./dist/index.d.ts"
,
...
@@ -42,9 +42,9 @@
...
@@ -42,9 +42,9 @@
"change-case"
:
"^3.0.1"
,
"change-case"
:
"^3.0.1"
,
"colors"
:
"^1.1.2"
,
"colors"
:
"^1.1.2"
,
"commander"
:
"^2.13.0"
,
"commander"
:
"^2.13.0"
,
"remix-lib"
:
"0.4.
9
"
,
"remix-lib"
:
"0.4.
12
"
,
"remix-simulator"
:
"0.1.9-alpha.
2
"
,
"remix-simulator"
:
"0.1.9-alpha.
5
"
,
"remix-solidity"
:
"0.3.1
2
"
,
"remix-solidity"
:
"0.3.1
5
"
,
"web3"
:
"1.0.0-beta.36"
,
"web3"
:
"1.0.0-beta.36"
,
"winston"
:
"^3.0.0"
"winston"
:
"^3.0.0"
},
},
...
...
remix-tests/src/runTestSources.ts
View file @
5783e74f
...
@@ -10,15 +10,17 @@ import Web3 = require('web3')
...
@@ -10,15 +10,17 @@ import Web3 = require('web3')
import
{
Provider
}
from
'remix-simulator'
import
{
Provider
}
from
'remix-simulator'
import
{
FinalResult
}
from
'./types'
import
{
FinalResult
}
from
'./types'
const
createWeb3Provider
=
function
()
{
const
createWeb3Provider
=
async
function
()
{
let
web3
=
new
Web3
()
let
web3
=
new
Web3
()
web3
.
setProvider
(
new
Provider
())
let
provider
=
new
Provider
()
await
provider
.
init
()
web3
.
setProvider
(
provider
)
return
web3
return
web3
}
}
export
function
runTestSources
(
contractSources
,
testCallback
,
resultCallback
,
finalCallback
,
importFileCb
,
opts
)
{
export
async
function
runTestSources
(
contractSources
,
testCallback
,
resultCallback
,
finalCallback
,
importFileCb
,
opts
)
{
opts
=
opts
||
{}
opts
=
opts
||
{}
let
web3
=
opts
.
web3
||
createWeb3Provider
()
let
web3
=
opts
.
web3
||
await
createWeb3Provider
()
let
accounts
=
opts
.
accounts
||
null
let
accounts
=
opts
.
accounts
||
null
async
.
waterfall
([
async
.
waterfall
([
function
getAccountList
(
next
)
{
function
getAccountList
(
next
)
{
...
...
remix-tests/tests/testRunner.ts
View file @
5783e74f
...
@@ -44,8 +44,9 @@ function deepEqualExcluding(a: any, b: any, excludedKeys: string[]) {
...
@@ -44,8 +44,9 @@ function deepEqualExcluding(a: any, b: any, excludedKeys: string[]) {
let
accounts
:
string
[]
let
accounts
:
string
[]
let
provider
=
new
Provider
()
let
provider
=
new
Provider
()
function
compileAndDeploy
(
filename
:
string
,
callback
:
Function
)
{
async
function
compileAndDeploy
(
filename
:
string
,
callback
:
Function
)
{
let
web3
:
Web3
=
new
Web3
()
let
web3
:
Web3
=
new
Web3
()
await
provider
.
init
()
web3
.
setProvider
(
provider
)
web3
.
setProvider
(
provider
)
let
compilationData
:
object
let
compilationData
:
object
async
.
waterfall
([
async
.
waterfall
([
...
...
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