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
18cc3533
Commit
18cc3533
authored
Feb 21, 2014
by
Jeffrey Wilcke
Browse files
Options
Downloads
Patches
Plain Diff
Fixed contract running
parent
681eacaa
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ethchain/block_manager.go
+10
-8
10 additions, 8 deletions
ethchain/block_manager.go
ethchain/block_manager_test.go
+0
-1
0 additions, 1 deletion
ethchain/block_manager_test.go
with
10 additions
and
9 deletions
ethchain/block_manager.go
+
10
−
8
View file @
18cc3533
...
@@ -321,19 +321,20 @@ func (bm *BlockManager) ProcContract(tx *Transaction, block *Block, cb TxCallbac
...
@@ -321,19 +321,20 @@ func (bm *BlockManager) ProcContract(tx *Transaction, block *Block, cb TxCallbac
stepcount
:=
0
stepcount
:=
0
totalFee
:=
new
(
big
.
Int
)
totalFee
:=
new
(
big
.
Int
)
// helper function for getting a contract's memory address
getMem
:=
func
(
num
int
)
*
ethutil
.
Value
{
nb
:=
ethutil
.
BigToBytes
(
big
.
NewInt
(
int64
(
num
)),
256
)
return
contract
.
Addr
(
nb
)
}
out
:
out
:
for
{
for
{
stepcount
++
stepcount
++
// The base big int for all calculations. Use this for any results.
// The base big int for all calculations. Use this for any results.
base
:=
new
(
big
.
Int
)
base
:=
new
(
big
.
Int
)
// XXX Should Instr return big int slice instead of string slice?
val
:=
getMem
(
pc
)
// Get the next instruction from the contract
nb
:=
ethutil
.
BigToBytes
(
big
.
NewInt
(
int64
(
pc
)),
256
)
r
:=
contract
.
State
()
.
Get
(
string
(
nb
))
v
:=
ethutil
.
NewValueFromBytes
([]
byte
(
r
))
//fmt.Printf("%x = %d, %v %x\n", r, len(r), v, nb)
//fmt.Printf("%x = %d, %v %x\n", r, len(r), v, nb)
o
:=
v
.
Uint
()
op
:=
OpCode
(
val
.
Uint
())
op
:=
OpCode
(
o
)
var
fee
*
big
.
Int
=
new
(
big
.
Int
)
var
fee
*
big
.
Int
=
new
(
big
.
Int
)
var
fee2
*
big
.
Int
=
new
(
big
.
Int
)
var
fee2
*
big
.
Int
=
new
(
big
.
Int
)
...
@@ -378,6 +379,7 @@ out:
...
@@ -378,6 +379,7 @@ out:
switch
op
{
switch
op
{
case
oSTOP
:
case
oSTOP
:
fmt
.
Println
(
""
)
break
out
break
out
case
oADD
:
case
oADD
:
x
,
y
:=
bm
.
stack
.
Popn
()
x
,
y
:=
bm
.
stack
.
Popn
()
...
@@ -580,7 +582,7 @@ out:
...
@@ -580,7 +582,7 @@ out:
case
oECVALID
:
case
oECVALID
:
case
oPUSH
:
case
oPUSH
:
pc
++
pc
++
bm
.
stack
.
Push
(
bm
.
mem
[
strconv
.
Itoa
(
pc
)]
)
bm
.
stack
.
Push
(
getMem
(
pc
)
.
BigInt
()
)
case
oPOP
:
case
oPOP
:
// Pop current value of the stack
// Pop current value of the stack
bm
.
stack
.
Pop
()
bm
.
stack
.
Pop
()
...
...
This diff is collapsed.
Click to expand it.
ethchain/block_manager_test.go
+
0
−
1
View file @
18cc3533
...
@@ -22,7 +22,6 @@ func TestVm(t *testing.T) {
...
@@ -22,7 +22,6 @@ func TestVm(t *testing.T) {
"1"
,
"1"
,
"PUSH"
,
"PUSH"
,
"2"
,
"2"
,
"STOP"
,
"STOP"
,
})
})
bm
.
ApplyTransactions
(
block
,
[]
*
Transaction
{
ctrct
})
bm
.
ApplyTransactions
(
block
,
[]
*
Transaction
{
ctrct
})
...
...
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