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
31037e64
Commit
31037e64
authored
Jan 24, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `geth dump` rather than `geth snapshot dump`
parent
82c004ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
15 deletions
+6
-15
README.md
op-chain-ops/eof-crawler/README.md
+1
-1
main.rs
op-chain-ops/eof-crawler/src/main.rs
+5
-14
No files found.
op-chain-ops/eof-crawler/README.md
View file @
31037e64
...
...
@@ -15,7 +15,7 @@ Options:
1.
To begin, create a geth snapshot:
```
sh
geth
snapshot dump
--nostorage
>>
snapshot.txt
geth
dump
--iterative
--nostorage
>>
snapshot.txt
```
1.
Once the snapshot has been generated, feed it into the CLI:
```
sh
...
...
op-chain-ops/eof-crawler/src/main.rs
View file @
31037e64
use
clap
::
Parser
;
use
ethers
::
utils
::{
hex
,
keccak256
};
use
eyre
::
Result
;
use
serde
::{
Deserialize
,
Serialize
};
use
std
::{
...
...
@@ -18,13 +17,12 @@ struct EofCrawler {
#[derive(Serialize,
Deserialize,
Debug)]
struct
SnapshotAccount
{
/// The bytecode of the account
code
:
Option
<
String
>
,
/// The public key of the account
#[serde(rename(deserialize
=
"key"
))]
public_key
:
String
,
/// The key of the account in the global state trie
key
:
String
,
/// The address of the account
address
:
Option
<
String
>
,
/// The bytecode of the account
code
:
Option
<
String
>
,
}
fn
main
()
->
Result
<
()
>
{
...
...
@@ -56,16 +54,9 @@ fn main() -> Result<()> {
// Check if the account is a contract, and if it is, check if it has an EOF
// prefix.
let
mut
contract
:
SnapshotAccount
=
serde_json
::
from_str
(
&
buf
)
?
;
let
contract
:
SnapshotAccount
=
serde_json
::
from_str
(
&
buf
)
?
;
if
let
Some
(
code
)
=
contract
.code
.as_ref
()
{
if
&
code
[
2
..
4
]
.to_uppercase
()
==
"EF"
{
// Derive the address of the account from the public key.
// address = keccak256(public_key)[12:]
let
address
=
{
let
public_key
=
hex
::
decode
(
&
contract
.public_key
[
2
..
])
?
;
format!
(
"0x{}"
,
hex
::
encode
(
&
keccak256
(
&
public_key
)[
12
..
]))
};
contract
.address
=
Some
(
address
);
eof_contracts
.push
(
contract
);
}
}
...
...
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