Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1156 from hyperledger/develop
Browse files Browse the repository at this point in the history
Release v0.27.0
  • Loading branch information
Silas Davis authored Jun 23, 2019
2 parents 468279f + 4d21c01 commit 5ee17ba
Show file tree
Hide file tree
Showing 169 changed files with 2,333 additions and 1,898 deletions.
4 changes: 2 additions & 2 deletions .circleci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ RUN apk add --update --no-cache \
RUN pip install docker-compose
# get docker client
WORKDIR /usr/bin
RUN curl -L https://download.docker.com/linux/static/stable/x86_64/docker-$DOCKER_VERSION.tgz | tar xz --strip-components 1 docker/docker
RUN curl -L https://github.com/goreleaser/goreleaser/releases/download/$GORELEASER_VERSION/goreleaser_Linux_x86_64.tar.gz | tar xz goreleaser
RUN curl -sS -L https://download.docker.com/linux/static/stable/x86_64/docker-$DOCKER_VERSION.tgz | tar xz --strip-components 1 docker/docker
RUN curl -sS -L https://github.com/goreleaser/goreleaser/releases/download/$GORELEASER_VERSION/goreleaser_Linux_x86_64.tar.gz | tar xz goreleaser
RUN npm install -g mocha
RUN npm install -g mocha-circleci-reporter
ENV CI=true
Expand Down
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# [Hyperledger Burrow](https://github.com/hyperledger/burrow) Changelog
## [Unreleased]
## [0.27.0] - 2019-06-23
### Added
- [WASM] Support for WASM contracts written in Solidity compiled using solang

### Fixed
-[RPC/Transact] CallCodeSim and CallTxSim were run against uncommitted checker state rather than committed state were all other reads are routed. They were also passed through Transactor for no particularly good reason. This changes them to run against committed DB state and removes the code path through Transactor.

### Changed
- [State] TxExecution's Envelope now stored in state so will be reproduced in Vent Tx tables and over RPC, and so matches TxExecutions served from *Sync rpctransact methods


## [0.26.2] - 2019-06-19
Expand Down Expand Up @@ -507,7 +515,7 @@ This release marks the start of Eris-DB as the full permissioned blockchain node
- [Blockchain] Fix getBlocks to respect block height cap.


