Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
aa48e6ae
Commit
aa48e6ae
authored
Sep 17, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
txs load, they don't work
parent
f245d631
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
8 deletions
+44
-8
tx_13247502
data/tx_13247502
+0
-0
get_block.ts
helpers/get_block.ts
+20
-3
main.go
minigeth/main.go
+20
-5
run.sh
run.sh
+4
-0
No files found.
data/tx_13247502
0 → 100644
View file @
aa48e6ae
File added
helpers/get_block.ts
View file @
aa48e6ae
...
...
@@ -15,6 +15,21 @@ type extblock struct {
Uncles []*Header
}
*/
function
getTransactionRlp
(
tx
:
any
)
{
let
dat
=
[
tx
.
nonce
,
tx
.
gasPrice
,
tx
.
gas
,
tx
.
to
,
tx
.
value
,
tx
.
input
,
tx
.
v
,
tx
.
r
,
tx
.
s
,
];
dat
=
dat
.
map
((
x
)
=>
(
x
==
"
0x0
"
)
?
"
0x
"
:
x
)
return
dat
}
function
getBlockRlp
(
block
:
any
)
{
let
dat
=
[
...
...
@@ -35,18 +50,20 @@ function getBlockRlp(block : any) {
block
[
'
nonce
'
],
block
[
'
baseFeePerGas
'
]
];
// special case for 0
dat
=
dat
.
map
((
x
)
=>
(
x
==
"
0x0
"
)
?
"
0x
"
:
x
)
return
rlp
.
encode
(
dat
);
return
dat
}
async
function
main
()
{
const
blockNumber
=
13247502
;
let
blockData
=
await
provider
.
send
(
"
eth_getBlockByNumber
"
,
[
"
0x
"
+
(
blockNumber
).
toString
(
16
),
true
])
const
blockHeaderRlp
=
getBlockRlp
(
blockData
)
const
blockHeaderRlp
=
rlp
.
encode
(
getBlockRlp
(
blockData
)
)
assert
(
keccak256
(
blockHeaderRlp
)
==
blockData
[
'
hash
'
])
//console.log(blockData)
const
txsRlp
=
rlp
.
encode
(
blockData
.
transactions
.
map
(
getTransactionRlp
))
fs
.
writeFileSync
(
`data/block_
${
blockNumber
}
`
,
blockHeaderRlp
)
fs
.
writeFileSync
(
`data/tx_
${
blockNumber
}
`
,
txsRlp
)
}
main
().
then
(()
=>
process
.
exit
(
0
))
minigeth/main.go
View file @
aa48e6ae
...
...
@@ -20,16 +20,31 @@ func main() {
processor
:=
core
.
NewStateProcessor
(
params
.
MainnetChainConfig
,
bc
,
bc
.
Engine
())
fmt
.
Println
(
"made state processor"
)
f
,
_
:=
os
.
Open
(
"../data/block_13247502"
)
defer
f
.
Close
()
// read header
var
header
types
.
Header
rlpheader
:=
rlp
.
NewStream
(
f
,
0
)
rlpheader
.
Decode
(
&
header
)
{
f
,
_
:=
os
.
Open
(
"data/block_13247502"
)
defer
f
.
Close
()
rlpheader
:=
rlp
.
NewStream
(
f
,
0
)
rlpheader
.
Decode
(
&
header
)
}
// read txs
var
txs
[]
*
types
.
Transaction
{
f
,
_
:=
os
.
Open
(
"data/tx_13247502"
)
defer
f
.
Close
()
rlpheader
:=
rlp
.
NewStream
(
f
,
0
)
rlpheader
.
Decode
(
&
txs
)
}
fmt
.
Println
(
"read"
,
len
(
txs
),
"transactions"
)
var
uncles
[]
*
types
.
Header
var
receipts
[]
*
types
.
Receipt
block
:=
types
.
NewBlock
(
&
header
,
txs
,
uncles
,
receipts
,
trie
.
NewStackTrie
(
nil
))
fmt
.
Println
(
"made block, parent:"
,
header
.
ParentHash
)
processor
.
Process
(
block
,
statedb
,
vmconfig
)
_
,
_
,
_
,
err
:=
processor
.
Process
(
block
,
statedb
,
vmconfig
)
fmt
.
Println
(
err
)
fmt
.
Println
(
"process done"
)
}
run.sh
0 → 100755
View file @
aa48e6ae
#!/bin/bash -e
(
cd
minigeth/
&&
go build
)
minigeth/go-ethereum
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