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 #1202 from hyperledger/develop
Browse files Browse the repository at this point in the history
Update master
  • Loading branch information
Sean Young authored Aug 15, 2019
2 parents 5ee17ba + 52404ec commit 978b71d
Show file tree
Hide file tree
Showing 309 changed files with 14,078 additions and 15,820 deletions.
2 changes: 1 addition & 1 deletion .circleci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.12.1-alpine3.9
FROM golang:1.12.6-alpine3.10
MAINTAINER Monax <[email protected]>

ENV DOCKER_VERSION "17.12.1-ce"
Expand Down
25 changes: 20 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ defaults: &defaults
working_directory: /go/src/github.com/hyperledger/burrow
docker:
- image: hyperledger/burrow:ci
environment:
- GO_TEST_ARGS: -p 2

tag_filters: &tags_filters
tags:
Expand All @@ -13,9 +15,12 @@ tag_filters: &tags_filters
setup_docker: &setup_docker
version: 17.11.0-ce

# Start of CircleCI 2.0 config
version: 2
orbs:
codecov: codecov/[email protected]

version: 2.1
jobs:

test:
<<: *defaults
steps:
Expand All @@ -26,10 +31,16 @@ jobs:
# In case we miss compile errors not pulled into test paths
- run: make build

test_cover:
<<: *defaults
steps:
- checkout
- run: make test_cover
- codecov/upload:
file: coverage.html

test_integration:
machine:
working_directory: /go/src/github.com/hyperledger/burrow
enabled: true
image: circleci/classic:201808-01
steps:
- checkout
Expand Down Expand Up @@ -63,14 +74,18 @@ jobs:


workflows:
version: 2

test_and_release:
jobs:
- test:
filters:
<<: *tags_filters

- test_cover:
filters:
branches:
only: develop

- test_integration:
filters:
<<: *tags_filters
Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
# [Hyperledger Burrow](https://github.com/hyperledger/burrow) Changelog
## [Unreleased]


## [0.28.0] - 2019-08-14
### Changed
- [State] IterateStreamEvents now takes inclusive start and end points (end used to be exclusive) avoid bug-prone conversion
- [Dump] Improved structure and API
- [Dump] Default to JSON output and use protobuf for binary output

### Fixed
- [Dump] Fix dump missing events emitted at end height provided
- [Dump] EVM events were not dumped if no height was provided to burrow dump remote commandline
- [RPC/Info] Fix panic in /names and implement properly - now accepts a 'regex' parameter which is a regular expression to match names. Empty for all names.
- [Configure] burrow configure flags --separate-genesis-doc and --pool now work together

### Added
- [State] Burrow now remembers contact ABIs (which describe how to pack bits when calling contracts) - burrow deploy and vent will both use chain-hosted ABI if they are available
- [State] Bond and unbond transactions are now implement to allow validators to transfer native token into validator power.
- [Dump] Better tests, mock, and benchmarks - suitable for profiling IAVL
- [Events] Filters now support OR connective
- [Vent] Projection filters can now have filters longer than 100 characters.
- [Vent] Falls back to local ABI
- [CLI/RPC] Contracts now hold metadata, including contract name, source file, and function names