[Unreleased]: https://github.com/hyperledger/burrow/compare/v0.26.2...HEAD
[0.27.0]: https://github.com/hyperledger/burrow/compare/v0.26.2...v0.27.0
[0.26.2]: https://github.com/hyperledger/burrow/compare/v0.26.1...v0.26.2
[0.26.1]: https://github.com/hyperledger/burrow/compare/v0.26.0...v0.26.1
[0.26.0]: https://github.com/hyperledger/burrow/compare/v0.25.1...v0.26.0
Expand Down
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ PROTO_GO_FILES_REAL = $(shell find . -path ./vendor -prune -o -type f -name '*.p
# Our own Go files containing the compiled bytecode of solidity files as a constant
SOLIDITY_FILES = $(shell find . -path ./vendor -prune -o -path ./tests -prune -o -type f -name '*.sol' -print)
SOLIDITY_GO_FILES = $(patsubst %.sol, %.sol.go, $(SOLIDITY_FILES))
SOLANG_FILES = $(shell find . -path ./vendor -prune -o -path ./tests -prune -o -type f -name '*.solang' -print)
SOLANG_GO_FILES = $(patsubst %.solang, %.solang.go, $(SOLANG_FILES))

CI_IMAGE="hyperledger/burrow:ci"

Expand Down Expand Up @@ -148,9 +150,16 @@ docker_build: check commit_hash
%.sol.go: %.sol
@go run ./deploy/compile/solgo/main.go $^

# Solidity fixtures
%.solang.go: %.solang
@go run ./deploy/compile/solgo/main.go -wasm $^

.PHONY: solidity
solidity: $(SOLIDITY_GO_FILES)

.PHONY: solang
solang: $(SOLANG_GO_FILES)

# Test

.PHONY: test
Expand Down Expand Up @@ -247,3 +256,8 @@ push_ci_image: build_ci_image

.PHONY: ready_for_pull_request
ready_for_pull_request: docs fix

.PHONY: staticcheck
staticcheck:
go get honnef.co/go/tools/cmd/staticcheck
staticcheck ./...
8 changes: 7 additions & 1 deletion NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### Added
- [WASM] Support for WASM contracts written in Solidity compiled using solang

### Fixed
- [Blockchain] Persist LastBlockTime in Blockchain - before this patch LastBlockTime would only be set correctly after the first block had been received after a node is restarted - this can lead to non-determinism in the EVM via the TIMESTAMP opcode that use the LastBlockTime which is itself sourced from Tendermint's block header (from their implementation of BFT time). Implementing no empty blocks made observing this bug more likely by increasing the amount of time spent in a bad state (LastBlockTime is initially set to GenesisTime).
-[RPC/Transact] CallCodeSim and CallTxSim were run against uncommitted checker state rather than committed state were all other reads are routed. They were also passed through Transactor for no particularly good reason. This changes them to run against committed DB state and removes the code path through Transactor.

### Changed
- [State] TxExecution's Envelope now stored in state so will be reproduced in Vent Tx tables and over RPC, and so matches TxExecutions served from *Sync rpctransact methods

6 changes: 3 additions & 3 deletions acm/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func FromAddressable(addressable crypto.Addressable) *Account {
Address: addressable.GetAddress(),
PublicKey: addressable.GetPublicKey(),
// Since nil slices and maps compare differently to empty ones
Code: Bytecode{},
EVMCode: Bytecode{},
Permissions: permission.AccountPermissions{
Roles: []string{},
},
Expand Down Expand Up @@ -124,13 +124,13 @@ func (acc *Account) Equal(accOther *Account) bool {

func (acc Account) String() string {
return fmt.Sprintf("Account{Address: %s; Sequence: %v; PublicKey: %v Balance: %v; CodeLength: %v; Permissions: %v}",
acc.Address, acc.Sequence, acc.PublicKey, acc.Balance, len(acc.Code), acc.Permissions)
acc.Address, acc.Sequence, acc.PublicKey, acc.Balance, len(acc.EVMCode), acc.Permissions)
}

func (acc *Account) Tagged() query.Tagged {
return &TaggedAccount{
Account: acc,
Tagged: query.MergeTags(query.MustReflectTags(acc, "Address", "Balance", "Sequence", "Code"),
Tagged: query.MergeTags(query.MustReflectTags(acc, "Address", "Balance", "Sequence", "EVMCode"),
query.TagMap{
"Permissions": acc.Permissions.Base.ResultantPerms(),
"Roles": acc.Permissions.Roles,
Expand Down
14 changes: 7 additions & 7 deletions acm/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestDecodeConcrete(t *testing.T) {
require.NoError(t, err)

assert.Equal(t, concreteAcc, concreteAccOut)
concreteAccOut, err = Decode([]byte("flungepliffery munknut tolopops"))
_, err = Decode([]byte("flungepliffery munknut tolopops"))
assert.Error(t, err)
}

Expand All @@ -85,7 +85,7 @@ func TestDecode(t *testing.T) {

func TestMarshalJSON(t *testing.T) {
acc := NewAccountFromSecret("Super Semi Secret")
acc.Code = []byte{60, 23, 45}
acc.EVMCode = []byte{60, 23, 45}
acc.Permissions = permission.AccountPermissions{
Base: permission.BasePermissions{
Perms: permission.AllPermFlags,
Expand All @@ -96,7 +96,7 @@ func TestMarshalJSON(t *testing.T) {
bs, err := json.Marshal(acc)

expected := fmt.Sprintf(`{"Address":"%s","PublicKey":{"CurveType":"ed25519","PublicKey":"%s"},`+
`"Sequence":4,"Balance":10,"Code":"3C172D",`+
`"Sequence":4,"Balance":10,"EVMCode":"3C172D",`+
`"Permissions":{"Base":{"Perms":"root | send | call | createContract | createAccount | bond | name | proposal | input | batch | hasBase | setBase | unsetBase | setGlobal | hasRole | addRole | removeRole","SetBit":""}}}`,
acc.Address, acc.PublicKey)
assert.Equal(t, expected, string(bs))
Expand All @@ -108,16 +108,16 @@ func TestAccountTags(t *testing.T) {
perms.Roles = []string{"frogs", "dogs"}
acc := &Account{
Permissions: perms,
Code: solidity.Bytecode_StrangeLoop,
EVMCode: solidity.Bytecode_StrangeLoop,
}
tagged := acc.Tagged()
assert.Equal(t, []string{"Address", "Balance", "Sequence", "Code", "Permissions", "Roles"}, tagged.Keys())
assert.Equal(t, []string{"Address", "Balance", "Sequence", "EVMCode", "Permissions", "Roles"}, tagged.Keys())
str, _ := tagged.Get("Permissions")
assert.Equal(t, "send | call | createContract | createAccount | bond | name | proposal | input | batch | hasBase | hasRole", str)
str, _ = tagged.Get("Roles")
assert.Equal(t, "frogs;dogs", str)
str, _ = tagged.Get("Code")
qry, err := query.New("Code CONTAINS '0116002556001600360006101000A815'")
tagged.Get("EVMCode")
qry, err := query.New("EVMCode CONTAINS '0116002556001600360006101000A815'")
require.NoError(t, err)
assert.True(t, qry.Matches(tagged))
}
102 changes: 74 additions & 28 deletions acm/acm.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions acm/acmstate/dump_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"encoding/json"

"github.com/hyperledger/burrow/acm"
"github.com/hyperledger/burrow/binary"
"github.com/hyperledger/burrow/crypto"
)

Expand All @@ -32,7 +31,7 @@ func (dw *DumpState) RemoveAccount(address crypto.Address) error {
return nil
}

func (dw *DumpState) SetStorage(address crypto.Address, key, value binary.Word256) error {
func (dw *DumpState) SetStorage(address crypto.Address, key, value []byte) error {
dw.WriteString("SetStorage\n")
dw.WriteString(address.String())
dw.WriteByte('/')
Expand Down
16 changes: 8 additions & 8 deletions acm/acmstate/memory_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

type MemoryState struct {
Accounts map[crypto.Address]*acm.Account
Storage map[crypto.Address]map[binary.Word256]binary.Word256
Storage map[crypto.Address]map[binary.Word256][]byte
}

var _ IterableReaderWriter = &MemoryState{}
Expand All @@ -19,7 +19,7 @@ var _ IterableReaderWriter = &MemoryState{}
func NewMemoryState() *MemoryState {
return &MemoryState{
Accounts: make(map[crypto.Address]*acm.Account),
Storage: make(map[crypto.Address]map[binary.Word256]binary.Word256),
Storage: make(map[crypto.Address]map[binary.Word256][]byte),
}
}

Expand All @@ -40,22 +40,22 @@ func (ms *MemoryState) RemoveAccount(address crypto.Address) error {
return nil
}

func (ms *MemoryState) GetStorage(address crypto.Address, key binary.Word256) (binary.Word256, error) {
func (ms *MemoryState) GetStorage(address crypto.Address, key binary.Word256) ([]byte, error) {
storage, ok := ms.Storage[address]
if !ok {
return binary.Zero256, fmt.Errorf("could not find storage for account %s", address)
return []byte{}, fmt.Errorf("could not find storage for account %s", address)
}
value, ok := storage[key]
if !ok {
return binary.Zero256, fmt.Errorf("could not find key %x for account %s", key, address)
return []byte{}, fmt.Errorf("could not find key %x for account %s", key, address)
}
return value, nil
}

func (ms *MemoryState) SetStorage(address crypto.Address, key, value binary.Word256) error {
func (ms *MemoryState) SetStorage(address crypto.Address, key binary.Word256, value []byte) error {
storage, ok := ms.Storage[address]
if !ok {
storage = make(map[binary.Word256]binary.Word256)
storage = make(map[binary.Word256][]byte)
ms.Storage[address] = storage
}
storage[key] = value
Expand All @@ -71,7 +71,7 @@ func (ms *MemoryState) IterateAccounts(consumer func(*acm.Account) error) (err e
return nil
}

func (ms *MemoryState) IterateStorage(address crypto.Address, consumer func(key, value binary.Word256) error) (err error) {
func (ms *MemoryState) IterateStorage(address crypto.Address, consumer func(key binary.Word256, value []byte) error) (err error) {
for key, value := range ms.Storage[address] {
if err := consumer(key, value); err != nil {
return err
Expand Down
Loading

0 comments on commit 5ee17ba

Please sign in to comment.