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
815f78cd
Commit
815f78cd
authored
Apr 22, 2021
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix remix simulator tests
parent
3c377a66
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
10 deletions
+21
-10
txRunner.ts
libs/remix-lib/src/execution/txRunner.ts
+6
-2
genesis.ts
libs/remix-simulator/src/genesis.ts
+3
-0
blocks.ts
libs/remix-simulator/src/methods/blocks.ts
+3
-1
provider.ts
libs/remix-simulator/src/provider.ts
+2
-3
accounts.ts
libs/remix-simulator/test/accounts.ts
+2
-1
blocks.ts
libs/remix-simulator/test/blocks.ts
+3
-2
misc.ts
libs/remix-simulator/test/misc.ts
+2
-1
No files found.
libs/remix-lib/src/execution/txRunner.ts
View file @
815f78cd
...
...
@@ -111,6 +111,10 @@ export class TxRunner {
return
callback
(
'Invalid account selected'
)
}
if
(
Number
.
isInteger
(
gasLimit
))
{
gasLimit
=
'0x'
+
gasLimit
.
toString
(
16
)
}
this
.
executionContext
.
vm
().
stateManager
.
getAccount
(
Address
.
fromString
(
from
)).
then
((
res
)
=>
{
// See https://github.com/ethereumjs/ethereumjs-tx/blob/master/docs/classes/transaction.md#constructor
// for initialization fields and their types
...
...
@@ -150,8 +154,8 @@ export class TxRunner {
})
})
}
}).
catch
(()
=>
{
callback
(
'Account not found'
)
}).
catch
((
e
)
=>
{
callback
(
e
)
})
}
...
...
libs/remix-simulator/src/genesis.ts
View file @
815f78cd
...
...
@@ -2,6 +2,7 @@ import { Block } from '@ethereumjs/block'
import
{
BN
}
from
'ethereumjs-util'
export
function
generateBlock
(
executionContext
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
block
:
Block
=
Block
.
fromBlockData
({
header
:
{
timestamp
:
(
new
Date
().
getTime
()
/
1000
|
0
),
...
...
@@ -14,5 +15,7 @@ export function generateBlock (executionContext) {
executionContext
.
vm
().
runBlock
({
block
:
block
,
generate
:
true
,
skipBlockValidation
:
true
,
skipBalance
:
false
}).
then
(()
=>
{
executionContext
.
addBlock
(
block
)
resolve
({})
}).
catch
((
e
)
=>
reject
(
e
))
})
}
libs/remix-simulator/src/methods/blocks.ts
View file @
815f78cd
...
...
@@ -31,6 +31,9 @@ export class Blocks {
blockIndex
=
this
.
executionContext
.
latestBlockNumber
}
if
(
Number
.
isInteger
(
blockIndex
))
{
blockIndex
=
'0x'
+
blockIndex
.
toString
(
16
)
}
const
block
=
this
.
executionContext
.
blocks
[
blockIndex
]
if
(
!
block
)
{
...
...
@@ -57,7 +60,6 @@ export class Blocks {
transactions
:
block
.
transactions
.
map
((
t
)
=>
'0x'
+
t
.
hash
().
toString
(
'hex'
)),
uncles
:
[]
}
cb
(
null
,
b
)
}
...
...
libs/remix-simulator/src/provider.ts
View file @
815f78cd
...
...
@@ -39,12 +39,11 @@ export class Provider {
this
.
methods
=
merge
(
this
.
methods
,
netMethods
())
this
.
methods
=
merge
(
this
.
methods
,
this
.
Transactions
.
methods
())
this
.
methods
=
merge
(
this
.
methods
,
(
new
Debug
(
this
.
executionContext
)).
methods
())
generateBlock
(
this
.
executionContext
)
this
.
init
()
// this.init()
}
async
init
()
{
await
generateBlock
(
this
.
executionContext
)
await
this
.
Accounts
.
resetAccounts
()
this
.
Transactions
.
init
(
this
.
Accounts
.
accounts
)
}
...
...
libs/remix-simulator/test/accounts.ts
View file @
815f78cd
...
...
@@ -5,8 +5,9 @@ const web3 = new Web3()
import
*
as
assert
from
'assert'
describe
(
'Accounts'
,
()
=>
{
before
(
function
()
{
before
(
async
function
()
{
const
provider
=
new
Provider
()
await
provider
.
init
()
web3
.
setProvider
(
provider
)
})
...
...
libs/remix-simulator/test/blocks.ts
View file @
815f78cd
...
...
@@ -5,10 +5,11 @@ const web3 = new Web3()
import
*
as
assert
from
'assert'
describe
(
'blocks'
,
()
=>
{
before
(()
=>
{
before
(
async
()
=>
{
const
provider
=
new
Provider
(
'vm'
,
{
coinbase
:
'0x0000000000000000000000000000000000000001'
})
await
provider
.
init
()
web3
.
setProvider
(
provider
)
})
...
...
@@ -29,7 +30,7 @@ describe('blocks', () => {
parentHash
:
'0x0000000000000000000000000000000000000000000000000000000000000000'
,
sha3Uncles
:
'0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347'
,
size
:
163591
,
stateRoot
:
'0x
63e1738ea12d4e7d12b71f0f4604706417921eb6a62c407ca5f1d66b9e67f579
'
,
stateRoot
:
'0x
0000000000000000000000000000000000000000000000000000000000000000
'
,
timestamp
:
block
.
timestamp
,
totalDifficulty
:
'0'
,
transactions
:
[],
...
...
libs/remix-simulator/test/misc.ts
View file @
815f78cd
...
...
@@ -5,8 +5,9 @@ const web3 = new Web3()
import
*
as
assert
from
'assert'
describe
(
'Misc'
,
()
=>
{
before
(()
=>
{
before
(
async
()
=>
{
const
provider
=
new
Provider
()
await
provider
.
init
()
web3
.
setProvider
(
provider
)
})
...
...
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