## [0.27.0] - 2019-06-23
### Added
- [WASM] Support for WASM contracts written in Solidity compiled using solang
Expand Down Expand Up @@ -515,6 +541,8 @@ 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.28.0...HEAD
[0.28.0]: https://github.com/hyperledger/burrow/compare/v0.27.0...v0.28.0
[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
Expand Down
24 changes: 22 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,20 @@ protobuf: $(PROTO_GO_FILES)
clean_protobuf:
@rm -f $(PROTO_GO_FILES_REAL)


### PEG query grammar

# This allows us to filter tagged objects with things like (EventID = 'foo' OR Height > 10) AND EventName CONTAINS 'frog'

.PHONY: peg_deps
peg_deps:
go get -u github.com/pointlander/peg

# regenerate the parser
.PHONY: peg
peg:
peg event/query/query.peg

### Building github.com/hyperledger/burrow

# Output commit_hash but only if we have the git repo (e.g. not in docker build
Expand Down Expand Up @@ -130,7 +144,7 @@ build_burrow_sqlite: commit_hash
.PHONY: install
install: build_burrow
mkdir -p ${BIN_PATH}
cp ${REPO}/bin/burrow ${BIN_PATH}/burrow
install -T ${REPO}/bin/burrow ${BIN_PATH}/burrow

# build burrow with checks for race conditions
.PHONY: build_race_db
Expand Down Expand Up @@ -164,7 +178,13 @@ solang: $(SOLANG_GO_FILES)

.PHONY: test
test: check bin/solc
@tests/scripts/bin_wrapper.sh go test ./... ${GOPACKAGES_NOVENDOR}
# on circleci we might want to limit memory usage through GO_TEST_ARGS
@tests/scripts/bin_wrapper.sh go test ./... ${GO_TEST_ARGS}

.PHONY: test_cover
test_cover: check bin/solc
@tests/scripts/bin_wrapper.sh go test -coverprofile=c.out ./... ${GO_TEST_ARGS}
@tests/scripts/bin_wrapper.sh go tool cover -html=c.out -o coverage.html

.PHONY: test_keys
test_keys: build_burrow
Expand Down
22 changes: 17 additions & 5 deletions NOTES.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
### Added
- [WASM] Support for WASM contracts written in Solidity compiled using solang
### Changed
- [State] IterateStreamEvents now takes inclusive start and end points (end used to be exclusive) avoid bug-prone conversion
- [Dump] Improved structure and API
- [Dump] Default to JSON output and use protobuf for binary output

### 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.
- [Dump] Fix dump missing events emitted at end height provided
- [Dump] EVM events were not dumped if no height was provided to burrow dump remote commandline
- [RPC/Info] Fix panic in /names and implement properly - now accepts a 'regex' parameter which is a regular expression to match names. Empty for all names.
- [Configure] burrow configure flags --separate-genesis-doc and --pool now work together

### Added
- [State] Burrow now remembers contact ABIs (which describe how to pack bits when calling contracts) - burrow deploy and vent will both use chain-hosted ABI if they are available
- [State] Bond and unbond transactions are now implement to allow validators to transfer native token into validator power.
- [Dump] Better tests, mock, and benchmarks - suitable for profiling IAVL
- [Events] Filters now support OR connective
- [Vent] Projection filters can now have filters longer than 100 characters.
- [Vent] Falls back to local ABI
- [CLI/RPC] Contracts now hold metadata, including contract name, source file, and function names

### 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

30 changes: 2 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[![GoDoc](https://godoc.org/github.com/burrow?status.png)](https://godoc.org/github.com/hyperledger/burrow)
[![license](https://img.shields.io/github/license/hyperledger/burrow.svg)](LICENSE.md)
[![LoC](https://tokei.rs/b1/github/hyperledger/burrow?category=lines)](https://github.com/hyperledger/burrow)
[![codecov](https://codecov.io/gh/hyperledger/burrow/branch/develop/graph/badge.svg)](https://codecov.io/gh/hyperledger/burrow)

Branch | Linux
----------|------
Expand All @@ -29,32 +30,9 @@ Hyperledger Burrow is a permissioned blockchain node that executes smart contrac

Project information generally updated on a quarterly basis can be found on the [Hyperledger Burrow Wiki](https://wiki.hyperledger.org/display/burrow).

## Minimum requirements

Requirement|Notes
---|---
Go version | Go1.11 or higher

## Installation

See the [install instructions](docs/INSTALL.md).

## Quick Start
1. [Single full node](docs/quickstart/single-full-node.md) - start your first chain
1. [Send transactions](docs/quickstart/send-transactions.md) - how to communicate with your Burrow chain
1. [Deploy contracts](docs/quickstart/deploy-contracts.md) - interact with the Ethereum Virtual Machine
1. [Multiple validators](docs/quickstart/multiple-validators.md) - advanced consensus setup
1. [Add validators](docs/quickstart/add-validators.md) - bonding a new party
1. [Seed nodes](docs/quickstart/seed-nodes.md) - add new node dynamically
1. [Kubernetes](https://github.com/helm/charts/tree/master/stable/burrow) - bootstraps a burrow network on a Kubernetes cluster

## Project documentation
## Documentation
Burrow getting started documentation is available in the [docs](docs/README.md) directory and in [GoDocs](https://godoc.org/github.com/hyperledger/burrow).

### Reference

- [Genesis](docs/genesis.md) - the 'chain making' or genesis process
- [Permissions](docs/permissions.md) - understand the permissions model at the core of Burrow

## Contribute

Expand All @@ -65,10 +43,6 @@ You can find us on:
- [Hyperledger Mailing List](https://lists.hyperledger.org/mailman/listinfo)
- [here on Github](https://github.com/hyperledger/burrow/issues)

## Future work

For some (slightly outdated) ideas on future work, see the [proposals document](docs/PROPOSALS.md).

## License

[Apache 2.0](LICENSE.md)
53 changes: 17 additions & 36 deletions acm/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ package acm
import (
"bytes"
"fmt"
"reflect"

"github.com/hyperledger/burrow/execution/errors"

amino "github.com/tendermint/go-amino"

"github.com/gogo/protobuf/proto"
"github.com/hyperledger/burrow/binary"
"github.com/hyperledger/burrow/crypto"
"github.com/hyperledger/burrow/event/query"
"github.com/hyperledger/burrow/execution/errors"
"github.com/hyperledger/burrow/permission"
)

Expand Down Expand Up @@ -63,23 +62,6 @@ func (acc *Account) SubtractFromBalance(amount uint64) error {
return nil
}

///---- Serialisation methods

var cdc = amino.NewCodec()

func (acc *Account) Encode() ([]byte, error) {
return cdc.MarshalBinaryBare(acc)
}

func Decode(accBytes []byte) (*Account, error) {
ca := new(Account)
err := cdc.UnmarshalBinaryBare(accBytes, ca)
if err != nil {
return nil, err
}
return ca, nil
}

// Conversions
//
// Using the naming convention is this package of 'As<Type>' being
Expand Down Expand Up @@ -111,14 +93,18 @@ func (acc *Account) Copy() *Account {
}

func (acc *Account) Equal(accOther *Account) bool {
accEnc, err := acc.Encode()
buf := proto.NewBuffer(nil)
err := buf.Marshal(acc)
if err != nil {
return false
}
accOtherEnc, err := acc.Encode()
accEnc := buf.Bytes()
buf.Reset()
err = buf.Marshal(accOther)
if err != nil {
return false
}
accOtherEnc := buf.Bytes()
return bytes.Equal(accEnc, accOtherEnc)
}

Expand All @@ -127,18 +113,13 @@ func (acc Account) String() string {
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", "EVMCode"),
query.TagMap{
"Permissions": acc.Permissions.Base.ResultantPerms(),
"Roles": acc.Permissions.Roles,
}),
func (acc *Account) Get(key string) (interface{}, bool) {
switch key {
case "Permissions":
return acc.Permissions.Base.ResultantPerms(), true
case "Roles":
return acc.Permissions.Roles, true
default:
return query.GetReflect(reflect.ValueOf(acc), key)
}
}

type TaggedAccount struct {
*Account
query.Tagged
}
49 changes: 7 additions & 42 deletions acm/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,40 +49,6 @@ func TestAddress(t *testing.T) {
assert.Equal(t, addr, addrFromWord256)
}

func TestDecodeConcrete(t *testing.T) {
concreteAcc := NewAccountFromSecret("Super Semi Secret")
concreteAcc.Permissions = permission.AccountPermissions{
Base: permission.BasePermissions{
Perms: permission.SetGlobal,
SetBit: permission.SetGlobal,
},
Roles: []string{"bums"},
}
acc := concreteAcc
encodedAcc, err := acc.Encode()
require.NoError(t, err)

concreteAccOut, err := Decode(encodedAcc)
require.NoError(t, err)

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

func TestDecode(t *testing.T) {
acc := NewAccountFromSecret("Super Semi Secret")
encodedAcc, err := acc.Encode()
require.NoError(t, err)
accOut, err := Decode(encodedAcc)
require.NoError(t, err)
assert.Equal(t, NewAccountFromSecret("Super Semi Secret"), accOut)

accOut, err = Decode([]byte("flungepliffery munknut tolopops"))
require.Error(t, err)
assert.Nil(t, accOut)
}

func TestMarshalJSON(t *testing.T) {
acc := NewAccountFromSecret("Super Semi Secret")
acc.EVMCode = []byte{60, 23, 45}
Expand Down Expand Up @@ -110,14 +76,13 @@ func TestAccountTags(t *testing.T) {
Permissions: perms,
EVMCode: solidity.Bytecode_StrangeLoop,
}
tagged := acc.Tagged()
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)
tagged.Get("EVMCode")
flag, _ := acc.Get("Permissions")
permString := permission.String(flag.(permission.PermFlag))
assert.Equal(t, "send | call | createContract | createAccount | bond | name | proposal | input | batch | hasBase | hasRole", permString)
roles, _ := acc.Get("Roles")
assert.Equal(t, []string{"frogs", "dogs"}, roles)
acc.Get("EVMCode")
qry, err := query.New("EVMCode CONTAINS '0116002556001600360006101000A815'")
require.NoError(t, err)
assert.True(t, qry.Matches(tagged))
assert.True(t, qry.Matches(acc))
}
Loading

0 comments on commit 978b71d

Please sign in to comment.