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
adaac38a
Commit
adaac38a
authored
Apr 21, 2021
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using fromBlockData
parent
1558c89b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
32 deletions
+34
-32
vmCall.ts
libs/remix-debug/test/decoder/vmCall.ts
+7
-7
vmCall.ts
libs/remix-debug/test/vmCall.ts
+7
-7
txRunner.ts
libs/remix-lib/src/execution/txRunner.ts
+10
-9
genesis.ts
libs/remix-simulator/src/genesis.ts
+10
-9
No files found.
libs/remix-debug/test/decoder/vmCall.ts
View file @
adaac38a
'use strict'
var
utileth
=
require
(
'ethereumjs-util'
)
var
Tx
=
require
(
'@ethereumjs/tx'
).
Transaction
import
{
Block
,
BlockHeader
}
from
'@ethereumjs/block'
import
{
Block
}
from
'@ethereumjs/block'
var
BN
=
require
(
'ethereumjs-util'
).
BN
var
remixLib
=
require
(
'@remix-project/remix-lib'
)
import
VM
from
'@ethereumjs/vm'
...
...
@@ -18,12 +18,12 @@ export function sendTx (vm, from, to, value, data, cb) {
})
tx
.
sign
(
from
.
privateKey
)
var
header
=
BlockHeader
.
fromHeader
Data
({
timestamp
:
new
Date
().
getTime
()
/
1000
|
0
,
number
:
0
})
var
block
=
new
Block
(
header
,
[],
[])
var
block
=
Block
.
fromBlock
Data
({
header
:
{
timestamp
:
new
Date
().
getTime
()
/
1000
|
0
,
number
:
0
}
})
// still using default common
try
{
vm
.
runTx
({
block
:
block
,
tx
:
tx
,
skipBalance
:
true
,
skipNonce
:
true
}).
then
(
function
(
result
)
{
...
...
libs/remix-debug/test/vmCall.ts
View file @
adaac38a
'use strict'
import
{
Block
,
BlockHeader
}
from
'@ethereumjs/block'
import
{
Block
}
from
'@ethereumjs/block'
import
VM
from
'@ethereumjs/vm'
var
utileth
=
require
(
'ethereumjs-util'
)
var
Tx
=
require
(
'@ethereumjs/tx'
).
Transaction
...
...
@@ -17,12 +17,12 @@ function sendTx (vm, from, to, value, data, cb) {
})
tx
.
sign
(
from
.
privateKey
)
var
header
=
BlockHeader
.
fromHeader
Data
({
timestamp
:
new
Date
().
getTime
()
/
1000
|
0
,
number
:
0
})
var
block
=
new
Block
(
header
,
[],
[])
var
block
=
Block
.
fromBlock
Data
({
header
:
{
timestamp
:
new
Date
().
getTime
()
/
1000
|
0
,
number
:
0
}
})
// still using default common
vm
.
runTx
({
block
:
block
,
tx
:
tx
,
skipBalance
:
true
,
skipNonce
:
true
}).
then
(
function
(
result
)
{
setTimeout
(()
=>
{
cb
(
null
,
utileth
.
bufferToHex
(
tx
.
hash
()))
...
...
libs/remix-lib/src/execution/txRunner.ts
View file @
adaac38a
'use strict'
import
{
Transaction
}
from
'@ethereumjs/tx'
import
{
Block
,
BlockHeader
}
from
'@ethereumjs/block'
import
{
Block
}
from
'@ethereumjs/block'
import
{
BN
,
bufferToHex
,
Address
}
from
'ethereumjs-util'
import
{
ExecutionContext
}
from
'./execution-context'
import
{
EventManager
}
from
'../eventManager'
...
...
@@ -127,15 +127,16 @@ export class TxRunner {
const
coinbases
=
[
'0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a'
,
'0x8945a1288dc78a6d8952a92c77aee6730b414778'
,
'0x94d76e24f818426ae84aa404140e8d5f60e10e7e'
]
const
difficulties
=
[
new
BN
(
'69762765929000'
,
10
),
new
BN
(
'70762765929000'
,
10
),
new
BN
(
'71762765929000'
,
10
)]
const
header
:
BlockHeader
=
BlockHeader
.
fromHeaderData
({
timestamp
:
timestamp
||
(
new
Date
().
getTime
()
/
1000
|
0
),
number
:
self
.
blockNumber
,
coinbase
:
coinbases
[
self
.
blockNumber
%
coinbases
.
length
],
difficulty
:
difficulties
[
self
.
blockNumber
%
difficulties
.
length
],
gasLimit
:
new
BN
(
gasLimit
.
replace
(
'0x'
,
''
),
16
).
imuln
(
2
)
var
block
=
Block
.
fromBlockData
({
header
:
{
timestamp
:
timestamp
||
(
new
Date
().
getTime
()
/
1000
|
0
),
number
:
self
.
blockNumber
,
coinbase
:
coinbases
[
self
.
blockNumber
%
coinbases
.
length
],
difficulty
:
difficulties
[
self
.
blockNumber
%
difficulties
.
length
],
gasLimit
:
new
BN
(
gasLimit
.
replace
(
'0x'
,
''
),
16
).
imuln
(
2
)
}
},
{
common
:
this
.
commonContext
})
const
block
=
new
Block
(
header
,
[
tx
],
[])
if
(
!
useCall
)
{
++
self
.
blockNumber
this
.
runBlockInVm
(
tx
,
block
,
callback
)
...
...
libs/remix-simulator/src/genesis.ts
View file @
adaac38a
import
{
Block
,
BlockHeader
}
from
'@ethereumjs/block'
import
{
Block
}
from
'@ethereumjs/block'
import
{
BN
}
from
'ethereumjs-util'
export
function
generateBlock
(
executionContext
)
{
const
header
:
BlockHeader
=
BlockHeader
.
fromHeaderData
({
timestamp
:
(
new
Date
().
getTime
()
/
1000
|
0
),
number
:
0
,
coinbase
:
'0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a'
,
difficulty
:
new
BN
(
'69762765929000'
,
10
),
gasLimit
:
new
BN
(
'8000000'
).
imuln
(
1
)
})
const
block
:
Block
=
new
Block
(
header
,
[],
[])
const
block
:
Block
=
Block
.
fromBlockData
({
header
:
{
timestamp
:
(
new
Date
().
getTime
()
/
1000
|
0
),
number
:
0
,
coinbase
:
'0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a'
,
difficulty
:
new
BN
(
'69762765929000'
,
10
),
gasLimit
:
new
BN
(
'8000000'
).
imuln
(
1
)
}
},
{
common
:
executionContext
.
vmObject
().
common
})
executionContext
.
vm
().
runBlock
({
block
:
block
,
generate
:
true
,
skipBlockValidation
:
true
,
skipBalance
:
false
}).
then
(()
=>
{
executionContext
.
addBlock
(
block
)
...
...
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