Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
张蕾
Geth-Modification
Commits
4210dd15
Unverified
Commit
4210dd15
authored
6 years ago
by
Martin Holst Swende
Committed by
Péter Szilágyi
6 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tracers: fix err in 4byte, add some opcode analysis tools
parent
f1986f86
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
214 additions
and
3 deletions
+214
-3
4byte_tracer.js
eth/tracers/internal/tracers/4byte_tracer.js
+1
-1
assets.go
eth/tracers/internal/tracers/assets.go
+74
-2
bigram_tracer.js
eth/tracers/internal/tracers/bigram_tracer.js
+47
-0
trigram_tracer.js
eth/tracers/internal/tracers/trigram_tracer.js
+49
-0
unigram_tracer.js
eth/tracers/internal/tracers/unigram_tracer.js
+43
-0
No files found.
eth/tracers/internal/tracers/4byte_tracer.js
View file @
4210dd15
...
...
@@ -60,7 +60,7 @@
return
;
}
// Skip any pre-compile invocations, those are just fancy opcodes
if
(
isPrecompiled
(
toAddress
(
log
.
stack
.
peek
(
1
))))
{
if
(
isPrecompiled
(
toAddress
(
log
.
stack
.
peek
(
1
)
.
toString
(
16
)
)))
{
return
;
}
// Gather internal call details
...
...
This diff is collapsed.
Click to expand it.
eth/tracers/internal/tracers/assets.go
View file @
4210dd15
This diff is collapsed.
Click to expand it.
eth/tracers/internal/tracers/bigram_tracer.js
0 → 100644
View file @
4210dd15
// Copyright 2018 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
{
// hist is the counters of opcode bigrams
hist
:
{},
// lastOp is last operation
lastOp
:
''
,
// execution depth of last op
lastDepth
:
0
,
// step is invoked for every opcode that the VM executes.
step
:
function
(
log
,
db
)
{
var
op
=
log
.
op
.
toString
();
var
depth
=
log
.
getDepth
();
if
(
depth
==
this
.
lastDepth
){
var
key
=
this
.
lastOp
+
'-'
+
op
;
if
(
this
.
hist
[
key
]){
this
.
hist
[
key
]
++
;
}
else
{
this
.
hist
[
key
]
=
1
;
}
}
this
.
lastOp
=
op
;
this
.
lastDepth
=
depth
;
},
// fault is invoked when the actual execution of an opcode fails.
fault
:
function
(
log
,
db
)
{},
// result is invoked when all the opcodes have been iterated over and returns
// the final result of the tracing.
result
:
function
(
ctx
)
{
return
this
.
hist
;
},
}
This diff is collapsed.
Click to expand it.
eth/tracers/internal/tracers/trigram_tracer.js
0 → 100644
View file @
4210dd15
// Copyright 2018 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
{
// hist is the map of trigram counters
hist
:
{},
// lastOp is last operation
lastOps
:
[
''
,
''
],
lastDepth
:
0
,
// step is invoked for every opcode that the VM executes.
step
:
function
(
log
,
db
)
{
var
depth
=
log
.
getDepth
();
if
(
depth
!=
this
.
lastDepth
){
this
.
lastOps
=
[
''
,
''
];
this
.
lastDepth
=
depth
;
return
;
}
var
op
=
log
.
op
.
toString
();
var
key
=
this
.
lastOps
[
0
]
+
'-'
+
this
.
lastOps
[
1
]
+
'-'
+
op
;
if
(
this
.
hist
[
key
]){
this
.
hist
[
key
]
++
;
}
else
{
this
.
hist
[
key
]
=
1
;
}
this
.
lastOps
[
0
]
=
this
.
lastOps
[
1
];
this
.
lastOps
[
1
]
=
op
;
},
// fault is invoked when the actual execution of an opcode fails.
fault
:
function
(
log
,
db
)
{},
// result is invoked when all the opcodes have been iterated over and returns
// the final result of the tracing.
result
:
function
(
ctx
)
{
return
this
.
hist
;
},
}
This diff is collapsed.
Click to expand it.
eth/tracers/internal/tracers/unigram_tracer.js
0 → 100644
View file @
4210dd15
// Copyright 2018 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
{
// hist is the map of opcodes to counters
hist
:
{},
// nops counts number of ops
nops
:
0
,
// step is invoked for every opcode that the VM executes.
step
:
function
(
log
,
db
)
{
var
op
=
log
.
op
.
toString
();
if
(
this
.
hist
[
op
]){
this
.
hist
[
op
]
++
;
}
else
{
this
.
hist
[
op
]
=
1
;
}
this
.
nops
++
;
},
// fault is invoked when the actual execution of an opcode fails.
fault
:
function
(
log
,
db
)
{},
// result is invoked when all the opcodes have been iterated over and returns
// the final result of the tracing.
result
:
function
(
ctx
)
{
if
(
this
.
nops
>
0
){
return
this
.
hist
;
}
},
}
This diff is collapsed.
Click to expand it.
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