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
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
114 additions
and
55 deletions
+114
-55
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
+18
-7
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
+0
-2
accounts.js
remix-simulator/src/methods/accounts.js
+14
-5
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"
:
{
"
gulp
"
:
"^3.9.1"
,
"
lerna
"
:
"^2.10.2"
...
...
remix-analyzer/package.json
View file @
5783e74f
{
"name"
:
"remix-analyzer"
,
"version"
:
"0.3.1
0
"
,
"version"
:
"0.3.1
3
"
,
"description"
:
"Remix Analyzer"
,
"main"
:
"./index.js"
,
"contributors"
:
[
...
...
@@ -18,7 +18,7 @@
}
],
"dependencies"
:
{
"remix-lib"
:
"0.4.
9
"
"remix-lib"
:
"0.4.
12
"
},
"scripts"
:
{
"lint"
:
"standard"
,
...
...
remix-astwalker/package.json
View file @
5783e74f
{
"name"
:
"remix-astwalker"
,
"version"
:
"0.0.
6
"
,
"version"
:
"0.0.
9
"
,
"description"
:
"Remix sub-module for walking through AST"
,
"main"
:
"dist/index.js"
,
"scripts"
:
{
...
...
@@ -34,7 +34,7 @@
"dependencies"
:
{
"@types/tape"
:
"^4.2.33"
,
"nyc"
:
"^13.3.0"
,
"remix-lib"
:
"0.4.
9
"
,
"remix-lib"
:
"0.4.
12
"
,
"tape"
:
"^4.10.1"
,
"ts-node"
:
"^8.0.3"
,
"typescript"
:
"^3.4.3"
...
...
remix-debug/package.json
View file @
5783e74f
{
"name"
:
"remix-debug"
,
"version"
:
"0.3.1
1
"
,
"version"
:
"0.3.1
4
"
,
"description"
:
"Ethereum IDE and tools for the web"
,
"contributors"
:
[
{
...
...
@@ -22,7 +22,7 @@
"ethereumjs-util"
:
"^4.5.0"
,
"ethereumjs-vm"
:
"3.0.0"
,
"fast-async"
:
"^6.1.2"
,
"remix-lib"
:
"0.4.
9
"
,
"remix-lib"
:
"0.4.
12
"
,
"web3"
:
"0.20.6"
},
"devDependencies"
:
{
...
...
remix-lib/package.json
View file @
5783e74f
{
"name"
:
"remix-lib"
,
"version"
:
"0.4.
9
"
,
"version"
:
"0.4.
12
"
,
"description"
:
"Ethereum IDE and tools for the web"
,
"contributors"
:
[
{
...
...
remix-lib/src/execution/execution-context.js
View file @
5783e74f
...
...
@@ -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
)
{
...
...
@@ -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
()
{
return
this
.
blockGasLimit
}
...
...
remix-lib/src/execution/txRunner.js
View file @
5783e74f
...
...
@@ -101,9 +101,13 @@ class TxRunner {
return
callback
(
'Invalid account selected'
)
}
executionContext
.
vm
().
stateManager
.
getAccount
(
Buffer
.
from
(
from
.
replace
(
'0x'
,
''
),
'hex'
),
(
err
,
res
)
=>
{
if
(
err
)
{
callback
(
'Account not found'
)
}
else
{
var
tx
=
new
EthJSTX
({
timestamp
:
timestamp
,
nonce
:
new
BN
(
account
.
nonce
++
),
nonce
:
new
BN
(
res
.
nonce
),
gasPrice
:
new
BN
(
1
),
gasLimit
:
gasLimit
,
to
:
to
,
...
...
@@ -127,20 +131,28 @@ class TxRunner {
})
if
(
!
useCall
)
{
++
self
.
blockNumber
this
.
runBlockInVm
(
tx
,
block
,
callback
)
}
else
{
executionContext
.
vm
().
stateManager
.
checkpoint
(()
=>
{
})
executionContext
.
vm
().
stateManager
.
checkpoint
(()
=>
{
this
.
runBlockInVm
(
tx
,
block
,
(
err
,
result
)
=>
{
executionContext
.
vm
().
stateManager
.
revert
(()
=>
{
callback
(
err
,
result
)
})
})
})
}
}
})
}
executionContext
.
checkpointAndCommit
(()
=>
{
runBlockInVm
(
tx
,
block
,
callback
)
{
executionContext
.
vm
().
runBlock
({
block
:
block
,
generate
:
true
,
skipBlockValidation
:
true
,
skipBalance
:
false
},
function
(
err
,
results
)
{
err
=
err
?
err
.
message
:
err
if
(
err
)
{
return
callback
(
err
)
}
let
result
=
results
.
results
[
0
]
if
(
useCall
)
{
executionContext
.
vm
().
stateManager
.
revert
(
function
()
{
})
}
if
(
result
)
{
result
.
status
=
'0x'
+
result
.
vm
.
exception
.
toString
(
16
)
}
...
...
@@ -153,7 +165,6 @@ class TxRunner {
transactionHash
:
ethJSUtil
.
bufferToHex
(
Buffer
.
from
(
tx
.
hash
()))
})
})
},
1
)
}
runInNode
(
from
,
to
,
data
,
value
,
gasLimit
,
useCall
,
confirmCb
,
gasEstimationForceSend
,
promptCb
,
callback
)
{
...
...
remix-lib/src/universalDapp.js
View file @
5783e74f
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
{
EventEmitter
}
=
require
(
'events'
)
...
...
@@ -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 = {
*
* @return {RegEx}
*/
swarmHashExtractionPOC3
:
function
()
{
swarmHashExtractionPOC3
1
:
function
()
{
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
)
{
value
=
value
.
replace
(
this
.
swarmHashExtraction
(),
''
)
value
=
value
.
replace
(
this
.
swarmHashExtractionPOC3
(),
''
)
value
=
value
.
replace
(
this
.
swarmHashExtractionPOC31
(),
''
)
value
=
value
.
replace
(
this
.
swarmHashExtractionPOC32
(),
''
)
return
value
},
...
...
remix-simulator/package.json
View file @
5783e74f
{
"name"
:
"remix-simulator"
,
"version"
:
"0.1.9-alpha.
2
"
,
"version"
:
"0.1.9-alpha.
5
"
,
"description"
:
"Ethereum IDE and tools for the web"
,
"contributors"
:
[
{
...
...
@@ -18,13 +18,14 @@
"body-parser"
:
"^1.18.2"
,
"color-support"
:
"^1.1.3"
,
"commander"
:
"^2.19.0"
,
"cors"
:
"^2.8.5"
,
"ethereumjs-util"
:
"^5.1.2"
,
"ethereumjs-vm"
:
"3.0.0"
,
"express"
:
"^4.16.3"
,
"express-ws"
:
"^4.0.0"
,
"fast-async"
:
"^6.3.7"
,
"merge"
:
"^1.2.0"
,
"remix-lib"
:
"0.4.
9
"
,
"remix-lib"
:
"0.4.
12
"
,
"standard"
:
"^10.0.3"
,
"time-stamp"
:
"^2.0.0"
,
"web3"
:
"1.0.0-beta.27"
...
...
remix-simulator/src/genesis.js
View file @
5783e74f
...
...
@@ -17,11 +17,9 @@ function generateBlock () {
uncleHeaders
:
[]
})
executionContext
.
checkpointAndCommit
(()
=>
{
executionContext
.
vm
().
runBlock
({
block
:
block
,
generate
:
true
,
skipBlockValidation
:
true
,
skipBalance
:
false
},
function
()
{
executionContext
.
addBlock
(
block
)
})
})
}
module
.
exports
=
generateBlock
remix-simulator/src/methods/accounts.js
View file @
5783e74f
...
...
@@ -12,19 +12,28 @@ var Accounts = function () {
this
.
accountsKeys
=
{}
executionContext
.
init
({
get
:
()
=>
{
return
true
}})
}
for
(
let
_account
of
this
.
accountsList
)
{
this
.
accountsKeys
[
_account
.
address
.
toLowerCase
()]
=
_account
.
privateKey
this
.
accounts
[
_account
.
address
.
toLowerCase
()]
=
{
privateKey
:
Buffer
.
from
(
_account
.
privateKey
.
replace
(
'0x'
,
''
),
'hex'
),
nonce
:
0
}
Accounts
.
prototype
.
init
=
async
function
()
{
let
setBalance
=
(
account
)
=>
{
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
)
{
throw
new
Error
(
err
)
}
var
balance
=
'0x56BC75E2D63100000'
account
.
balance
=
balance
||
'0xf00000000000000001'
resolve
()
})
})
}
for
(
let
_account
of
this
.
accountsList
)
{
await
setBalance
(
_account
)
}
}
Accounts
.
prototype
.
methods
=
function
()
{
...
...
@@ -36,7 +45,7 @@ Accounts.prototype.methods = function () {
}
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
)
{
...
...
remix-simulator/src/methods/transactions.js
View file @
5783e74f
...
...
@@ -5,7 +5,9 @@ var ethJSUtil = require('ethereumjs-util')
var
processTx
=
require
(
'./txProcess.js'
)
var
BN
=
ethJSUtil
.
BN
var
Transactions
=
function
(
accounts
)
{
var
Transactions
=
function
()
{}
Transactions
.
prototype
.
init
=
function
(
accounts
)
{
this
.
accounts
=
accounts
}
...
...
@@ -24,6 +26,10 @@ Transactions.prototype.methods = function () {
}
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
)
}
...
...
@@ -68,6 +74,10 @@ Transactions.prototype.eth_getCode = 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
)
}
...
...
remix-simulator/src/provider.js
View file @
5783e74f
...
...
@@ -12,18 +12,24 @@ const generateBlock = require('./genesis.js')
var
Provider
=
function
(
options
)
{
this
.
Accounts
=
new
Accounts
()
this
.
Transactions
=
new
Transactions
()
this
.
methods
=
{}
this
.
methods
=
merge
(
this
.
methods
,
this
.
Accounts
.
methods
())
this
.
methods
=
merge
(
this
.
methods
,
(
new
Blocks
(
options
)).
methods
())
this
.
methods
=
merge
(
this
.
methods
,
(
new
Misc
()).
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
())
generateBlock
()
}
Provider
.
prototype
.
init
=
async
function
()
{
await
this
.
Accounts
.
init
()
this
.
Transactions
.
init
(
this
.
Accounts
.
accounts
)
}
Provider
.
prototype
.
sendAsync
=
function
(
payload
,
callback
)
{
log
.
info
(
'payload method is '
,
payload
.
method
)
...
...
remix-simulator/src/server.js
View file @
5783e74f
const
express
=
require
(
'express'
)
const
cors
=
require
(
'cors'
)
const
bodyParser
=
require
(
'body-parser'
)
const
app
=
express
()
const
expressWs
=
require
(
'express-ws'
)
...
...
@@ -8,11 +9,17 @@ const log = require('./utils/logs.js')
class
Server
{
constructor
(
options
)
{
this
.
provider
=
new
Provider
(
options
)
this
.
provider
.
init
().
then
(()
=>
{
log
(
'Provider initiated'
)
}).
catch
((
error
)
=>
{
log
(
error
)
})
}
start
(
host
,
port
)
{
expressWs
(
app
)
app
.
use
(
cors
())
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}))
app
.
use
(
bodyParser
.
json
())
...
...
remix-solidity/package.json
View file @
5783e74f
{
"name"
:
"remix-solidity"
,
"version"
:
"0.3.1
2
"
,
"version"
:
"0.3.1
5
"
,
"description"
:
"Ethereum IDE and tools for the web"
,
"contributors"
:
[
{
...
...
@@ -17,7 +17,7 @@
"ethereumjs-util"
:
"^4.5.0"
,
"ethereumjs-vm"
:
"3.0.0"
,
"fast-async"
:
"^6.1.2"
,
"remix-lib"
:
"0.4.
9
"
,
"remix-lib"
:
"0.4.
12
"
,
"solc"
:
"^0.5.0"
,
"webworkify"
:
"^1.2.1"
},
...
...
remix-tests/package.json
View file @
5783e74f
{
"name"
:
"remix-tests"
,
"version"
:
"0.1.1
5
"
,
"version"
:
"0.1.1
8
"
,
"description"
:
"Tests for the Ethereum tool suite Remix"
,
"main"
:
"./dist/index.js"
,
"types"
:
"./dist/index.d.ts"
,
...
...
@@ -42,9 +42,9 @@
"change-case"
:
"^3.0.1"
,
"colors"
:
"^1.1.2"
,
"commander"
:
"^2.13.0"
,
"remix-lib"
:
"0.4.
9
"
,
"remix-simulator"
:
"0.1.9-alpha.
2
"
,
"remix-solidity"
:
"0.3.1
2
"
,
"remix-lib"
:
"0.4.
12
"
,
"remix-simulator"
:
"0.1.9-alpha.
5
"
,
"remix-solidity"
:
"0.3.1
5
"
,
"web3"
:
"1.0.0-beta.36"
,
"winston"
:
"^3.0.0"
},
...
...
remix-tests/src/runTestSources.ts
View file @
5783e74f
...
...
@@ -10,15 +10,17 @@ import Web3 = require('web3')
import
{
Provider
}
from
'remix-simulator'
import
{
FinalResult
}
from
'./types'
const
createWeb3Provider
=
function
()
{
const
createWeb3Provider
=
async
function
()
{
let
web3
=
new
Web3
()
web3
.
setProvider
(
new
Provider
())
let
provider
=
new
Provider
()
await
provider
.
init
()
web3
.
setProvider
(
provider
)
return
web3
}
export
function
runTestSources
(
contractSources
,
testCallback
,
resultCallback
,
finalCallback
,
importFileCb
,
opts
)
{
export
async
function
runTestSources
(
contractSources
,
testCallback
,
resultCallback
,
finalCallback
,
importFileCb
,
opts
)
{
opts
=
opts
||
{}
let
web3
=
opts
.
web3
||
createWeb3Provider
()
let
web3
=
opts
.
web3
||
await
createWeb3Provider
()
let
accounts
=
opts
.
accounts
||
null
async
.
waterfall
([
function
getAccountList
(
next
)
{
...
...
remix-tests/tests/testRunner.ts
View file @
5783e74f
...
...
@@ -44,8 +44,9 @@ function deepEqualExcluding(a: any, b: any, excludedKeys: string[]) {
let
accounts
:
string
[]
let
provider
=
new
Provider
()
function
compileAndDeploy
(
filename
:
string
,
callback
:
Function
)
{
async
function
compileAndDeploy
(
filename
:
string
,
callback
:
Function
)
{
let
web3
:
Web3
=
new
Web3
()
await
provider
.
init
()
web3
.
setProvider
(
provider
)
let
compilationData
:
object
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