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
bf850974
Commit
bf850974
authored
Apr 27, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using mutan assembler stage
parent
338b6980
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
20 deletions
+2
-20
vm_test.go
ethchain/vm_test.go
+2
-20
No files found.
ethchain/vm_test.go
View file @
bf850974
...
...
@@ -82,7 +82,7 @@ func TestRun4(t *testing.T) {
db
,
_
:=
ethdb
.
NewMemDatabase
()
state
:=
NewState
(
ethutil
.
NewTrie
(
db
,
""
))
asm
,
err
:=
mutan
.
Compile
(
strings
.
NewReader
(
`
script
,
err
:=
mutan
.
Compile
(
strings
.
NewReader
(
`
int32 a = 10
int32 b = 20
if a > b {
...
...
@@ -90,14 +90,13 @@ func TestRun4(t *testing.T) {
}
Exit()
`
),
false
)
script
:=
ethutil
.
Assemble
(
asm
...
)
tx
:=
NewContractCreationTx
(
ethutil
.
Big
(
"0"
),
ethutil
.
Big
(
"1000"
),
ethutil
.
Big
(
"100"
),
script
,
nil
)
addr
:=
tx
.
Hash
()[
12
:
]
contract
:=
MakeContract
(
tx
,
state
)
state
.
UpdateStateObject
(
contract
)
fmt
.
Printf
(
"%x
\n
"
,
addr
)
asm
,
err
=
mutan
.
Compile
(
strings
.
NewReader
(
`
callerScript
,
err
:
=
mutan
.
Compile
(
strings
.
NewReader
(
`
// Check if there's any cash in the initial store
if store[1000] == 0 {
store[1000] = 10^20
...
...
@@ -129,10 +128,7 @@ func TestRun4(t *testing.T) {
if
err
!=
nil
{
fmt
.
Println
(
err
)
}
asm
=
append
(
asm
,
"LOG"
)
fmt
.
Println
(
asm
)
callerScript
:=
ethutil
.
Assemble
(
asm
...
)
callerTx
:=
NewContractCreationTx
(
ethutil
.
Big
(
"0"
),
ethutil
.
Big
(
"1000"
),
ethutil
.
Big
(
"100"
),
callerScript
,
nil
)
// Contract addr as test address
...
...
@@ -162,17 +158,3 @@ func TestRun4(t *testing.T) {
}
fmt
.
Println
(
"account.Amount ="
,
account
.
Amount
)
}
func
TestRun5
(
t
*
testing
.
T
)
{
ethutil
.
ReadConfig
(
""
)
asm
,
_
:=
mutan
.
Compile
(
strings
.
NewReader
(
`
int32 a = 10
int32 b = 20
if a > b {
int32 c = this.caller()
}
exit()
`
),
false
)
ethutil
.
Assemble
(
asm
...
)
}
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