good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
a63b74e3
Commit
a63b74e3
authored
Sep 7, 2014
by
Jeffrey Wilcke
Browse files
Options
Downloads
Patches
Plain Diff
New OPCODES
* EXT- CODECOPY, CODESIZE
parent
0b6b6b52
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ethvm/types.go
+31
-18
31 additions, 18 deletions
ethvm/types.go
ethvm/vm.go
+28
-6
28 additions, 6 deletions
ethvm/vm.go
with
59 additions
and
24 deletions
ethvm/types.go
+
31
−
18
View file @
a63b74e3
...
@@ -49,6 +49,8 @@ const (
...
@@ -49,6 +49,8 @@ const (
CODESIZE
=
0x38
CODESIZE
=
0x38
CODECOPY
=
0x39
CODECOPY
=
0x39
GASPRICE
=
0x3a
GASPRICE
=
0x3a
EXTCODECOPY
=
0x3b
EXTCODESIZE
=
0x3c
// 0x40 range - block operations
// 0x40 range - block operations
PREVHASH
=
0x40
PREVHASH
=
0x40
...
@@ -146,6 +148,7 @@ const (
...
@@ -146,6 +148,7 @@ const (
CALL
=
0xf1
CALL
=
0xf1
RETURN
=
0xf2
RETURN
=
0xf2
POST
=
0xf3
POST
=
0xf3
CALLSTATELESS
=
0xf4
// 0x70 range - other
// 0x70 range - other
LOG
=
0xfe
// XXX Unofficial
LOG
=
0xfe
// XXX Unofficial
...
@@ -203,6 +206,8 @@ var opCodeToString = map[OpCode]string{
...
@@ -203,6 +206,8 @@ var opCodeToString = map[OpCode]string{
NUMBER
:
"NUMBER"
,
NUMBER
:
"NUMBER"
,
DIFFICULTY
:
"DIFFICULTY"
,
DIFFICULTY
:
"DIFFICULTY"
,
GASLIMIT
:
"GASLIMIT"
,
GASLIMIT
:
"GASLIMIT"
,
EXTCODESIZE
:
"EXTCODESIZE"
,
EXTCODECOPY
:
"EXTCODECOPY"
,
// 0x50 range - 'storage' and execution
// 0x50 range - 'storage' and execution
POP
:
"POP"
,
POP
:
"POP"
,
...
@@ -291,6 +296,8 @@ var opCodeToString = map[OpCode]string{
...
@@ -291,6 +296,8 @@ var opCodeToString = map[OpCode]string{
CREATE
:
"CREATE"
,
CREATE
:
"CREATE"
,
CALL
:
"CALL"
,
CALL
:
"CALL"
,
RETURN
:
"RETURN"
,
RETURN
:
"RETURN"
,
POST
:
"POST"
,
CALLSTATELESS
:
"CALLSTATELESS"
,
// 0x70 range - other
// 0x70 range - other
LOG
:
"LOG"
,
LOG
:
"LOG"
,
...
@@ -343,7 +350,12 @@ var OpCodes = map[string]byte{
...
@@ -343,7 +350,12 @@ var OpCodes = map[string]byte{
"CALLVALUE"
:
0x34
,
"CALLVALUE"
:
0x34
,
"CALLDATALOAD"
:
0x35
,
"CALLDATALOAD"
:
0x35
,
"CALLDATASIZE"
:
0x36
,
"CALLDATASIZE"
:
0x36
,
"GASPRICE"
:
0x38
,
"CALLDATACOPY"
:
0x37
,
"CODESIZE"
:
0x38
,
"CODECOPY"
:
0x39
,
"GASPRICE"
:
0x3a
,
"EXTCODECOPY"
:
0x3b
,
"EXTCODESIZE"
:
0x3c
,
// 0x40 range - block operations
// 0x40 range - block operations
"PREVHASH"
:
0x40
,
"PREVHASH"
:
0x40
,
...
@@ -440,6 +452,7 @@ var OpCodes = map[string]byte{
...
@@ -440,6 +452,7 @@ var OpCodes = map[string]byte{
"CALL"
:
0xf1
,
"CALL"
:
0xf1
,
"RETURN"
:
0xf2
,
"RETURN"
:
0xf2
,
"POST"
:
0xf3
,
"POST"
:
0xf3
,
"CALLSTATELESS"
:
0xf4
,
// 0x70 range - other
// 0x70 range - other
"LOG"
:
0xfe
,
"LOG"
:
0xfe
,
...
...
This diff is collapsed.
Click to expand it.
ethvm/vm.go
+
28
−
6
View file @
a63b74e3
...
@@ -197,6 +197,10 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
...
@@ -197,6 +197,10 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
require
(
3
)
require
(
3
)
newMemSize
=
stack
.
Peek
()
.
Uint64
()
+
stack
.
data
[
stack
.
Len
()
-
3
]
.
Uint64
()
newMemSize
=
stack
.
Peek
()
.
Uint64
()
+
stack
.
data
[
stack
.
Len
()
-
3
]
.
Uint64
()
case
EXTCODECOPY
:
require
(
4
)
newMemSize
=
stack
.
data
[
stack
.
Len
()
-
1
]
.
Uint64
()
+
stack
.
data
[
stack
.
Len
()
-
4
]
.
Uint64
()
case
CALL
:
case
CALL
:
require
(
7
)
require
(
7
)
gas
.
Set
(
GasCall
)
gas
.
Set
(
GasCall
)
...
@@ -550,14 +554,32 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
...
@@ -550,14 +554,32 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
code
:=
closure
.
Args
[
cOff
:
cOff
+
l
]
code
:=
closure
.
Args
[
cOff
:
cOff
+
l
]
mem
.
Set
(
mOff
,
l
,
code
)
mem
.
Set
(
mOff
,
l
,
code
)
case
CODESIZE
:
case
CODESIZE
,
EXTCODESIZE
:
l
:=
big
.
NewInt
(
int64
(
len
(
closure
.
Code
)))
var
code
[]
byte
if
op
==
EXTCODECOPY
{
addr
:=
stack
.
Pop
()
.
Bytes
()
code
=
self
.
env
.
State
()
.
GetCode
(
addr
)
}
else
{
code
=
closure
.
Code
}
l
:=
big
.
NewInt
(
int64
(
len
(
code
)))
stack
.
Push
(
l
)
stack
.
Push
(
l
)
self
.
Printf
(
" => %d"
,
l
)
self
.
Printf
(
" => %d"
,
l
)
case
CODECOPY
:
case
CODECOPY
,
EXTCODECOPY
:
var
code
[]
byte
if
op
==
EXTCODECOPY
{
addr
:=
stack
.
Pop
()
.
Bytes
()
code
=
self
.
env
.
State
()
.
GetCode
(
addr
)
}
else
{
code
=
closure
.
Code
}
var
(
var
(
size
=
int64
(
len
(
c
losure
.
C
ode
))
size
=
int64
(
len
(
code
))
mOff
=
stack
.
Pop
()
.
Int64
()
mOff
=
stack
.
Pop
()
.
Int64
()
cOff
=
stack
.
Pop
()
.
Int64
()
cOff
=
stack
.
Pop
()
.
Int64
()
l
=
stack
.
Pop
()
.
Int64
()
l
=
stack
.
Pop
()
.
Int64
()
...
@@ -570,9 +592,9 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
...
@@ -570,9 +592,9 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
l
=
0
l
=
0
}
}
code
:=
c
losure
.
C
ode
[
cOff
:
cOff
+
l
]
code
Copy
:=
code
[
cOff
:
cOff
+
l
]
mem
.
Set
(
mOff
,
l
,
code
)
mem
.
Set
(
mOff
,
l
,
code
Copy
)
case
GASPRICE
:
case
GASPRICE
:
stack
.
Push
(
closure
.
Price
)
stack
.
Push
(
closure
.
Price
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment