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 #964 from hyperledger/develop
Browse files Browse the repository at this point in the history
Release 0.23.1
  • Loading branch information
Sean Young authored Nov 14, 2018
2 parents 4768640 + 7760a37 commit 4c4a833
Show file tree
Hide file tree
Showing 13 changed files with 139 additions and 106 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# [Hyperledger Burrow](https://github.com/hyperledger/burrow) Changelog
## [0.23.1] - 2018-11-14
### Fixed
- [EVM] state/Cache no longer allows SetStorage on accounts that do not exist
- [GRPC] GetAccount on unknown account no longer causes a panic

### Added
- [Docker] Added solc 0.4.25 binary to docker container so that burrow deploy has what it needs to function
- [Execution] panics from executors are captured and pushed to error sink of TxExecution


## [0.23.0] - 2018-11-09
### Changed
- [ABI] provides fast event lookup of EventID
Expand Down Expand Up @@ -311,6 +321,7 @@ This release marks the start of Eris-DB as the full permissioned blockchain node
- [Blockchain] Fix getBlocks to respect block height cap.


[0.23.1]: https://github.com/hyperledger/burrow/compare/v0.23.0...v0.23.1
[0.23.0]: https://github.com/hyperledger/burrow/compare/v0.22.0...v0.23.0
[0.22.0]: https://github.com/hyperledger/burrow/compare/v0.21.0...v0.22.0
[0.21.0]: https://github.com/hyperledger/burrow/compare/v0.20.1...v0.21.0
Expand Down
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# For solc binary
FROM ethereum/solc:0.4.25 as solc-builder
# We use a multistage build to avoid bloating our deployment image with build dependencies
FROM golang:1.10.3-alpine3.8 as builder

Expand All @@ -17,6 +19,8 @@ FROM alpine:3.8
ARG VERSION
ARG VCS_REF=master
ARG BUILD_DATE
ARG USER=burrow
ARG INSTALL_BASE=/usr/local/bin

# Fixed labels according to container label-schema
LABEL org.label-schema.schema-version="1.0"
Expand All @@ -30,13 +34,13 @@ LABEL org.label-schema.vcs-ref=$VCS_REF
LABEL org.label-schema.build-date=$BUILD_DATE

# Run burrow as burrow user; not as root user
ENV USER burrow
ENV BURROW_PATH /home/$USER
RUN addgroup -g 101 -S $USER && adduser -S -D -u 1000 $USER $USER
WORKDIR $BURROW_PATH

# Copy binaries built in previous stage
COPY --from=builder /go/src/github.com/hyperledger/burrow/bin/burrow /usr/local/bin/
COPY --from=builder /go/src/github.com/hyperledger/burrow/bin/burrow $INSTALL_BASE/
COPY --from=solc-builder /usr/bin/solc $INSTALL_BASE/

# Expose ports for 26656:peer; 26658:info; 10997:grpc
EXPOSE 26656
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ build_race: check build_race_db
.PHONY: build_burrow
build_burrow: commit_hash
go build -ldflags "-extldflags '-static' \
-X github.com/hyperledger/burrow/project.commit=$(shell cat commit_hash.txt)" \
-X github.com/hyperledger/burrow/project.commit=$(shell cat commit_hash.txt) \
-X github.com/hyperledger/burrow/project.date=$(shell date -I)" \
-o ${REPO}/bin/burrow ./cmd/burrow

.PHONY: install_burrow
Expand Down
30 changes: 4 additions & 26 deletions NOTES.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,8 @@
### Changed
- [ABI] provides fast event lookup of EventID
- [Events] BlockExecution now included full Tendermint block header as protobuf object rather than JSON string
- [EVM] Nested call errors are now transmitted to EventSink (e.g. TxExecution) as events for better tracing and tests
- [SNative] Permissions contract returns permission flag set not resultant permissions from setBase unsetBase and setGlobal
- [EVM] Errors transmitted through errors.Pusher interface for more reliable capture from memory, stack, and elsewhere
- [Governance] Breaking change to state structure due to governance storage in tree (state root hashes will not match)


### Fixed
- [EVM] Issue where value was not transferred because VM call state was not synced
- [EVM] Various issue where errors were swallowed (in particular - where calling an empty account and when a TX was invalid on delivery)
- [EVM] When calling a non-existent account CreateAccount permission is checked on the caller not the caller's caller
- [CLI] Version now contains date and commit
- [Test] Burrow integration test runner shuts down Burrow correctly
- [Serialisation] updated tmthrgd/go-hex to fallback on default encoding when lacking SSE 4.1 CPU instructions

- [EVM] state/Cache no longer allows SetStorage on accounts that do not exist
- [GRPC] GetAccount on unknown account no longer causes a panic

