Code Monkey home page Code Monkey logo

orbs-network-go's Introduction

Orbs Network Core Node

Orbs is a public blockchain infrastructure built for the needs of decentralized apps with millions of users. For more information, please check https://orbs.com and read the white papers.

This repo contains the node core reference implementation in golang.

The project is thoroughly tested with unit tests, component tests per microservice, acceptance tests, E2E tests and E2E stress tests running the system under load.

Building Docker images only

If you only want to build the Docker images containing the node binaries, you don't need to have golang on your own machine (the node will be compiled inside the image).

  • Make sure Docker is installed.

    Verify with docker version

  • Run ./docker/build/build-docker-node.sh to create node image orbs:export.

  • Run ./docker/build/build-gamma.sh to create gamma image:

    • orbs:gamma-server contains self-sufficient development binary (similar to Ethereum's Ganache) and gamma-cli to communicate with its server counterpart.

Building from source

Prerequisites

  • Make sure Go is installed (version 1.10 or later).

    Verify with go version

  • Make sure Go workspace bin is in your path.

    Install with export PATH=$PATH:`go env GOPATH`/bin

    Verify with echo $PATH

  • Make sure Git is installed (version 2 or later).

    Verify with git --version

  • If you're interested in building Docker images as well, install Docker.

    Verify with docker version

Build

  • Clone the repo to your Go workspace:

    cd `go env GOPATH`
    go get github.com/orbs-network/orbs-network-go
    cd src/github.com/orbs-network/orbs-network-go
    git checkout master
    
  • Install dependencies with ./git-submodule-checkout.sh. To understand dependency management flow please refer to the dependency documentation.

  • Build with go install

  • You can build all the binaries (orbs-node, gamma-cli and gamma-server) with ./build-binaries.sh.

Run

  • To run the pre-built binary (should be in path):

    orbs-network-go
    
  • To rebuild from source and run (this will take you to project root):

    cd `go env GOPATH`
    cd src/github.com/orbs-network/orbs-network-go
    go run *.go
    

Testing from command line

Test runner

We use the official go test runner go test. It has minimal UI and result caching.

Please install go-junit-reporter prior to running tests for the first time:

go get -u github.com/orbs-network/go-junit-report

Test

  • Run all tests using a script:

    ./test.sh

  • Manually run all tests from project root:

    go test ./...

  • Manually run only fast tests (no E2E and similar):

    go test -short ./...

  • Check unit test coverage:

    go test -cover `go list ./...`

Test types

E2E tests (slow)

End-to-end tests check the entire system in a real life scenario mimicking real production with multiple nodes. It runs on docker with several nodes connected in a cluster. Due to their nature, E2E tests are slow to run.

  • The tests are found in /test/e2e
  • Run the suite from project root with go test ./test/e2e

Integration tests (slow)

Integration tests check the system adapters and make sure they meet the interface contract they implement. For example connection to a database or network sockets.

Acceptance tests (fast)

Acceptance tests check the internal hexagon of the system (it's logic with all microservices) with faster adapters that allow the suite to run extremely fast.

  • The tests are found in /test/acceptance
  • Run the suite from project root with go test ./test/acceptance

Component tests (fast)

Component tests check that a single service meets its specification while mocking the other services around it. They allow development of a service in isolation.

Unit tests (fast)

Unit tests are very specific tests that check a single unit or two. They test the unit in isolation and stub/mock everything around it.

  • The tests are found next to the actual unit in a file with _test.go suffix, eg. sha256_test.go sitting next to sha256.go

Testing on Docker

For Troubleshooting, see the Docker Guide

All tests run automatically when the Docker images are built. The script ./test.sh is part of the Docker build.

  • Run ./docker/build/build.sh && ./docker/test/test.sh to build all images and run E2E tests in a dockerized environment.

  • The logs for all E2E nodes will be placed on your machine under the ./_logs directory of the project (and will be overridden on every E2E run).

Component tests on Docker

To detect flaky tests of specific components, run component tests multiple times on Docker:

  • To enable running component tests multiple times, edit test.sh and uncomment the line ./test.components.sh
  • To modify the number of times each component test runs, edit test.components.sh and modify the value of the COUNT variable (you may also need to modify the various timeouts)
  • optional To run a specific test (component, unit, of any other) multiple times (useful when debugging a specific scenario for flakiness), edit test.components.sh, comment the line run_component_tests, then uncomment the line starting with run_specific_test and modify the test name to run that one specific test multiple times on Docker.

After you've finished editing, run ./docker/build/build.sh && ./docker/test/test.sh

You should probably not commit any of these edits you've made for testing, as they are transient in nature.

Developer experience

Git hooks

Please run git config --local core.hooksPath .githooks after cloning the repository.

Debugging issues on Docker

Occasionally, local tests with go test will pass but the same tests on Docker will fail. This usually happens when tests are flaky and sensitive to timing (we do our best to avoid this).

  • Run ./docker/build/build.sh and ./docker/test/test.sh.

  • If the E2E test gets stuck or docker-compose stops working properly, try to remove all containers with this handy command: docker rm -f $(docker ps -aq). But remember that ALL YOUR LOCAL CONTAINERS WILL BE GONE (even from other projects).

  • Debugging the acceptance suite is problematic out of the box, since the debugger (Delve) doesn't support any code importing the plugin package. Luckily, the acceptance suite relies on a fake compiler; to enable debugging:

    • in Goland
      1. Go to Preferences -> Go -> Vendoring & Build Tags
      2. Add the tag nonativecompiler under 'custom tags'
      3. Create a run configuration for the desired test (by clicking the "play" icon to the left of the test name)
      4. Run it once (to create the run config)
      5. Edit the run config and check "use all custom build tags"
      6. Debug your test

IDE

  • We recommend working on the project with GoLand IDE. Recommended settings:

    • Under Preferences | Editor | Code Style | Go make sure Use tab character is checked
  • We reccommend using the same version of Go as per our CI (1.12.9 at the time this line is written)

    • To change Go SDK version in GoLand, go to Preferences | Go | GOROOT, click the + button, choose Download, and choose the version you want to use for this project. As soon as the selected SDK version is installed, GoLand will notify you in the Event Log window. Then go to Preferences | Go | GOPATH and under Project GOPATH choose the location of the SDK you have installed.
  • For easy testing, under Run | Edit Configurations add these Go Test configurations:

    • "Fast" with Directory set to project root and -short flag added to Go tool arguments
    • "All" with Directory set to project root
    • It's also recommended to uncheck Show Ignored tests and check Show Passed in the test panel after running the configuration
    • If you have a failed test which keeps failing due to cache click Rerun Failed Tests in the test panel (it will ignore cache)
  • Running some tests that are unsafe for production deployments requires a special build flag, enable it if you're a core developer:

    • Under Preferences | Go | Vendoring & Build Tags | Custom tags add the tag unsafetests
  • You may enable the following automatic tools that run on file changes:

    • "go fmt" in Preferences | Tools | File Watchers, add with + the go fmt watcher
    • To run tests automatically on save, check Toggle auto-test in the test panel (it's now a core feature of GoLand)
  • Debugging tests may contain very verbose logs, increase console buffer size in Preferences | Editor | General | Console | Override console cycle buffer size = 10024 KB

  • If you experience lags or Low Memory warnings while working with GoLand, increasing its default VM heap size can help:

  • Go to Help | Edit Custom VM Options... and set:

    -Xms256m
    -Xmx1536m
    

Profiling

To enable profiling: put "profiling": true in your config.json.

It will enable net/http/pprof package, and you will be able to query pprof via http just as described in the docs.

Debugging with logs

By default, log output is filtered to only errors and metrics. To enable full log, put "logger-full-log": true in your node configuration. It will permanently remove the filter.

If you want to enable or disable this filter in production, there is a way to do that via HTTP API:

curl -XPOST http://$NODE_IP/vchains/$VCHAIN/debug/logs/fiter-on

Or

curl -XPOST http://$NODE_IP/vchains/$VCHAIN/debug/logs/fiter-off

Development principles

Refer to the Contributor's Guide (work in progress)

License

MIT

orbs-network-go's People

Contributors

andr444 avatar bolshchikov avatar danokoch avatar dependabot[bot] avatar electricmonk avatar erankirsh avatar gadcl avatar idozilberberg avatar itamararjuan avatar jlevison avatar netoneko avatar noambergil avatar odedwx avatar ronnno avatar talkol avatar vistra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

orbs-network-go's Issues

Resolve sync issues

s.lastCommittedBlockHeight = txBlockHeader.BlockHeight()

This needs a mutex. You don't know any assumptions on which goroutines your service methods are called, they can be called concurrently from multiple ones and you have shared variables.

Access to shared variables needs to be protected.

BlockTracker may panic on double close()

Two goroutines concurrently calling IncrementHeight() may attempt close the same channel twice causing panic.

We could:

  • use a mutex to synchronize calls to the entire method. In this case we no longer atomic.AddUint64()
  • add defer func() { recover() }() before the close(prevLatch). this will suppress possible panics.

The first option seems more straight forward and readable. But might also be less efficient. @electricmonk, what do you think?

Add a random guid in log for every acceptance harness instance and print it at the end of the line

When we're running count 300 of the acceptance (a common practice when debugging flakiness), the logs get jumbled up between tests and we need some way to separate them

Our proposal was to generate a random GUID every time we instantiate network for the acceptance

This guid should be printed on every log line related to this specific acceptance test

But please print it at the end of the line because we need it only for grep, printing it in the beginning of the line makes the log difficult to read

Some recommendations for refactors in Block Storage

  1. Recommend to merge lastCommittedBlockHeight and lastCommittedBlockTimestamp to a single variable lastCommittedBlock

It's a common pattern we have in almost all services. One example. State storage also should have the same variable and Transaction pool, this variable I think also appears in the spec in all of them under this name. It's used for all the inter-node synchronization.

  1. Recommend to extract logic from service.go and leave only routing boilerplate in it

See for example this service.go and this extracted logic from it.

When you have lots of stuff the code is doing, you can separate to different logic files per domain. The one huge service.go file is hard to read.. One domain for example is the commit flow which can be put in commit.go and another domain is the sync flow which can be put in sync.go

Please find a more elegant way to do this than a polling goroutine

I doesn't seem elegant to me to create a new goroutine on every method call. Also polling is also pretty bad for a language that has dozens of synchronization mechanisms.

Please find a way to resolve this without polling. If you need to learn more about go synchronization mechanisms, please do.

Also, don't use sleeps in production code:

time.Sleep(10 * time.Millisecond)

Find other ways to implement this, like using time.After and a select. Please read the implementation for consensusalgo/benchmarkconsensus thoroughly if you want to see examples of go synchronization patterns.

BlockTracker graceDistance uint16 is too small

I changed graceDistance from uint16 to uint64 and this change was reverted without discussing with me first

The comment now says:
// this is not primitives.BlockHeight on purpose, to indicate that grace distance should be small

This is incorrect

We also use BlockTracker in tests and in the tests the graceDistance should be infinite because we want to wait indefinitely for this block and we can't fail on grace. If the event does not arrive, the test should fail on timeout just like on a deadlock.

Right now, the max value we can put in it is 65K which is too small for the tests. In some tests, the system may close blocks very quickly (empty blocks for example or when we have a single node) so 65K blocks isn't a huge number that can be considered infinite..

The type of this field should be primitives.BlockHeight because otherwise you have dozens of unneeded casts all over the place

Delta values are usually the same type of the absolute values. For example unix timestamp is seconds from 1970 which is an absolute unit, but we also provide time deltas in seconds. It's ok. The fact that it's block height does not mean that it's small or large. It just means that it's measured in block numbers.

Add sync mechanism for shared variables in StateStorage

Some recommendations:

  1. The following line should be protected under a mutex:

s.lastResultsBlockHeader = input.ResultsBlockHeader

You have no guarantees on which goroutine the function CommitStateDiff will be called, so it might be called concurrently

This is btw the simple pattern we use to protect.

  1. Recommend to rename lastResultsBlockHeader to lastCommittedBlock

It's a common pattern we have in almost all services. One example. Block storage also should have the same variable and Transaction pool, this variable I think also appears in the spec in all of them under this name. It's used for all the inter-node synchronization.

  1. Recommend to extract logic from service.go and leave only routing boilerplate in it

See for example this service.go and this extracted logic from it.

When you have lots of stuff the code is doing, you can separate to different logic files per domain. The one huge service.go file is hard to read..

Convert configs to standard config mechanism

Please convert the configs to the standard way config are defined in the system

Notice this:

blockSyncCommitTimeout time.Duration

It does not appear here:

federationNodes map[string]FederationNode

Also notice this config:

config := gossipAdapter.MemberlistGossipConfig{nodePublicKey, int(gossipPort), peers}

It's also not standard

Please have a session with @electricmonk about how he designed the configuration in the node and what's the correct way to plug into it

Think about switching from go-mock to testify/mock

https://github.com/stretchr/testify/blob/master/mock/mock.go

testify/mock is very very similar to go-mock (almost identical), but looks improved on several fronts:

  1. All calls are logged so you can assert on the calls after the fact (instead of just placing matchers in advance and verifying after the fact)

  2. Better maintained and more stars

  3. Appears to handle more gracefully the case where several Whens match the same call. It works by finding the closest call (minimal number of diffs). This logic will probably need to be improved though, like by changing to look for functions in the opposite order.

Logger could be better

The logger has a few issues IMO:

  • log.GetLogger() suggests the singleton pattern although it is actually a constructor
  • Having too many logger instances floating around is costly and also unmanageable in terms of silent/verbose operation
  • Possible memory issue with too many logger instances
  • Ability to track down a transaction or method invocation on the log is currently very hard
  • Need to debate which directions are possible to allow more control over logging in general through-out the life cycle of the process.

ResultsBlockHeader in CommitTransactionReceipts is too wide in scope

transactionpool.CommitTransactionReceipts provides an instance of ResultsBlockHeader - out of which transaction pool only needs last block height and timestamp.

This creates unnecessary coupling and provides too wide a scope for transaction pool.

Please introduce changes in proto to only pass the block height and timestamp.

BlockPair is not being deserialized properly in GossipTransport

Add a print in consensus, thus:

func (s *service) HandleLeanHelixPrePrepare(input *gossiptopics.LeanHelixPrePrepareInput) (*gossiptopics.EmptyOutput, error) {
	s.preparedBlock = input.Message.BlockPair // each node will save this block
	println(input.Message.BlockPair.TransactionsBlock.Header.String())

	return s.gossip.SendLeanHelixPrepare(&gossiptopics.LeanHelixPrepareInput{})
}

Create pre-commit, pre-push and post-merge hooks

On pre-commit:

go fmt ./...
go test ./...

on pre-push:

go test ./...

on post-merge: update git modules

consider using some framework to manage this rather than editing shell scripts, there are several of these available out there

Understanding Adapter Spaghetti

Currently, there's kind of a spaghetti in the implementation of the test harness adapters and the production adapters.
Specifically, block persistence adapter only implemented in test harness and the production is kept naive and empty. This caused the issue in e2e, what happened was that production adapter implementation was blocking after 10 blocks. e2e in CI was waiting for 5 seconds before starting, so that once it got started, the block persistence was stuck already. Resolved naively in PR #127

Flakiness in acceptance test

on TestLeaderCommitsTransactionsAndSkipsInvalidOnes in acceptance test.. It's a race condition where the new block is created with zero transactions created Transactions block num-transactions=0 before the first transaction from the test is added to the pool.

Replicate locally by running the following several times:

go test ./test/acceptance -run TestLeaderCommitsTransactionsAndSkipsInvalidOnes -count 300

Error log:

info 2018-08-14T20:26:56.581873638Z creating acceptance test network num-nodes=2 consensus=CONSENSUS_ALGO_TYPE_LEAN_HELIX function=harness.NewTestNetwork source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/test/harness/network.go:61 
info 2018-08-14T20:26:56.582253385Z enter SendTransaction node=dfc06c service=public-api function=publicapi.(*service).SendTransaction source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/publicapi/service.go:31 
info 2018-08-14T20:26:56.582308735Z processor executing contract node=dfc06c service=processor-native contract=_GlobalPreOrder method=approve function=native.(*service).processMethodCall source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/processor/native/call.go:70 
info 2018-08-14T20:26:56.582606048Z performed pre order checks node=dfc06c service=virtual-machine error=<nil> blockHeight=ffffffffffffffff num-statuses=1 function=virtualmachine.(*service).TransactionSetPreOrder source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/virtualmachine/service.go:96 
created Transactions block num-transactions=0 block={Header:{ProtocolVersion:1,VirtualChainId:0,BlockHeight:5,PrevBlockHashPtr:,Timestamp:0,TransactionsRootHash:,MetadataHash:,NumSignedTransactions:0,},Metadata:{},SignedTransactions:[],BlockProof:<nil>,}
info 2018-08-14T20:26:56.582648759Z processing transaction set node=dfc06c service=virtual-machine num-transactions=0 function=virtualmachine.(*service).ProcessTransactionSet source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/virtualmachine/service.go:72 
info 2018-08-14T20:26:56.582684087Z adding new transaction to the pool node=dfc06c service=transaction-pool transaction={Transaction:{ProtocolVersion:1,VirtualChainId:2a,Timestamp:154ada1746ecc191,Signer:{Scheme:(Eddsa){NetworkType:NETWORK_TYPE_TEST_NET,SignerPublicKey:92d469d7c004cc0b24a192d9457836bf38effa27536627ef60718b00b0f33152,},},ContractName:BenchmarkToken,MethodName:transfer,InputArguments:[{Name:amount,Type:(Uint64Value)0,},],},Signature:147a84c16cdd67c03c870ab6cfa5f2cb37c5e811299cb49011b9f489896aa880410f3aabe9701eca6a94c57ea00bf1a4a984ce8ce77e0c2c4cdcfaa3cfd77002,} function=transactionpool.(*service).AddNewTransaction source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/transactionpool/add_new_transaction.go:43 
created Results block: {Header:{ProtocolVersion:1,VirtualChainId:0,BlockHeight:5,PrevBlockHashPtr:,Timestamp:0,ReceiptsRootHash:,StateDiffHash:,TransactionsBlockHashPtr:3f6f316b2a5917d7652d0a4059e5789b33042ae57e333fdda47920ae4c90f01e,PreExecutionStateRootHash:,TxhashBloomFilter:,TimestampBloomFilter:,NumTransactionReceipts:0,NumContractStateDiffs:0,},TransactionReceipts:[],ContractStateDiffs:[],BlockProof:<nil>,}
info 2018-08-14T20:26:56.582716397Z proposed block pair node=dfc06c service=consensus-algo-lean-helix blockHeight=5 function=leanhelix.(*service).leaderProposeNextBlockIfNeeded source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/algorithm.go:55 
info 2018-08-14T20:26:56.582720938Z exit SendTransaction node=dfc06c service=public-api function=publicapi.(*service).SendTransaction source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/publicapi/service.go:41 
info 2018-08-14T20:26:56.58276Z transport message received node=92d469 service=gossip header={ProtocolVersion:0,VirtualChainId:0,RecipientPublicKeys:[],RecipientMode:RECIPIENT_LIST_MODE_BROADCAST,Topic:(TransactionRelay)TRANSACTION_RELAY_FORWARDED_TRANSACTIONS,} function=gossip.(*service).OnTransportMessageReceived source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/gossip/service.go:45 
info 2018-08-14T20:26:56.582799563Z entered consensus round with last committed block height node=dfc06c service=consensus-algo-lean-helix blockHeight=0 function=leanhelix.(*service).consensusRoundRunLoop source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/service.go:94 
info 2018-08-14T20:26:56.582828209Z transport message received node=92d469 service=gossip header={ProtocolVersion:0,VirtualChainId:0,RecipientPublicKeys:[],RecipientMode:RECIPIENT_LIST_MODE_BROADCAST,Topic:(LeanHelix)LEAN_HELIX_PRE_PREPARE,} function=gossip.(*service).OnTransportMessageReceived source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/gossip/service.go:45 
info 2018-08-14T20:26:56.582868188Z voting as validator for block node=92d469 service=consensus-algo-lean-helix blockHeight=5 function=leanhelix.(*service).validatorVoteForNewBlockProposal source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/algorithm.go:96 
created Transactions block num-transactions=1 block={Header:{ProtocolVersion:1,VirtualChainId:0,BlockHeight:1,PrevBlockHashPtr:,Timestamp:0,TransactionsRootHash:,MetadataHash:,NumSignedTransactions:1,},Metadata:{},SignedTransactions:[{Transaction:{ProtocolVersion:1,VirtualChainId:2a,Timestamp:154ada1746ecc191,Signer:{Scheme:(Eddsa){NetworkType:NETWORK_TYPE_TEST_NET,SignerPublicKey:92d469d7c004cc0b24a192d9457836bf38effa27536627ef60718b00b0f33152,},},ContractName:BenchmarkToken,MethodName:transfer,InputArguments:[{Name:amount,Type:(Uint64Value)0,},],},Signature:147a84c16cdd67c03c870ab6cfa5f2cb37c5e811299cb49011b9f489896aa880410f3aabe9701eca6a94c57ea00bf1a4a984ce8ce77e0c2c4cdcfaa3cfd77002,},],BlockProof:<nil>,}
info 2018-08-14T20:26:56.582907685Z transport message received node=dfc06c service=gossip header={ProtocolVersion:0,VirtualChainId:0,RecipientPublicKeys:[],RecipientMode:RECIPIENT_LIST_MODE_BROADCAST,Topic:(LeanHelix)LEAN_HELIX_PREPARE,} function=gossip.(*service).OnTransportMessageReceived source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/gossip/service.go:45 
info 2018-08-14T20:26:56.582910883Z processing transaction set node=dfc06c service=virtual-machine num-transactions=1 function=virtualmachine.(*service).ProcessTransactionSet source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/virtualmachine/service.go:72 
info 2018-08-14T20:26:56.58292726Z got the required votes node=dfc06c service=consensus-algo-lean-helix votes=1 function=leanhelix.(*service).leaderCollectVotesForBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/algorithm.go:84 
info 2018-08-14T20:26:56.582966235Z Trying to commit a block node=dfc06c service=block-storage blockHeight=5 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:52 
trying to commit state diff for block height 5, num contract state diffs 0
info 2018-08-14T20:26:56.583000334Z Committed a block node=dfc06c service=block-storage blockHeight=5 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:79 
info 2018-08-14T20:26:56.583015273Z entered consensus round with last committed block height node=dfc06c service=consensus-algo-lean-helix blockHeight=5 function=leanhelix.(*service).consensusRoundRunLoop source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/service.go:94 
created Transactions block num-transactions=0 block={Header:{ProtocolVersion:1,VirtualChainId:0,BlockHeight:4,PrevBlockHashPtr:,Timestamp:0,TransactionsRootHash:,MetadataHash:,NumSignedTransactions:0,},Metadata:{},SignedTransactions:[],BlockProof:<nil>,}
info 2018-08-14T20:26:56.583099846Z processing transaction set node=dfc06c service=virtual-machine num-transactions=0 function=virtualmachine.(*service).ProcessTransactionSet source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/virtualmachine/service.go:72 
created Results block: {Header:{ProtocolVersion:1,VirtualChainId:0,BlockHeight:4,PrevBlockHashPtr:,Timestamp:0,ReceiptsRootHash:,StateDiffHash:,TransactionsBlockHashPtr:7777677e408095b16473141a22dd6238263c9afdc9eb1cb8f08e48cb9475a9e7,PreExecutionStateRootHash:,TxhashBloomFilter:,TimestampBloomFilter:,NumTransactionReceipts:0,NumContractStateDiffs:0,},TransactionReceipts:[],ContractStateDiffs:[],BlockProof:<nil>,}
info 2018-08-14T20:26:56.583166901Z proposed block pair node=dfc06c service=consensus-algo-lean-helix blockHeight=4 function=leanhelix.(*service).leaderProposeNextBlockIfNeeded source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/algorithm.go:55 
info 2018-08-14T20:26:56.583177532Z transport message received node=92d469 service=gossip header={ProtocolVersion:0,VirtualChainId:0,RecipientPublicKeys:[],RecipientMode:RECIPIENT_LIST_MODE_BROADCAST,Topic:(LeanHelix)LEAN_HELIX_COMMIT,} function=gossip.(*service).OnTransportMessageReceived source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/gossip/service.go:45 
info 2018-08-14T20:26:56.583212133Z Trying to commit a block node=92d469 service=block-storage blockHeight=5 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:52 
trying to commit state diff for block height 5, num contract state diffs 0
info 2018-08-14T20:26:56.583242867Z Committed a block node=92d469 service=block-storage blockHeight=5 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:79 
info 2018-08-14T20:26:56.582939621Z processing transaction node=dfc06c service=virtual-machine contract=BenchmarkToken method=transfer blockHeight=0 function=virtualmachine.(*service).processTransactionSet source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/virtualmachine/execution.go:74 
info 2018-08-14T20:26:56.583278556Z processor executing contract node=dfc06c service=processor-native contract=_Deployments method=isServiceDeployed function=native.(*service).processMethodCall source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/processor/native/call.go:70 
info 2018-08-14T20:26:56.583357757Z transport message received node=92d469 service=gossip header={ProtocolVersion:0,VirtualChainId:0,RecipientPublicKeys:[],RecipientMode:RECIPIENT_LIST_MODE_BROADCAST,Topic:(LeanHelix)LEAN_HELIX_PRE_PREPARE,} function=gossip.(*service).OnTransportMessageReceived source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/gossip/service.go:45 
info 2018-08-14T20:26:56.583384838Z voting as validator for block node=92d469 service=consensus-algo-lean-helix blockHeight=4 function=leanhelix.(*service).validatorVoteForNewBlockProposal source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/algorithm.go:96 
info 2018-08-14T20:26:56.58342531Z transport message received node=dfc06c service=gossip header={ProtocolVersion:0,VirtualChainId:0,RecipientPublicKeys:[],RecipientMode:RECIPIENT_LIST_MODE_BROADCAST,Topic:(LeanHelix)LEAN_HELIX_PREPARE,} function=gossip.(*service).OnTransportMessageReceived source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/gossip/service.go:45 
info 2018-08-14T20:26:56.583421767Z processor executing contract node=dfc06c service=processor-native contract=BenchmarkToken method=_init function=native.(*service).processMethodCall source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/processor/native/call.go:70 
info 2018-08-14T20:26:56.583445352Z got the required votes node=dfc06c service=consensus-algo-lean-helix votes=1 function=leanhelix.(*service).leaderCollectVotesForBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/algorithm.go:84 
info 2018-08-14T20:26:56.583469072Z Trying to commit a block node=dfc06c service=block-storage blockHeight=4 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:52 
trying to commit state diff for block height 4, num contract state diffs 0
info 2018-08-14T20:26:56.583496697Z Committed a block node=dfc06c service=block-storage blockHeight=4 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:79 
info 2018-08-14T20:26:56.583507814Z processor executing contract node=dfc06c service=processor-native contract=BenchmarkToken method=transfer function=native.(*service).processMethodCall source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/processor/native/call.go:70 
info 2018-08-14T20:26:56.583546047Z transport message received node=92d469 service=gossip header={ProtocolVersion:0,VirtualChainId:0,RecipientPublicKeys:[],RecipientMode:RECIPIENT_LIST_MODE_BROADCAST,Topic:(LeanHelix)LEAN_HELIX_COMMIT,} function=gossip.(*service).OnTransportMessageReceived source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/gossip/service.go:45 
info 2018-08-14T20:26:56.583574319Z Trying to commit a block node=92d469 service=block-storage blockHeight=4 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:52 
trying to commit state diff for block height 4, num contract state diffs 0
info 2018-08-14T20:26:56.583601056Z Committed a block node=92d469 service=block-storage blockHeight=4 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:79 
info 2018-08-14T20:26:56.583518453Z entered consensus round with last committed block height node=dfc06c service=consensus-algo-lean-helix blockHeight=4 function=leanhelix.(*service).consensusRoundRunLoop source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/service.go:94 
created Results block: {Header:{ProtocolVersion:1,VirtualChainId:0,BlockHeight:1,PrevBlockHashPtr:,Timestamp:0,ReceiptsRootHash:,StateDiffHash:,TransactionsBlockHashPtr:8e239a18cc9cbe69f769b2da8b675e594bd14c3acb3ad80ac5c8b1f88ae4c63a,PreExecutionStateRootHash:,TxhashBloomFilter:,TimestampBloomFilter:,NumTransactionReceipts:1,NumContractStateDiffs:2,},TransactionReceipts:[{Txhash:5fc09348256706d82063176a6f6223540a5d455f51537ba5eb9886d41eab2378,ExecutionResult:EXECUTION_RESULT_SUCCESS,OutputArguments:[],},],ContractStateDiffs:[{ContractName:_Deployments,StateDiffs:[{Key:a8f2147b89fd40e6ede355ee59e49bc4325a2fc3604e696d55cbebe7c3acb0eb9c1185a5c5e9fc54612808977ee8f548b2258d31,Value:01000000,},],},{ContractName:BenchmarkToken,StateDiffs:[{Key:47e217a975abc3db72c03f99cfdda1bc1f9b352941b8dfb11289523c787a12fa9c1185a5c5e9fc54612808977ee8f548b2258d31,Value:0000000000000000,},],},],BlockProof:<nil>,}
info 2018-08-14T20:26:56.583819783Z proposed block pair node=dfc06c service=consensus-algo-lean-helix blockHeight=1 function=leanhelix.(*service).leaderProposeNextBlockIfNeeded source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/algorithm.go:55 
info 2018-08-14T20:26:56.583871854Z transport message received node=92d469 service=gossip header={ProtocolVersion:0,VirtualChainId:0,RecipientPublicKeys:[],RecipientMode:RECIPIENT_LIST_MODE_BROADCAST,Topic:(LeanHelix)LEAN_HELIX_PRE_PREPARE,} function=gossip.(*service).OnTransportMessageReceived source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/gossip/service.go:45 
info 2018-08-14T20:26:56.583900238Z voting as validator for block node=92d469 service=consensus-algo-lean-helix blockHeight=1 function=leanhelix.(*service).validatorVoteForNewBlockProposal source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/algorithm.go:96 
info 2018-08-14T20:26:56.583941625Z transport message received node=dfc06c service=gossip header={ProtocolVersion:0,VirtualChainId:0,RecipientPublicKeys:[],RecipientMode:RECIPIENT_LIST_MODE_BROADCAST,Topic:(LeanHelix)LEAN_HELIX_PREPARE,} function=gossip.(*service).OnTransportMessageReceived source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/gossip/service.go:45 
info 2018-08-14T20:26:56.583961029Z got the required votes node=dfc06c service=consensus-algo-lean-helix votes=1 function=leanhelix.(*service).leaderCollectVotesForBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/algorithm.go:84 
info 2018-08-14T20:26:56.583973038Z Trying to commit a block node=dfc06c service=block-storage blockHeight=1 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:52 
trying to commit state diff for block height 1, num contract state diffs 2
info 2018-08-14T20:26:56.584003858Z Committed a block node=dfc06c service=block-storage blockHeight=1 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:79 
info 2018-08-14T20:26:56.584028838Z entered consensus round with last committed block height node=dfc06c service=consensus-algo-lean-helix blockHeight=1 function=leanhelix.(*service).consensusRoundRunLoop source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/service.go:94 
info 2018-08-14T20:26:56.584062523Z transport message received node=92d469 service=gossip header={ProtocolVersion:0,VirtualChainId:0,RecipientPublicKeys:[],RecipientMode:RECIPIENT_LIST_MODE_BROADCAST,Topic:(LeanHelix)LEAN_HELIX_COMMIT,} function=gossip.(*service).OnTransportMessageReceived source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/gossip/service.go:45 
info 2018-08-14T20:26:56.58407583Z Trying to commit a block node=92d469 service=block-storage blockHeight=1 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:52 
trying to commit state diff for block height 1, num contract state diffs 2
info 2018-08-14T20:26:56.58411602Z Committed a block node=92d469 service=block-storage blockHeight=1 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:79 
info 2018-08-14T20:26:56.584300487Z enter SendTransaction node=dfc06c service=public-api function=publicapi.(*service).SendTransaction source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/publicapi/service.go:31 
info 2018-08-14T20:26:56.584373051Z processor executing contract node=dfc06c service=processor-native contract=_GlobalPreOrder method=approve function=native.(*service).processMethodCall source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/processor/native/call.go:70 
info 2018-08-14T20:26:56.584466821Z enter SendTransaction node=dfc06c service=public-api function=publicapi.(*service).SendTransaction source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/publicapi/service.go:31 
info 2018-08-14T20:26:56.584531717Z processor executing contract node=dfc06c service=processor-native contract=_GlobalPreOrder method=approve function=native.(*service).processMethodCall source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/processor/native/call.go:70 
info 2018-08-14T20:26:56.58468407Z performed pre order checks node=dfc06c service=virtual-machine error=<nil> blockHeight=ffffffffffffffff num-statuses=1 function=virtualmachine.(*service).TransactionSetPreOrder source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/virtualmachine/service.go:96 
info 2018-08-14T20:26:56.584741165Z adding new transaction to the pool node=dfc06c service=transaction-pool transaction={Transaction:{ProtocolVersion:1,VirtualChainId:2a,Timestamp:154ada17470c06ad,Signer:{Scheme:(Eddsa){NetworkType:NETWORK_TYPE_TEST_NET,SignerPublicKey:92d469d7c004cc0b24a192d9457836bf38effa27536627ef60718b00b0f33152,},},ContractName:BenchmarkToken,MethodName:transfer,InputArguments:[{Name:amount,Type:(Uint64Value)16,},],},Signature:e9b5a8025c4ea4d705e13dec7394bee7ad8bafe9840624c1f2aea9bacaac0cfd1297c0d4b7d941182547f6723b28283dcc49197b350fe7970a0b142af79edb08,} function=transactionpool.(*service).AddNewTransaction source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/transactionpool/add_new_transaction.go:43 
info 2018-08-14T20:26:56.584775646Z exit SendTransaction node=dfc06c service=public-api function=publicapi.(*service).SendTransaction source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/publicapi/service.go:41 
info 2018-08-14T20:26:56.584809838Z transport message received node=92d469 service=gossip header={ProtocolVersion:0,VirtualChainId:0,RecipientPublicKeys:[],RecipientMode:RECIPIENT_LIST_MODE_BROADCAST,Topic:(TransactionRelay)TRANSACTION_RELAY_FORWARDED_TRANSACTIONS,} function=gossip.(*service).OnTransportMessageReceived source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/gossip/service.go:45 
info 2018-08-14T20:26:56.584831707Z performed pre order checks node=dfc06c service=virtual-machine error=<nil> blockHeight=ffffffffffffffff num-statuses=1 function=virtualmachine.(*service).TransactionSetPreOrder source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/virtualmachine/service.go:96 
info 2018-08-14T20:26:56.584885458Z adding new transaction to the pool node=dfc06c service=transaction-pool transaction={Transaction:{ProtocolVersion:1,VirtualChainId:2a,Timestamp:154ada17470eba2a,Signer:{Scheme:(Eddsa){NetworkType:NETWORK_TYPE_TEST_NET,SignerPublicKey:92d469d7c004cc0b24a192d9457836bf38effa27536627ef60718b00b0f33152,},},ContractName:BenchmarkToken,MethodName:transfer,InputArguments:[{Name:amount,Type:(Uint64Value)11,},],},Signature:e048e3c2ddae77c14287493401152943235d4ca2da4ff8dacdcb869cfdd031fff2aba92305d4a38322a0e28d85fbe51882a8ea68209d7a4e52c8da19099c6f02,} function=transactionpool.(*service).AddNewTransaction source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/transactionpool/add_new_transaction.go:43 
info 2018-08-14T20:26:56.584912968Z exit SendTransaction node=dfc06c service=public-api function=publicapi.(*service).SendTransaction source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/publicapi/service.go:41 
info 2018-08-14T20:26:56.58494864Z transport message received node=92d469 service=gossip header={ProtocolVersion:0,VirtualChainId:0,RecipientPublicKeys:[],RecipientMode:RECIPIENT_LIST_MODE_BROADCAST,Topic:(TransactionRelay)TRANSACTION_RELAY_FORWARDED_TRANSACTIONS,} function=gossip.(*service).OnTransportMessageReceived source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/gossip/service.go:45 
info 2018-08-14T20:26:56.584959143Z enter SendTransaction node=dfc06c service=public-api function=publicapi.(*service).SendTransaction source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/publicapi/service.go:31 
created Transactions block num-transactions=1 block={Header:{ProtocolVersion:1,VirtualChainId:0,BlockHeight:2,PrevBlockHashPtr:,Timestamp:0,TransactionsRootHash:,MetadataHash:,NumSignedTransactions:1,},Metadata:{},SignedTransactions:[{Transaction:{ProtocolVersion:1,VirtualChainId:2a,Timestamp:154ada17470c06ad,Signer:{Scheme:(Eddsa){NetworkType:NETWORK_TYPE_TEST_NET,SignerPublicKey:92d469d7c004cc0b24a192d9457836bf38effa27536627ef60718b00b0f33152,},},ContractName:BenchmarkToken,MethodName:transfer,InputArguments:[{Name:amount,Type:(Uint64Value)16,},],},Signature:e9b5a8025c4ea4d705e13dec7394bee7ad8bafe9840624c1f2aea9bacaac0cfd1297c0d4b7d941182547f6723b28283dcc49197b350fe7970a0b142af79edb08,},],BlockProof:<nil>,}
info 2018-08-14T20:26:56.585029507Z transaction is invalid node=dfc06c service=transaction-pool error=transaction rejected: TRANSACTION_STATUS_REJECTED_TIMESTAMP_WINDOW_EXCEEDED transaction={Transaction:{ProtocolVersion:1,VirtualChainId:2a,Timestamp:154adc0038d76f06,Signer:{Scheme:(Eddsa){NetworkType:NETWORK_TYPE_TEST_NET,SignerPublicKey:92d469d7c004cc0b24a192d9457836bf38effa27536627ef60718b00b0f33152,},},ContractName:BenchmarkToken,MethodName:transfer,InputArguments:[{Name:amount,Type:(Uint64Value)a,},],},Signature:95567b77c59c3a1f036cdcaa5123b6d4fb166d7312385102f039d225ad2b6bd7436f714fdf57c85a7a7214c10a2512323013a9cf3f659feba7942229d24a5b04,} function=transactionpool.(*service).AddNewTransaction source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/transactionpool/add_new_transaction.go:26 
info 2018-08-14T20:26:56.585039382Z processing transaction set node=dfc06c service=virtual-machine num-transactions=1 function=virtualmachine.(*service).ProcessTransactionSet source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/virtualmachine/service.go:72 
info 2018-08-14T20:26:56.585053134Z exit SendTransaction node=dfc06c service=public-api function=publicapi.(*service).SendTransaction source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/publicapi/service.go:41 
info 2018-08-14T20:26:56.585063018Z processing transaction node=dfc06c service=virtual-machine contract=BenchmarkToken method=transfer blockHeight=1 function=virtualmachine.(*service).processTransactionSet source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/virtualmachine/execution.go:74 
info 2018-08-14T20:26:56.585095201Z processor executing contract node=dfc06c service=processor-native contract=_Deployments method=isServiceDeployed function=native.(*service).processMethodCall source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/processor/native/call.go:70 
info 2018-08-14T20:26:56.585150776Z processor executing contract node=dfc06c service=processor-native contract=BenchmarkToken method=transfer function=native.(*service).processMethodCall source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/processor/native/call.go:70 
created Results block: {Header:{ProtocolVersion:1,VirtualChainId:0,BlockHeight:2,PrevBlockHashPtr:,Timestamp:0,ReceiptsRootHash:,StateDiffHash:,TransactionsBlockHashPtr:070233a6bd26e0a69104d2fef65988d78c1d0621de00fa7337285c5ece142fd2,PreExecutionStateRootHash:,TxhashBloomFilter:,TimestampBloomFilter:,NumTransactionReceipts:1,NumContractStateDiffs:1,},TransactionReceipts:[{Txhash:59780b157b3054999841f031b1589e133f8bae616e4a53a51c7dd93f29c6c7b3,ExecutionResult:EXECUTION_RESULT_SUCCESS,OutputArguments:[],},],ContractStateDiffs:[{ContractName:BenchmarkToken,StateDiffs:[{Key:47e217a975abc3db72c03f99cfdda1bc1f9b352941b8dfb11289523c787a12fa9c1185a5c5e9fc54612808977ee8f548b2258d31,Value:1600000000000000,},],},],BlockProof:<nil>,}
info 2018-08-14T20:26:56.585273442Z proposed block pair node=dfc06c service=consensus-algo-lean-helix blockHeight=2 function=leanhelix.(*service).leaderProposeNextBlockIfNeeded source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/algorithm.go:55 
info 2018-08-14T20:26:56.585351917Z transport message received node=92d469 service=gossip header={ProtocolVersion:0,VirtualChainId:0,RecipientPublicKeys:[],RecipientMode:RECIPIENT_LIST_MODE_BROADCAST,Topic:(LeanHelix)LEAN_HELIX_PRE_PREPARE,} function=gossip.(*service).OnTransportMessageReceived source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/gossip/service.go:45 
info 2018-08-14T20:26:56.585384878Z voting as validator for block node=92d469 service=consensus-algo-lean-helix blockHeight=2 function=leanhelix.(*service).validatorVoteForNewBlockProposal source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/algorithm.go:96 
info 2018-08-14T20:26:56.585418371Z transport message received node=dfc06c service=gossip header={ProtocolVersion:0,VirtualChainId:0,RecipientPublicKeys:[],RecipientMode:RECIPIENT_LIST_MODE_BROADCAST,Topic:(LeanHelix)LEAN_HELIX_PREPARE,} function=gossip.(*service).OnTransportMessageReceived source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/gossip/service.go:45 
info 2018-08-14T20:26:56.58544525Z got the required votes node=dfc06c service=consensus-algo-lean-helix votes=1 function=leanhelix.(*service).leaderCollectVotesForBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/algorithm.go:84 
info 2018-08-14T20:26:56.585457296Z Trying to commit a block node=dfc06c service=block-storage blockHeight=2 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:52 
trying to commit state diff for block height 2, num contract state diffs 1
info 2018-08-14T20:26:56.5854852Z Committed a block node=dfc06c service=block-storage blockHeight=2 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:79 
info 2018-08-14T20:26:56.585508647Z entered consensus round with last committed block height node=dfc06c service=consensus-algo-lean-helix blockHeight=2 function=leanhelix.(*service).consensusRoundRunLoop source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/service.go:94 
created Transactions block num-transactions=1 block={Header:{ProtocolVersion:1,VirtualChainId:0,BlockHeight:3,PrevBlockHashPtr:,Timestamp:0,TransactionsRootHash:,MetadataHash:,NumSignedTransactions:1,},Metadata:{},SignedTransactions:[{Transaction:{ProtocolVersion:1,VirtualChainId:2a,Timestamp:154ada17470eba2a,Signer:{Scheme:(Eddsa){NetworkType:NETWORK_TYPE_TEST_NET,SignerPublicKey:92d469d7c004cc0b24a192d9457836bf38effa27536627ef60718b00b0f33152,},},ContractName:BenchmarkToken,MethodName:transfer,InputArguments:[{Name:amount,Type:(Uint64Value)11,},],},Signature:e048e3c2ddae77c14287493401152943235d4ca2da4ff8dacdcb869cfdd031fff2aba92305d4a38322a0e28d85fbe51882a8ea68209d7a4e52c8da19099c6f02,},],BlockProof:<nil>,}
info 2018-08-14T20:26:56.585587001Z processing transaction set node=dfc06c service=virtual-machine num-transactions=1 function=virtualmachine.(*service).ProcessTransactionSet source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/virtualmachine/service.go:72 
info 2018-08-14T20:26:56.585611458Z processing transaction node=dfc06c service=virtual-machine contract=BenchmarkToken method=transfer blockHeight=2 function=virtualmachine.(*service).processTransactionSet source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/virtualmachine/execution.go:74 
info 2018-08-14T20:26:56.585647282Z processor executing contract node=dfc06c service=processor-native contract=_Deployments method=isServiceDeployed function=native.(*service).processMethodCall source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/processor/native/call.go:70 
info 2018-08-14T20:26:56.585700787Z processor executing contract node=dfc06c service=processor-native contract=BenchmarkToken method=transfer function=native.(*service).processMethodCall source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/processor/native/call.go:70 
created Results block: {Header:{ProtocolVersion:1,VirtualChainId:0,BlockHeight:3,PrevBlockHashPtr:,Timestamp:0,ReceiptsRootHash:,StateDiffHash:,TransactionsBlockHashPtr:0d62917a3612db75182996099bb7c1808efd5953305ce25b8285f3a6c0d8775f,PreExecutionStateRootHash:,TxhashBloomFilter:,TimestampBloomFilter:,NumTransactionReceipts:1,NumContractStateDiffs:1,},TransactionReceipts:[{Txhash:43b868fd07e1e2336a51e6b5cd29daaef86e3e9e1cb04eae94847c75eeb95454,ExecutionResult:EXECUTION_RESULT_SUCCESS,OutputArguments:[],},],ContractStateDiffs:[{ContractName:BenchmarkToken,StateDiffs:[{Key:47e217a975abc3db72c03f99cfdda1bc1f9b352941b8dfb11289523c787a12fa9c1185a5c5e9fc54612808977ee8f548b2258d31,Value:2700000000000000,},],},],BlockProof:<nil>,}
info 2018-08-14T20:26:56.585904458Z proposed block pair node=dfc06c service=consensus-algo-lean-helix blockHeight=3 function=leanhelix.(*service).leaderProposeNextBlockIfNeeded source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/algorithm.go:55 
info 2018-08-14T20:26:56.585947103Z transport message received node=92d469 service=gossip header={ProtocolVersion:0,VirtualChainId:0,RecipientPublicKeys:[],RecipientMode:RECIPIENT_LIST_MODE_BROADCAST,Topic:(LeanHelix)LEAN_HELIX_COMMIT,} function=gossip.(*service).OnTransportMessageReceived source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/gossip/service.go:45 
info 2018-08-14T20:26:56.585968029Z Trying to commit a block node=92d469 service=block-storage blockHeight=2 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:52 
info 2018-08-14T20:26:56.585971148Z transport message received node=92d469 service=gossip header={ProtocolVersion:0,VirtualChainId:0,RecipientPublicKeys:[],RecipientMode:RECIPIENT_LIST_MODE_BROADCAST,Topic:(LeanHelix)LEAN_HELIX_PRE_PREPARE,} function=gossip.(*service).OnTransportMessageReceived source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/gossip/service.go:45 
info 2018-08-14T20:26:56.586001122Z voting as validator for block node=92d469 service=consensus-algo-lean-helix blockHeight=3 function=leanhelix.(*service).validatorVoteForNewBlockProposal source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/algorithm.go:96 
info 2018-08-14T20:26:56.586034782Z transport message received node=dfc06c service=gossip header={ProtocolVersion:0,VirtualChainId:0,RecipientPublicKeys:[],RecipientMode:RECIPIENT_LIST_MODE_BROADCAST,Topic:(LeanHelix)LEAN_HELIX_PREPARE,} function=gossip.(*service).OnTransportMessageReceived source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/gossip/service.go:45 
info 2018-08-14T20:26:56.586048101Z got the required votes node=dfc06c service=consensus-algo-lean-helix votes=1 function=leanhelix.(*service).leaderCollectVotesForBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/algorithm.go:84 
info 2018-08-14T20:26:56.586065346Z Trying to commit a block node=dfc06c service=block-storage blockHeight=3 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:52 
trying to commit state diff for block height 3, num contract state diffs 1
info 2018-08-14T20:26:56.586093337Z Committed a block node=dfc06c service=block-storage blockHeight=3 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:79 
info 2018-08-14T20:26:56.586107595Z entered consensus round with last committed block height node=dfc06c service=consensus-algo-lean-helix blockHeight=3 function=leanhelix.(*service).consensusRoundRunLoop source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/consensusalgo/leanhelix/service.go:94 
info 2018-08-14T20:26:56.58614398Z transport message received node=92d469 service=gossip header={ProtocolVersion:0,VirtualChainId:0,RecipientPublicKeys:[],RecipientMode:RECIPIENT_LIST_MODE_BROADCAST,Topic:(LeanHelix)LEAN_HELIX_COMMIT,} function=gossip.(*service).OnTransportMessageReceived source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/gossip/service.go:45 
info 2018-08-14T20:26:56.586162007Z Trying to commit a block node=92d469 service=block-storage blockHeight=2 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:52 
trying to commit state diff for block height 2, num contract state diffs 1
info 2018-08-14T20:26:56.586203877Z Committed a block node=92d469 service=block-storage blockHeight=2 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:79 
trying to commit state diff for block height 2, num contract state diffs 1
info 2018-08-14T20:26:56.586231333Z Committed a block node=92d469 service=block-storage blockHeight=2 function=blockstorage.(*service).CommitBlock source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/blockstorage/service.go:79 
info 2018-08-14T20:26:56.586259937Z enter CallMethod node=dfc06c service=public-api function=publicapi.(*service).CallMethod source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/publicapi/service.go:45 
info 2018-08-14T20:26:56.586295163Z running local method node=dfc06c service=virtual-machine contract=BenchmarkToken method=getBalance blockHeight=3 function=virtualmachine.(*service).RunLocalMethod source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/virtualmachine/service.go:58 
info 2018-08-14T20:26:56.586337565Z processor executing contract node=dfc06c service=processor-native contract=_Deployments method=isServiceDeployedReadOnly function=native.(*service).processMethodCall source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/processor/native/call.go:70 
info 2018-08-14T20:26:56.586385899Z processor executing contract node=dfc06c service=processor-native contract=BenchmarkToken method=getBalance function=native.(*service).processMethodCall source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/processor/native/call.go:70 
info 2018-08-14T20:26:56.586428689Z exit CallMethod node=dfc06c service=public-api function=publicapi.(*service).CallMethod source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/publicapi/service.go:63 
info 2018-08-14T20:26:56.586480225Z enter CallMethod node=92d469 service=public-api function=publicapi.(*service).CallMethod source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/publicapi/service.go:45 
info 2018-08-14T20:26:56.586498704Z running local method node=92d469 service=virtual-machine contract=BenchmarkToken method=getBalance blockHeight=2 function=virtualmachine.(*service).RunLocalMethod source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/virtualmachine/service.go:58 
info 2018-08-14T20:26:56.586539035Z processor executing contract node=92d469 service=processor-native contract=_Deployments method=isServiceDeployedReadOnly function=native.(*service).processMethodCall source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/processor/native/call.go:70 
info 2018-08-14T20:26:56.586588899Z processor executing contract node=92d469 service=processor-native contract=BenchmarkToken method=getBalance function=native.(*service).processMethodCall source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/processor/native/call.go:70 
info 2018-08-14T20:26:56.586625591Z exit CallMethod node=92d469 service=public-api function=publicapi.(*service).CallMethod source=/Users/talkol/go/src/github.com/orbs-network/orbs-network-go/services/publicapi/service.go:63 
--- FAIL: TestLeaderCommitsTransactionsAndSkipsInvalidOnes (0.00s)
	simple_transfer_test.go:17: testing network with 2 nodes running CONSENSUS_ALGO_TYPE_LEAN_HELIX
	simple_transfer_test.go:23: waiting for leader blocks
	simple_transfer_test.go:28: waiting for non leader blocks
	require.go:201: 
			Error Trace:	simple_transfer_test.go:31
			            				network.go:25
			            				context.go:8
			            				network.go:23
			            				simple_transfer_test.go:13
			Error:      	Not equal: 
			            	expected: int(39)
			            	actual  : uint64(0x16)
			Test:       	TestLeaderCommitsTransactionsAndSkipsInvalidOnes
			Messages:   	getBalance result on non leader

Improve the way config travels from docker to main to Node

Can we make the docker images identical for all nodes? This means they can't have any configuration on them.

Assume we have 50 configuration params - that can also vary by blockHeight! Is there any better way to pass them to docker except 50 environment variables?

Config params naming and type conventions are all over the place

Naming mess:

How many different ways can we phrase time related params?

QueryGraceTimeoutMillis
BlockTransactionReceiptQueryStartGraceSec
TransactionExpirationWindowInSeconds

Types mess:

BlockTransactionReceiptQueryStartGraceSec() time.Duration
TransactionExpirationWindowInSeconds() uint32

Consistently timeout is too long for some tests

The running time for benchmarkconsensus/test has increased from 200 ms to 2 sec

I can only assume it's because the new value for consistently that was needed for e2e

I think there's no choice and we must have slow tests and fast tests and have different timeouts for both. One way to implement this is to use t.Short() to check if we have a fast run or a slow run.. Not a very good solution though

Another option is to have some configuration that the e2e will set that will change a global variable for the duration of this test.. but this sucks because it will leak between tests.. maybe save this parameter on t somehow

Block height notion must be added to StateStorage adapter

The current adapter interface for write needs to be changed a bit

This is the current interface:

WriteState(contract primitives.ContractName, stateDiffs *protocol.StateRecord) error // TODO: change this to an array as well since we do multiple writes in one transactions

  1. We need to add here a notion of block height. State storage needs to keep state changes for about 5 blocks back.. if we don't know what block height we're updating how can we keep this log? I recommend to add the block height as one of the parameters.

  2. The state writes in the system are always done per complete blocks. We can't update in the system the state for half a block or one transaction from a block. The current interface that writes in a resolution of a single contract is dangerous because it isn't transactional. If the first succeeds and the second fails we won't undo the first. I recommend to change the interface to receive all the state diffs from a block together. Then the persistence layer either handles all of them successfully or none of them (make it fully transactional).

The next thing we need to do is the following:

  1. Add a latch mechanism in the in memory adapter that allows to wait until the state for a specific block height has been committed. This is very similar to the mechanism we have now in the block persistence.

  2. The reason for this change is that the acceptance test needs to be changed. Instead of waiting in the acceptance until block persistence has reached a certain block, we need to wait until state persistence has reached a certain block. State persistence is updated slightly after the block storage.

  3. Once you add the latch mechanism and change the acceptance test, we need to undo 2 hacks I had to do in block storage to make the current bad mechanism pass tests: (1) block storage should be fixed to update state storage AFTER it writes to its own persistence layer. (2) the tests for block storage (does not update last committed block height and timestamp when persistence storage fails) should be changed back to make sure state storage is not updated if block persistence fails.

Smells in virtual machine

  1. virtualmachine/execution.go - Copying of protocol.MethodArgument before processor.ProcessCall. We have the same with the return value in encodeTransactionReceipt.

  2. PermissionScope is passed to processor.ProcessCall and read a second before with getServiceDeployment() although processor.ProcessCall also checks the repository (we do it twice, ugly). Also look at the context service stack which holds the permissions.

  3. We check the deployment of every contract right before running it by running another contract. Do we want to add a cache for this? Do we want to store permissions in the cache?

  4. Two contract methods for deployment, one for read and one for write

Improve component test structure of BenchmarkConsensus

Issues:

  1. Refactor the context so it's less dumb.. Need to see where the next tests take it

  2. Do not use HardcodedConfig, find a nice way to partially implement a config interface without resorting to a copy paste implementation of HardcodedConfig in every component test

Decide on error reporting strategy

Consider this for example:

if blockPair.TransactionsBlock.Header == nil {
    return nil, &ErrCodecEncode{"BlockPair", blockPair}
}

How do we want to report errors in the system in general?

Some error conditions - like a transaction was rejected because it's expired, need to be passed programmatically though the system until they reach the user so they need a representation that is not string only

Share GoLand run configurations

Share run configuration such as "All" and "Fast". This is instead of each of us having to define their own run configurations in GoLand.

Signing a batch of transactions

TransactionPool is supposed to sign a batch of transactions before forwarding them via gossip.
Our signature API currently takes []byte.
This would require copying all transactions .Raw() into a new []byte prior to signing, which defeats the purpose of membuffers.

What do we do?

Some improvements for logger

  1. Move to package log or reporting under instrumentation

  2. Change the order of the stack trace (param function) and my parameters since now I can't see the params in human readable (and the stack trace param is not very interesting)

  3. Add interface Error support with unwrapping, cause and stack trace (don't just cast to string)

  4. Add a few tests with membuffers to see that the print to string looks good (TransferTransaction.Build().String())

  5. Think about tab formatting in human readable so its easier to split fields with your eyes

Processor native types & constants should probably have a public counterpart

After setting out on creating a first external contract development sandbox to work with
we have come across the need to compile a contract outside the realms of orbs-network-go

The problem becomes apparant when we try to use the processor types defined within the processor which expects them to be internal to the project.

Compiling contracts outside of the native processor , or shall I say , outside the main compilation of the project is proving difficult without these types defined also on the outside.

This is not neccesarly the solution (the put them also outside as a copy) but rather a suggestion.

We should discuss this more to understand the best way to approach this issue and also to align it with the future goals of the project (Deployable contracts, etc..)

benchmark consensus harness should not intantiate global config

the harness at: services/consensusalgo/benchmarkconsensus/test/harness.go
should not be using the global config directly but rather create a subset of the config thats required by the benchmark config

	config := config.NewHardCodedConfig(
		federationNodes,
		nodePublicKey,
		nodePrivateKey,
		leaderPublicKey,
		consensus.CONSENSUS_ALGO_TYPE_BENCHMARK_CONSENSUS,
		5,
		70,
	)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.