Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove bytearray #20

Merged
merged 1 commit into from
Apr 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ module github.com/bazo-blockchain/bazo-vm
go 1.12

require (
github.com/bazo-blockchain/bazo-miner v0.0.0-20190202131416-70aeba0cc925
github.com/bazo-blockchain/bazo-miner v0.0.0-20190411120411-4ccce5c0a1c0
github.com/google/go-cmp v0.2.0 // indirect
github.com/pkg/errors v0.8.1 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/willf/bitset v1.1.10 // indirect
github.com/willf/bloom v2.0.3+incompatible // indirect
golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5
golang.org/x/sys v0.0.0-20190410235845-0ad05ae3009d // indirect
gotest.tools v2.2.0+incompatible
)
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
github.com/bazo-blockchain/bazo-miner v0.0.0-20190202131416-70aeba0cc925 h1:nSe2r9vdKDML8Vu6aV3T6zMkhmoOg/irdEgDSfY9PQ0=
github.com/bazo-blockchain/bazo-miner v0.0.0-20190202131416-70aeba0cc925/go.mod h1:mss6+SSsouoT/kKCIiQSONh972tLbCVORAxq/PzvCa8=
github.com/bazo-blockchain/bazo-miner v0.0.0-20190411120411-4ccce5c0a1c0 h1:LRJG4pHoqA1DxDamf/cbz0Rrvw9M3tkhp2MQ5zGJi6o=
github.com/bazo-blockchain/bazo-miner v0.0.0-20190411120411-4ccce5c0a1c0/go.mod h1:xnPO3uP6OVnQDBxm+3R8VWQRFAVBUO4eqFNcok0/vCk=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
github.com/willf/bitset v1.1.10 h1:NotGKqX0KwQ72NUzqrjZq5ipPNDQex9lo3WpaS8L2sc=
github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/willf/bloom v2.0.3+incompatible h1:QDacWdqcAUI1MPOwIQZRy9kOR7yxfyEmxX8Wdm2/JPA=
Expand All @@ -14,5 +18,7 @@ golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5 h1:bselrhR0Or1vomJZC8ZIjW
golang.org/x/crypto v0.0.0-20190404164418-38d8ce5564a5/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e h1:nFYrTHrdrAOpShe27kaFHjsqYSEQ0KWqdWLu3xuZJts=
golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190410235845-0ad05ae3009d h1:+9jagSGtlJZAaZGdRvJikXNpc5lh2/rq9eyMN/5kmwA=
golang.org/x/sys v0.0.0-20190410235845-0ad05ae3009d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
3 changes: 1 addition & 2 deletions vm/stack.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ package vm

import (
"errors"
"github.com/bazo-blockchain/bazo-miner/protocol"
)

type Stack struct {
Stack []protocol.ByteArray
Stack [][]byte
memoryUsage uint32 // In bytes
memoryMax uint32
}
Expand Down
4 changes: 1 addition & 3 deletions vm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
"fmt"
"math/big"

"github.com/bazo-blockchain/bazo-miner/protocol"

"golang.org/x/crypto/sha3"
)

Expand Down Expand Up @@ -111,7 +109,7 @@ func (vm *VM) trace() {
}
}

reversedStack := make([]protocol.ByteArray, stack.GetLength())
reversedStack := make([][]byte, stack.GetLength())
maxIndex := len(stack.Stack) - 1
for i := maxIndex; i >= 0; i-- {
reversedStack[maxIndex-i] = stack.Stack[i]
Expand Down
4 changes: 2 additions & 2 deletions vm/vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@ func TestVM_Exec_LoadSt(t *testing.T) {

vm := NewTestVM([]byte{})
mc := NewMockContext(code)
mc.ContractVariables = []protocol.ByteArray{[]byte("Hi There!!"), []byte{26}, []byte{0}}
mc.ContractVariables = [][]byte{[]byte("Hi There!!"), []byte{26}, []byte{0}}
vm.context = mc

vm.Exec(false)
Expand Down Expand Up @@ -1252,7 +1252,7 @@ func TestVM_Exec_StoreSt(t *testing.T) {

vm := NewTestVM([]byte{})
mc := NewMockContext(code)
mc.ContractVariables = []protocol.ByteArray{[]byte("Something")}
mc.ContractVariables = [][]byte{[]byte("Something")}
vm.context = mc
mc.Fee = 100000
vm.Exec(false)
Expand Down