### Added
- [Deploy] Burrow deploy meta jobs reuses GRPC connection
- [Governance] Added proposal mechanism (via ProposalTx) that allows bulk atomic update of smart contracts and changing network parameters via a threshold voting mechanism. This allows some level of network evolution without any single trusted party or hard forks. This should be considered alpha level functionality.
- [EVM] Added EVM State interface removing unnecessary cache layer (fixing various issues)
- [EVM] Implemented STATICCALL opcode
- [P2P] Added AuthorizedPeers config option to sync only with whitelisted peers exposed over ABCI query under key /p2p/filter/
- [EVM] stack depth now dynamically allocated and exponentially grown in the same way as memory
- [EVM] Solidity proxy call forwarding test

### Removed
- MutableAccount and ConcreteAccount
- [Docker] Added solc 0.4.25 binary to docker container so that burrow deploy has what it needs to function
- [Execution] panics from executors are captured and pushed to error sink of TxExecution

38 changes: 24 additions & 14 deletions acm/state/state_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ func (cache *Cache) GetAccount(address crypto.Address) (*acm.Account, error) {
}

func (cache *Cache) UpdateAccount(account *acm.Account) error {
if account == nil {
return errors.ErrorCodef(errors.ErrorCodeIllegalWrite, "UpdateAccount called with nil account")
}
if cache.readonly {
return errors.ErrorCodef(errors.ErrorCodeIllegalWrite, "UpdateAccount called on read-only account %v", account.GetAddress())
return errors.ErrorCodef(errors.ErrorCodeIllegalWrite,
"UpdateAccount called in a read-only context on account %v", account.GetAddress())
}
accInfo, err := cache.get(account.GetAddress())
if err != nil {
Expand All @@ -93,7 +97,7 @@ func (cache *Cache) UpdateAccount(account *acm.Account) error {
accInfo.Lock()
defer accInfo.Unlock()
if accInfo.removed {
return fmt.Errorf("UpdateAccount on a removed account: %s", account.GetAddress())
return errors.ErrorCodef(errors.ErrorCodeIllegalWrite, "UpdateAccount on a removed account: %s", account.GetAddress())
}
accInfo.account = account.Copy()
accInfo.updated = true
Expand Down Expand Up @@ -159,16 +163,21 @@ func (cache *Cache) GetStorage(address crypto.Address, key binary.Word256) (bina
// NOTE: Set value to zero to remove.
func (cache *Cache) SetStorage(address crypto.Address, key binary.Word256, value binary.Word256) error {
if cache.readonly {
return errors.ErrorCodef(errors.ErrorCodeIllegalWrite, "SetStorage called on read-only account %v", address)
return errors.ErrorCodef(errors.ErrorCodeIllegalWrite,
"SetStorage called in a read-only context on account %v", address)
}
accInfo, err := cache.get(address)
if accInfo.account == nil {
return errors.ErrorCodef(errors.ErrorCodeIllegalWrite,
"SetStorage called on an account that does not exist: %v", address)
}
accInfo.Lock()
defer accInfo.Unlock()
if err != nil {
return err
}
if accInfo.removed {
return fmt.Errorf("SetStorage on a removed account: %s", address)
return errors.ErrorCodef(errors.ErrorCodeIllegalWrite, "SetStorage on a removed account: %s", address)
}
accInfo.storage[key] = value
accInfo.updated = true
Expand Down Expand Up @@ -196,7 +205,7 @@ func (cache *Cache) IterateCachedStorage(address crypto.Address,

// Syncs changes to the backend in deterministic order. Sends storage updates before updating
// the account they belong so that storage values can be taken account of in the update.
func (cache *Cache) Sync(state Writer) error {
func (cache *Cache) Sync(st Writer) error {
if cache.readonly {
// Sync is (should be) a no-op for read-only - any modifications should have been caught in respective methods
return nil
Expand All @@ -213,30 +222,31 @@ func (cache *Cache) Sync(state Writer) error {
accInfo := cache.accounts[address]
accInfo.RLock()
if accInfo.removed {
err := state.RemoveAccount(address)
err := st.RemoveAccount(address)
if err != nil {
return err
}
} else if accInfo.updated {
// First update account in case it needs to be created
err := st.UpdateAccount(accInfo.account)
if err != nil {
return err
}
// Sort keys
var keys binary.Words256
for key := range accInfo.storage {
keys = append(keys, key)
}
// First update keys
sort.Sort(keys)
// Update account's storage
for _, key := range keys {
value := accInfo.storage[key]
err := state.SetStorage(address, key, value)
err := st.SetStorage(address, key, value)
if err != nil {
return err
}
}
// Update account - this gives backend the opportunity to update StorageRoot after calculating the new
// value from any storage value updates
err := state.UpdateAccount(accInfo.account)
if err != nil {
return err
}

}
accInfo.RUnlock()
}
Expand Down
24 changes: 17 additions & 7 deletions acm/state/state_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ func TestStateCache_SetStorage(t *testing.T) {

//Create new account and set its storage in cache
newAcc := acm.NewAccountFromSecret("newAcc")
err := cache.SetStorage(newAcc.Address, word("What?"), word("Huh?"))
err := cache.UpdateAccount(newAcc)
require.NoError(t, err)
err = cache.UpdateAccount(newAcc)
err = cache.SetStorage(newAcc.Address, word("What?"), word("Huh?"))
require.NoError(t, err)

//Check for correct cache storage value
Expand All @@ -211,22 +211,33 @@ func TestStateCache_SetStorage(t *testing.T) {
newAccStorage, err = backend.GetStorage(newAcc.Address, word("What?"))
require.NoError(t, err)
assert.Equal(t, word("Huh?"), newAccStorage)

noone := acm.NewAccountFromSecret("noone at all")
err = cache.SetStorage(noone.Address, binary.Word256{3, 4, 5}, binary.Word256{102, 103, 104})
require.Error(t, err, "should not be able to write to non-existent account")

err = cache.UpdateAccount(noone)
require.NoError(t, err)
err = cache.SetStorage(noone.Address, binary.Word256{3, 4, 5}, binary.Word256{102, 103, 104})
require.NoError(t, err, "should be able to update account after creating it")
}

func TestStateCache_Sync(t *testing.T) {
// Build backend states for read and write
backend := NewCache(NewMemoryState())
cache := NewCache(backend)

//Create new account
// Create new account
newAcc := acm.NewAccountFromSecret("newAcc")
// Create account
err := cache.UpdateAccount(newAcc)

//Set balance for account
// Set balance for account
balance := uint64(24)
newAcc.Balance = balance

//Set storage for account
err := cache.SetStorage(newAcc.Address, word("God save"), word("the queen!"))
// Set storage for account
err = cache.SetStorage(newAcc.Address, word("God save"), word("the queen!"))
require.NoError(t, err)

//Update cache with account changes
Expand Down Expand Up @@ -295,7 +306,6 @@ func TestStateCache_get(t *testing.T) {
newAccOut, err = backend.GetAccount(newAcc.Address)
require.NoError(t, err)
require.NotNil(t, newAccOut)

}

func testAccounts() *MemoryState {
Expand Down
31 changes: 19 additions & 12 deletions deploy/jobs/jobs_contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import (
"path/filepath"
"strings"

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

"github.com/hyperledger/burrow/crypto"
compilers "github.com/hyperledger/burrow/deploy/compile"
"github.com/hyperledger/burrow/deploy/def"
"github.com/hyperledger/burrow/deploy/util"
"github.com/hyperledger/burrow/execution/errors"
"github.com/hyperledger/burrow/execution/evm/abi"
"github.com/hyperledger/burrow/txs/payload"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -417,23 +418,29 @@ func CallJob(call *def.Call, tx *payload.CallTx, do *def.DeployArgs, client *def
return "", nil, err
}

if txe.Exception != nil && txe.Exception.ErrorCode() == errors.ErrorCodeExecutionReverted {
message, err := abi.UnpackRevert(txe.Result.Return)
if err != nil {
return "", nil, err
}
if message != nil {
log.WithField("Revert Reason", *message).Error("Transaction reverted with reason")
return *message, nil, txe.Exception.AsError()
} else {
log.Error("Transaction reverted with no reason")
if txe.Exception != nil {
switch txe.Exception.ErrorCode() {
case errors.ErrorCodeExecutionReverted:
message, err := abi.UnpackRevert(txe.Result.Return)
if err != nil {
return "", nil, err
}
if message != nil {
log.WithField("Revert Reason", *message).Error("Transaction reverted with reason")
return *message, nil, txe.Exception.AsError()
} else {
log.Error("Transaction reverted with no reason")
return "", nil, txe.Exception.AsError()
}
default:
log.Error("Transaction execution exception")
return "", nil, txe.Exception.AsError()
}
}
var result string

// Formally process the return
if txe.Result.Return != nil {
if txe.GetResult().GetReturn() != nil {
log.Debug(txe.Result.Return)

log.WithField("=>", result).Debug("Decoding Raw Result")
Expand Down
4 changes: 2 additions & 2 deletions docs/INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ cd $GOPATH/src/github.com/hyperledger/burrow
make build
```

This will build the `burrow` and `burrow-client` binaries and put them in the `bin/` directory. They can be executed from there or put wherever is convenient.
This will build the `burrow` binary and put it in the `bin/` directory. It can be executed from there or put wherever is convenient.

You can also install `burrow` into `$GOPATH/bin` with `make install_burrow`,
You can also install `burrow` into `$GOPATH/bin` with `make install_burrow`,
Loading

0 comments on commit 4c4a833

Please sign in to comment.