Giter Club home page Giter Club logo

go-lachesis's Introduction

go-lachesis's People

Contributors

andrecronje avatar arrivets avatar calvinchengx avatar champii avatar dev10 avatar devintegral avatar devintegral2 avatar devintegral7 avatar devvcat avatar dzeckelev avatar fhaynes avatar joneskm avatar josephg avatar mauleyzaola avatar maxime2 avatar mkong avatar mpitid avatar okislitsin avatar orangetest1 avatar quan8 avatar rishflab avatar roanbrand avatar rus-alex avatar s4kibs4mi avatar samuelmarks avatar sfxdxdev avatar shalokshalom avatar stanislavstoyanov avatar thaarok avatar uprendis 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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

go-lachesis's Issues

Replace all JSON with FlatBuffers (or similar)

Is your feature request related to a problem? Please describe.
JSON is really slow. Performance analysis of the codebase, shows JSON marshalling as one of the bottlenecks:

pprof001

Describe the solution you'd like
One option: https://google.github.io/flatbuffers

Open to alternatives.

Describe alternatives you've considered
Protocol buffers, JSON, JSONB, Cap'n proto, Apache Avro, Apache Thrift.

Additional context
See also: https://en.wikipedia.org/wiki/Comparison_of_data_serialization_formats

We can still accept JSON, but let's force everything to convert to some faster-marshalling format.

Implement a light-client

Describe the solution you'd like
Nodes that do not form part of consensus, but simply receive events.

RPC instead of client / server design

Is your feature request related to a problem? Please describe.
Current architecture for Lachesis to EVM interaction is client server design.

A Lachesis nodes specifies a downstream client. An EVM node exposes a proxy server to receive responses.

This design tightly couples a Lachesis node with an EVM node. The design is supposed to allow for join/drop participation. So a Lachesis node can not have awareness of an EVM node. Although EVM nodes should have awareness of Lachesis nodes.

Describe the solution you'd like
New EVM joins

The EVM genesis file creates a stateHash. This hash must be sent to the Lachesis node. This stateHash is used to see which blockstream is appropriate. The node needs to go into FastSync mode and synchronize missing blocks until the state matches.

From here nodes can either subscribe to WS for blocks, or simply use incremental catchup calls with their attached node. Alternatively block propagation could occur via standard gossip based communication protocols and the lachesis network needs to keep track of the evm network.

TestAddTransaction fails

Describe the bug
When this test is run alongside other tests in the package it fails (sometimes passes). I think this is because all the tests are running concurrently and competing for resources (ports). They pass when run individually.

--- FAIL: TestAddTransaction (0.00s)
    node_test.go:223: err: listen tcp 127.0.0.1:9994: bind: address already in use

To Reproduce
Steps to reproduce the behavior:

  1. Clean test cache: go clean -testcache
  2. Run the tests: make test
    Note: You may have to repeat the steps a couple of times, most of the times a test in the node package will fail, sometimes they pass

Expected behavior
The test should pass

Desktop (please complete the following information):

  • OS: Ubuntu 18.04

TestGrpcReConnection Fails

Describe the bug
When this test is run alongside other tests in the package it fails (sometimes passes). I think this is because all the tests are running concurrently and competing for resources (ports). They pass when run individually.

--- FAIL: TestGrpcReConnection (0.21s)
    test_logger.go:26: time="2018-11-01T15:25:13+11:00" level=warning msg="rpc Connect() err: rpc error: code = Unavailable desc = all SubConns are in TransientFailure, latest connection error: connection error: desc = \"transport: Error while dialing dial tcp 127.0.0.1:9994: connect: connection refused\""
    test_logger.go:26: time="2018-11-01T15:25:13+11:00" level=debug msg="send to server: tx:<data:\"123456\" > "
    test_logger.go:26: time="2018-11-01T15:25:13+11:00" level=debug msg="client connected"
    test_logger.go:26: time="2018-11-01T15:25:13+11:00" level=debug msg="send to server: tx:<data:\"123456\" > "
    test_logger.go:26: time="2018-11-01T15:25:13+11:00" level=debug msg="client refused: rpc error: code = Canceled desc = context canceled"
    test_logger.go:26: time="2018-11-01T15:25:13+11:00" level=warning msg="recv from server err: rpc error: code = Unavailable desc = transport is closing"
    test_logger.go:26: time="2018-11-01T15:25:13+11:00" level=debug msg="client connected"
    --- FAIL: TestGrpcReConnection/#2_Send_tx_after_reconnection (0.20s)
        grpc_test.go:139: 
            	Error Trace:	grpc_test.go:139
            	Error:      	time is over
            	Test:       	TestGrpcReConnection/#2_Send_tx_after_reconnection
    test_logger.go:26: time="2018-11-01T15:25:13+11:00" level=debug msg="client refused: rpc error: code = Canceled desc = context canceled"

To Reproduce
Steps to reproduce the behavior:

  1. Clean test cache: go clean -testcache
  2. Run the tests: make test or go test -timeout 20s ./src/...
    Note: You may have to repeat the steps a couple of times, most of the times a test in the node package will fail, sometimes they pass

Expected behavior
The test should pass

Desktop (please complete the following information):

  • OS: Ubuntu 18.04

EVM and Lachesis connection terminates if one node disconnects

Describe the bug
Once connectivity has been established between an EVM node and Lachesis node if one disconnects the channel is shut down and not restarted. This is not the problem with older versions of the EVM and only introduced in the new version

To Reproduce
Steps to reproduce the behavior:

  1. Start Lachesis node
  2. Start EVM node
  3. Disconnect Lachesis node
  4. (Optional) Reconnect Lachesis node
  5. Attempt to send transaction from EVM to lachesis

Expected behavior
The EVM (or Lachesis) node should reconnect as soon as a new channel is created

Desktop (please complete the following information):

  • OS: Ubuntu
  • Lachesis Version 0.3.0

A utility function to dump the current state of the opera chain

Is your feature request related to a problem? Please describe.
A utility function to output the current state of the opera chain

Describe the solution you'd like
Output in the following format

nodes

node A: a1, a2, a3, ..
node B: b1, b2, b3, ...

events

b2 -> {a1, c1, d1}

Note: these are hash values (of nodes and events).
Can add a parameter to truncate the hashes (if too long).

Describe alternatives you've considered
The utility can output the state of a single node:

events

node A: a1, a2, a3, ..
a1 -> { b1, c1, d1}

Additional context
Simple output is preferred

[EPIC] Support for nacl, plan9, macos and Windows

AFAIK, this is what's required to have good support for the major Go-supported platforms:

  • Implement cross-platform Makefile replacement
    Viable options: https://magefile.org, https://taskfile.org, https://rliebz.github.io/tusk, or even non Go ones like https://github.com/sagiegurari/cargo-make, https://github.com/casey/just
    (also use this + Go code to replace Bash code with cross-platform code)
  • Implement cross-platform syslog replacement
    Viable options: ReportEvent on Windows; syslog on Linux (& nacl); specialised syslog on plan9
  • Implement script to traverse dependencies, extract build tags, map build tags to the file whence they're import (pun intended!), then produce a report of missing implementations per OS
  • Provide example system init files (systemd [popular Linux init system], launchd [macOS], Windows Service, slew [plan9])
  • Update goreleaser to produce packages for all the different OSs now supported
  • CI/CD support
    Travis now supports Windows, this needs to be implemented in our YAML.
    AppVeyor needs to be implemented.
    Options for plan9 need to be investigated.

Error="getting Frame 2: Frame, frame_000000001, Not Found"

I am running 3 node lachesis from the master branch and sometimes (not on every run) getting the following error:

time="2019-01-31T09:38:53+11:00" level=error msg="c.poset.ProcessDecidedRounds()" Error="getting Frame 2: Frame, frame_000000001, Not Found" id=18316840364296702241 z_trace="goroutine 710 [running]:
github.com/Fantom-foundation/go-lachesis/src/log.(*Hook).Fire(0xc0001cc360, 0xc010813080, 0x0, 0x0)
         /home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/src/log/hook.go:97 +0x18f
github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.LevelHooks.Fire(0xc000147b60, 0x2, 0xc010813080, 0x1e7be52cb270, 0xc02e33d8c5)
         /home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/hooks.go:28 +0x91
github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.(*Entry).fireHooks(0xc010813080)
         /home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/entry.go:234 +0x8c
github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.Entry.log(0xc000144ba0, 0xc01082f0b0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
         /home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/entry.go:212 +0xf6
github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.(*Entry).Log(0xc010813020, 0x2, 0xc010245a98, 0x1, 0x1)
         /home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/entry.go:256 +0xb7
github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.(*Entry).Error(0xc010813020, 0xc010245a98, 0x1, 0x1)
         /home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/entry.go:285 +0x51
github.com/Fantom-foundation/go-lachesis/src/node.(*Core).RunConsensus(0xc000249560, 0xc311e6205, 0x13dcbe0)
         /home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/src/node/core.go:561 +0x810
github.com/Fantom-foundation/go-lachesis/src/node.(*Node).sync(0xc0001f4690, 0xc0103f0900, 0xb, 0xd, 0xc00ff58658, 0x8)
         /home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/src/node/node.go:615 +0x1b4
github.com/Fantom-foundation/go-lachesis/src/node.(*Node).processEagerSyncRequest(0xc0001f4690, 0xc0107da4b0, 0xc010758780)
         /home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/src/node/node.go:335 +0x26e
github.com/Fantom-foundation/go-lachesis/src/node.(*Node).processRPC(0xc0001f4690, 0xc0107da4b0)
         /home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/src/node/node.go:261 +0x1ea
github.com/Fantom-foundation/go-lachesis/src/node.(*Node).lachesis.func1()
         /home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/src/node/node.go:230 +0xa2
github.com/Fantom-foundation/go-lachesis/src/node.(*nodeState2).goFunc.func1(0xc000080740, 0xc010758da0)
         /home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/src/node/state.go:70 +0x5b
created by github.com/Fantom-foundation/go-lachesis/src/node.(*nodeState2).goFunc
         /home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/src/node/state.go:65 +0x49
"

The error seems happens in ApplyInternalTransactions() function introduced in pull-request #137 as additional debug output shows.

time="2019-01-31T09:38:53+11:00" level=warning msg="** Making Frame @ round received: 2" id=18316840364296702241
time="2019-01-31T09:38:53+11:00" level=warning msg="** MakeFRame p.ApplyInternalTransactions err: Frame, frame_000000001, Not Found" id=18316840364296702241
time="2019-01-31T09:38:53+11:00" level=error msg="c.poset.ProcessDecidedRounds()" Error="getting Frame 2: Frame, frame_000000001, Not Found" id=18316840364296702241 z_trace="goroutine 710 [running]:\ngithub.com/Fantom-foundation/go-lachesis/src/log.(*Hook).Fire(0xc0001cc360, 0xc010813080, 0x0, 0x0)\n\t/home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/src/log/hook.go:97 +0x18f\ngithub.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.LevelHooks.Fire(0xc000147b60, 0x2, 0xc010813080, 0x1e7be52cb270, 0xc02e33d8c5)\n\t/home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/hooks.go:28 +0x91\ngithub.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.(*Entry).fireHooks(0xc010813080)\n\t/home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/entry.go:234 +0x8c\ngithub.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.Entry.log(0xc000144ba0, 0xc01082f0b0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)\n\t/home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/entry.go:212 +0xf6\ngithub.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.(*Entry).Log(0xc010813020, 0x2, 0xc010245a98, 0x1, 0x1)\n\t/home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/entry.go:256 +0xb7\ngithub.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.(*Entry).Error(0xc010813020, 0xc010245a98, 0x1, 0x1)\n\t/home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/entry.go:285 +0x51\ngithub.com/Fantom-foundation/go-lachesis/src/node.(*Core).RunConsensus(0xc000249560, 0xc311e6205, 0x13dcbe0)\n\t/home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/src/node/core.go:561 +0x810\ngithub.com/Fantom-foundation/go-lachesis/src/node.(*Node).sync(0xc0001f4690, 0xc0103f0900, 0xb, 0xd, 0xc00ff58658, 0x8)\n\t/home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/src/node/node.go:615 +0x1b4\ngithub.com/Fantom-foundation/go-lachesis/src/node.(*Node).processEagerSyncRequest(0xc0001f4690, 0xc0107da4b0, 0xc010758780)\n\t/home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/src/node/node.go:335 +0x26e\ngithub.com/Fantom-foundation/go-lachesis/src/node.(*Node).processRPC(0xc0001f4690, 0xc0107da4b0)\n\t/home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/src/node/node.go:261 +0x1ea\ngithub.com/Fantom-foundation/go-lachesis/src/node.(*Node).lachesis.func1()\n\t/home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/src/node/node.go:230 +0xa2\ngithub.com/Fantom-foundation/go-lachesis/src/node.(*nodeState2).goFunc.func1(0xc000080740, 0xc010758da0)\n\t/home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/src/node/state.go:70 +0x5b\ncreated by github.com/Fantom-foundation/go-lachesis/src/node.(*nodeState2).goFunc\n\t/home/maxime/go/src/github.com/Fantom-foundation/go-lachesis/src/node/state.go:65 +0x49\n"

I am using the following command to run 3-node lachesis:

n=3 entry=main logshold=-1,-1,-1,85,0,0 BUILD_DIR="$PWD" ./scripts/multi.bash

The patch adding more debug output is bellow:

diff --git a/src/poset/poset.go b/src/poset/poset.go
index 8b5a368..2cf4281 100644
--- a/src/poset/poset.go
+++ b/src/poset/poset.go
@@ -10,11 +10,11 @@ import (
 	"sort"
 	"sync"
 
-	"github.com/hashicorp/golang-lru"
+	lru "github.com/hashicorp/golang-lru"
 	"github.com/sirupsen/logrus"
 
 	"github.com/Fantom-foundation/go-lachesis/src/common"
-	"github.com/Fantom-foundation/go-lachesis/src/log"
+	lachesis_log "github.com/Fantom-foundation/go-lachesis/src/log"
 	"github.com/Fantom-foundation/go-lachesis/src/peers"
 	"github.com/Fantom-foundation/go-lachesis/src/state"
 )
@@ -1363,6 +1363,7 @@ func (p *Poset) GetFrame(roundReceived int64) (Frame, error) {
 	// Try to get it from the Store first
 	frame, err := p.Store.GetFrame(roundReceived)
 	if err == nil || !common.Is(err, common.KeyNotFound) {
+		p.logger.Warnf("** p.Store.GetFrame err: %v", err)
 		return frame, err
 	}
 	// otherwise make new
@@ -1372,8 +1373,10 @@ func (p *Poset) GetFrame(roundReceived int64) (Frame, error) {
 // MakeFrame computes the Frame corresponding to a RoundReceived.
 func (p *Poset) MakeFrame(roundReceived int64) (Frame, error) {
 	// Get the Round and corresponding consensus Events
+	p.logger.Warnf("** Making Frame @ round received: %d", roundReceived)
 	round, err := p.Store.GetRoundReceived(roundReceived)
 	if err != nil {
+		p.logger.Warnf("** MakeFrame pStore.GetRoundReceived err: %v", err)
 		return Frame{}, err
 	}
 
@@ -1383,6 +1386,7 @@ func (p *Poset) MakeFrame(roundReceived int64) (Frame, error) {
 		hash.Set(eh)
 		e, err := p.Store.GetEventBlock(hash)
 		if err != nil {
+			p.logger.Warnf("** MakeFrame p.Store.GetEventBlock err: %v", err)
 			return Frame{}, err
 		}
 		events = append(events, e)
@@ -1392,6 +1396,7 @@ func (p *Poset) MakeFrame(roundReceived int64) (Frame, error) {
 
 	stateHash, err := p.ApplyInternalTransactions(roundReceived, events)
 	if err != nil {
+		p.logger.Warnf("** MakeFRame p.ApplyInternalTransactions err: %v", err)
 		return Frame{}, err
 	}
 
@@ -1404,6 +1409,7 @@ func (p *Poset) MakeFrame(roundReceived int64) (Frame, error) {
 		if _, ok := roots[c]; !ok {
 			root, err := p.createRoot(ev)
 			if err != nil {
+				p.logger.Warnf("** MakeFrame p.createRoot err: %v", err)
 				return Frame{}, err
 			}
 			roots[ev.GetCreator()] = root
@@ -1424,6 +1430,7 @@ func (p *Poset) MakeFrame(roundReceived int64) (Frame, error) {
 			var root Root
 			lastConsensusEventHash, isRoot, err := p.Store.LastConsensusEventFrom(peer)
 			if err != nil {
+				p.logger.Warnf("** MakeFRame p.Store.LastConsensusEventFrom err: %v", err)
 				return Frame{}, err
 			}
 			if isRoot {
@@ -1431,10 +1438,12 @@ func (p *Poset) MakeFrame(roundReceived int64) (Frame, error) {
 			} else {
 				lastConsensusEvent, err := p.Store.GetEventBlock(lastConsensusEventHash)
 				if err != nil {
+					p.logger.Warnf("** MakeFrame p.Store.GetEventBlock err: %v", err)
 					return Frame{}, err
 				}
 				root, err = p.createRoot(lastConsensusEvent)
 				if err != nil {
+					p.logger.Warnf("** MakeFrame p.createRoot 2 err:", err)
 					return Frame{}, err
 				}
 			}
@@ -1460,6 +1469,7 @@ func (p *Poset) MakeFrame(roundReceived int64) (Frame, error) {
 				if !selfParent.Equal(roots[ev.GetCreator()].SelfParent.Hash) {
 					other, err := p.createOtherParentRootEvent(ev)
 					if err != nil {
+						p.logger.Warnf("** MakeFrame p.createOtherParentRootEvent err:%v", err)
 						return Frame{}, err
 					}
 					roots[ev.GetCreator()].Others[hash.String()] = &other
@@ -1485,6 +1495,7 @@ func (p *Poset) MakeFrame(roundReceived int64) (Frame, error) {
 	}
 
 	if err := p.Store.SetFrame(res); err != nil {
+		p.logger.Warnf("** MakeFrame p.Store.SetFrame err:", err)
 		return Frame{}, err
 	}
 

Consensus lock out at 3+ nodes after constant transaction streaming

Describe the bug
Boot 3 nodes.
Attach a VM
Send transactions consistently (1/sec) to VM
After few minutes consensus will stop occurring

To Reproduce
Steps to reproduce the behavior:

  1. Boot 3 nodes.
  2. Attach a VM
  3. Send transactions consistently (1/sec) to VM
  4. After few minutes consensus will stop occurring

Expected behavior
Continue to reach consensus

EVM-lite

  • Refactor EVM to decouple Proxy
  • Create separate repo
  • Integrate Tendermint ABCI

Limit on grpc message size

I have tried lachesis version after #59 with CI/CD check script scripts/multi.bash and got a bunch of errors like these:

WARN[0036] recv from server err: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (48900172 vs. 4194304)
WARN[0036] recv from server err: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (48900172 vs. 4194304)
WARN[0036] recv from server err: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (48900172 vs. 4194304)

it looks like we are hitting here the default MaxReceiveMessageSize limitation in grpc: https://github.com/grpc/grpc-go/blob/master/clientconn.go#L96

Perhaps we need add limitation on block size in lachesis to fit inside this limit.

TestProccessSync Fails

Describe the bug
When this test is run alongside other tests in the package it fails (sometimes passes). I think this is because all the tests are running concurrently and competing for resources (ports). They pass when run individually.

--- FAIL: TestProcessSync (0.00s)
    test_logger.go:26: time="2018-11-01T13:43:58+11:00" level=info msg="Init Dummy State"
    test_logger.go:26: time="2018-11-01T13:43:58+11:00" level=debug msg="Initialize Node" peers="[127.0.0.1:9991 127.0.0.1:9990]" this_id=1225896496
    test_logger.go:26: time="2018-11-01T13:43:58+11:00" level=debug msg="SetHeadAndSeq()" core.Head=Root2920577368 core.Seq=-1 id=1225896496 is_root=true
    test_logger.go:26: time="2018-11-01T13:43:58+11:00" level=debug msg="RunAsync(gossip bool)" this_id=1225896496
    node_test.go:65: err: listen tcp 127.0.0.1:9990: bind: address already in use
    test_logger.go:26: time="2018-11-01T13:43:58+11:00" level=info msg=Listening addr="127.0.0.1:9991"
--- FAIL: TestProcessEagerSync (0.00s)
    test_logger.go:26: time="2018-11-01T13:43:58+11:00" level=info msg="Init Dummy State"
    test_logger.go:26: time="2018-11-01T13:43:58+11:00" level=info msg=Listening addr="127.0.0.1:9993"
    test_logger.go:26: time="2018-11-01T13:43:58+11:00" level=debug msg="Initialize Node" peers="[127.0.0.1:9993 127.0.0.1:9992]" this_id=2076346343
    test_logger.go:26: time="2018-11-01T13:43:58+11:00" level=debug msg="SetHeadAndSeq()" core.Head=Root2903273224 core.Seq=-1 id=2076346343 is_root=true
    test_logger.go:26: time="2018-11-01T13:43:58+11:00" level=debug msg="RunAsync(gossip bool)" this_id=2076346343
    node_test.go:161: err: listen tcp 127.0.0.1:9992: bind: address already in use

To Reproduce
Steps to reproduce the behavior:

  1. Clean test cache: go clean -testcache
  2. Run the tests: make test or go test -timeout 10s ./src/...
    Note: You may have to repeat the steps a couple of times, most of the times a test in the node package will fail, sometimes they pass

Expected behavior
The test should pass

Desktop (please complete the following information):

  • OS: Ubuntu 18.04

Block signature verification error

Soon after we run 3 node cluster we see the following error (I post here only head of the error message as the full log file is about 31M of size; the full log is attached in compressed form)

This is the same issue as noted here: #41

Could not load store - creating new
time="2018-10-15T00:27:37Z" level=info msg=Listening addr="192.168.0.5:12000"
Setting root 0x0410AE1E7472DF0C758354569F7725D622566B9E644463C933E244552C9B116C76ACF7F0C01CFE4D3A9E79F055C910ACBF1A42102B2A26E542FB64956A40B96E6B -> [48 120 48 52 49 48 65 69 49 69 55 52 55 50 68 70 48 67 55 53 56 51 53 52 53 54 57 70 55 55 50 53 68 54 50 50 53 54 54 66 57 69 54 52 52 52 54 51 67 57 51 51 69 50 52 52 53 53 50 67 57 66 49 49 54 67 55 54 65 67 70 55 70 48 67 48 49 67 70 69 52 68 51 65 57 69 55 57 70 48 53 53 67 57 49 48 65 67 66 70 49 65 52 50 49 48 50 66 50 65 50 54 69 53 52 50 70 66 54 52 57 53 54 65 52 48 66 57 54 69 54 66 95 114 111 111 116]
Setting root 0x04609B5461F930185E9BBCA696CA6B1022DF9C96F9B1CE87819224560130A5029906691D7EABBE0557C55348B74A046DCAF0108A90AB751CDC99F8797E88330C0F -> [48 120 48 52 54 48 57 66 53 52 54 49 70 57 51 48 49 56 53 69 57 66 66 67 65 54 57 54 67 65 54 66 49 48 50 50 68 70 57 67 57 54 70 57 66 49 67 69 56 55 56 49 57 50 50 52 53 54 48 49 51 48 65 53 48 50 57 57 48 54 54 57 49 68 55 69 65 66 66 69 48 53 53 55 67 53 53 51 52 56 66 55 52 65 48 52 54 68 67 65 70 48 49 48 56 65 57 48 65 66 55 53 49 67 68 67 57 57 70 56 55 57 55 69 56 56 51 51 48 67 48 70 95 114 111 111 116]
Setting root 0x043DFC59DFC928E0108BE1280D6C54F1763B11C64F77CD43AE6A636E5E3A7C1824A122C7893A67AD3635A076B3A2DD6AD00C27CBF7D343E12684CAA34E4344F06F -> [48 120 48 52 51 68 70 67 53 57 68 70 67 57 50 56 69 48 49 48 56 66 69 49 50 56 48 68 54 67 53 52 70 49 55 54 51 66 49 49 67 54 52 70 55 55 67 68 52 51 65 69 54 65 54 51 54 69 53 69 51 65 55 67 49 56 50 52 65 49 50 50 67 55 56 57 51 65 54 55 65 68 51 54 51 53 65 48 55 54 66 51 65 50 68 68 54 65 68 48 48 67 50 55 67 66 70 55 68 51 52 51 69 49 50 54 56 52 67 65 65 51 52 69 52 51 52 52 70 48 54 70 95 114 111 111 116]
PingNodesN::participants:  [0xc00010b5f0 0xc00010b620 0xc00010b530]
PingNodesN::p:  map[0x043DFC59DFC928E0108BE1280D6C54F1763B11C64F77CD43AE6A636E5E3A7C1824A122C7893A67AD3635A076B3A2DD6AD00C27CBF7D343E12684CAA34E4344F06F:0xc00010b5f0 0x0410AE1E7472DF0C758354569F7725D622566B9E644463C933E244552C9B116C76ACF7F0C01CFE4D3A9E79F055C910ACBF1A42102B2A26E542FB64956A40B96E6B:0xc00010b620 0x04609B5461F930185E9BBCA696CA6B1022DF9C96F9B1CE87819224560130A5029906691D7EABBE0557C55348B74A046DCAF0108A90AB751CDC99F8797E88330C0F:0xc00010b530]
time="2018-10-15T00:27:41Z" level=info msg=Dialing target="192.168.0.4:12000" timeout=1s
time="2018-10-15T00:27:41Z" level=warning msg="failed to get parent: %sEvent, Root2561334434, Not Found" id=2561334434
time="2018-10-15T00:27:41Z" level=warning msg="failed to get  other parent: %sKey cannot be empty" id=2561334434
time="2018-10-15T00:27:42Z" level=warning msg="logStats()" consensus_events=0 consensus_transactions=0 events/s=0.00 id=2561334434 last_block_index=-1 last_consensus_round=nil num_peers=3 round_events=0 rounds/s=0.00 state=Gossiping sync_rate=1.00 t/s=0.00 this_id=2561334434 transaction_pool=1400 undetermined_events=1
time="2018-10-15T00:27:49Z" level=info msg="accepted connection" from="192.168.0.3:47636" node="192.168.0.5:12000"
time="2018-10-15T00:27:49Z" level=info msg=Dialing target="192.168.0.3:12000" timeout=1s
time="2018-10-15T00:27:50Z" level=error msg="n.sync(resp.Events)" error="CheckSelfParent: Self-parent not last known event by creator" this_id=2561334434
time="2018-10-15T00:27:51Z" level=info msg="accepted connection" from="192.168.0.4:39612" node="192.168.0.5:12000"
time="2018-10-15T00:27:55Z" level=warning msg="failed to get  other parent: %sKey cannot be empty" id=2561334434
time="2018-10-15T00:27:56Z" level=error msg="n.requestEagerSync(peerAddr, wireEvents)" Error="read tcp 192.168.0.5:59062->192.168.0.3:12000: i/o timeout" this_id=2561334434
time="2018-10-15T00:27:56Z" level=info msg="accepted connection" from="192.168.0.3:49878" node="192.168.0.5:12000"
time="2018-10-15T00:28:01Z" level=info msg=Dialing target="192.168.0.3:12000" timeout=1s
time="2018-10-15T00:28:02Z" level=warning msg="logStats()" consensus_events=0 consensus_transactions=0 events/s=0.00 id=2561334434 last_block_index=-1 last_consensus_round=0 num_peers=3 round_events=0 rounds/s=0.00 state=Gossiping sync_rate=1.00 t/s=0.00 this_id=2561334434 transaction_pool=2500 undetermined_events=18
time="2018-10-15T00:28:05Z" level=warning msg="failed to get  other parent: %sKey cannot be empty" id=2561334434
time="2018-10-15T00:28:05Z" level=warning msg="logStats()" consensus_events=0 consensus_transactions=0 events/s=0.00 id=2561334434 last_block_index=-1 last_consensus_round=0 num_peers=3 round_events=0 rounds/s=0.00 state=Gossiping sync_rate=1.00 t/s=0.00 this_id=2561334434 transaction_pool=1100 undetermined_events=22
time="2018-10-15T00:28:12Z" level=warning msg="failed to get  other parent: %sKey cannot be empty" id=2561334434
time="2018-10-15T00:28:13Z" level=warning msg="logStats()" consensus_events=0 consensus_transactions=0 events/s=0.00 id=2561334434 last_block_index=-1 last_consensus_round=0 num_peers=3 round_events=0 rounds/s=0.00 state=Gossiping sync_rate=1.00 t/s=0.00 this_id=2561334434 transaction_pool=1937 undetermined_events=26
time="2018-10-15T00:28:20Z" level=warning msg="Verifying Block signature. Invalid signature" block="{{0 1 [] [188 139 81 237 76 125 222 190 255 129 71 178 120 249 208 8 210 170 149 238 91 208 164 122 121 65 38 57 247 113 102 147] [[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] [0 0 0 0 0 0 0 0 0 0 0 ...

00-block-signature-err.zip

[test] Fix TestConsensus: length of consensus should be 6 not 0

Describe the bug
Commit b83d9e6 broke the tests.

To Reproduce
Step to reproduce the behavior:
make test

Expected behavior
No failed tests.

Screenshots

$ make test
glide novendor | grep -v -e "^\.$" | xargs go test -timeout 45s
?       github.com/andrecronje/lachesis/cmd/dummy       [no test files]
?       github.com/andrecronje/lachesis/cmd/dummy/commands      [no test files]
?       github.com/andrecronje/lachesis/cmd/dummy_client        [no test files]
?       github.com/andrecronje/lachesis/cmd/lachesis    [no test files]
?       github.com/andrecronje/lachesis/cmd/lachesis/commands   [no test files]
?       github.com/andrecronje/lachesis/tester  [no test files]
ok      github.com/andrecronje/lachesis/src/common      (cached)
ok      github.com/andrecronje/lachesis/src/crypto      (cached)
ok      github.com/andrecronje/lachesis/src/dummy       (cached)
?       github.com/andrecronje/lachesis/src/lachesis    [no test files]
?       github.com/andrecronje/lachesis/src/log [no test files]
?       github.com/andrecronje/lachesis/src/mobile      [no test files]
ok      github.com/andrecronje/lachesis/src/net (cached)
--- FAIL: TestConsensus (0.01s)
    core_test.go:716: length of consensus should be 6 not 0
--- FAIL: TestConsensusFF (0.01s)
    core_test.go:843: Cores[1] last consensus Round should be 1, not nil
--- FAIL: TestCoreFastForward (0.01s)
    core_test.go:878: BlockCache, 0, Not Found
FAIL
FAIL    github.com/andrecronje/lachesis/src/node        9.934s
?       github.com/andrecronje/lachesis/src/pb  [no test files]
ok      github.com/andrecronje/lachesis/src/peers       (cached)
ok      github.com/andrecronje/lachesis/src/poset       (cached)
ok      github.com/andrecronje/lachesis/src/proxy       (cached)
?       github.com/andrecronje/lachesis/src/proxy/internal      [no test files]
?       github.com/andrecronje/lachesis/src/proxy/proto [no test files]
?       github.com/andrecronje/lachesis/src/service     [no test files]
?       github.com/andrecronje/lachesis/src/utils       [no test files]
?       github.com/andrecronje/lachesis/src/version     [no test files]
make: *** [test] Error 123

[test] Fix TestConsensusFF: Cores[1] last consensus Round should be 1, not nil

Describe the bug
Commit b83d9e6 broke the tests.

To Reproduce
Step to reproduce the behavior:
make test

Expected behavior
No failed tests.

Screenshots

$ make test
glide novendor | grep -v -e "^\.$" | xargs go test -timeout 45s
?       github.com/andrecronje/lachesis/cmd/dummy       [no test files]
?       github.com/andrecronje/lachesis/cmd/dummy/commands      [no test files]
?       github.com/andrecronje/lachesis/cmd/dummy_client        [no test files]
?       github.com/andrecronje/lachesis/cmd/lachesis    [no test files]
?       github.com/andrecronje/lachesis/cmd/lachesis/commands   [no test files]
?       github.com/andrecronje/lachesis/tester  [no test files]
ok      github.com/andrecronje/lachesis/src/common      (cached)
ok      github.com/andrecronje/lachesis/src/crypto      (cached)
ok      github.com/andrecronje/lachesis/src/dummy       (cached)
?       github.com/andrecronje/lachesis/src/lachesis    [no test files]
?       github.com/andrecronje/lachesis/src/log [no test files]
?       github.com/andrecronje/lachesis/src/mobile      [no test files]
ok      github.com/andrecronje/lachesis/src/net (cached)
--- FAIL: TestConsensus (0.01s)
    core_test.go:716: length of consensus should be 6 not 0
--- FAIL: TestConsensusFF (0.01s)
    core_test.go:843: Cores[1] last consensus Round should be 1, not nil
--- FAIL: TestCoreFastForward (0.01s)
    core_test.go:878: BlockCache, 0, Not Found
FAIL
FAIL    github.com/andrecronje/lachesis/src/node        9.934s
?       github.com/andrecronje/lachesis/src/pb  [no test files]
ok      github.com/andrecronje/lachesis/src/peers       (cached)
ok      github.com/andrecronje/lachesis/src/poset       (cached)
ok      github.com/andrecronje/lachesis/src/proxy       (cached)
?       github.com/andrecronje/lachesis/src/proxy/internal      [no test files]
?       github.com/andrecronje/lachesis/src/proxy/proto [no test files]
?       github.com/andrecronje/lachesis/src/service     [no test files]
?       github.com/andrecronje/lachesis/src/utils       [no test files]
?       github.com/andrecronje/lachesis/src/version     [no test files]
make: *** [test] Error 123

syn request timeout error

Run multiple nodes (15+) nodes. Got the timeout issue on sync. Two errors occur multiple times in the log:


time="2018-11-27T10:57:27+11:00" level=error msg="n.requestSync(peerAddr, knownEvents)" Error="read tcp 127.0.0.1:47930->127.0.0.1:12011: i/o timeout" this_id=828847531 z_trace="goroutine 20465 [running]:\ngithub.com/Fantom-foundation/go-lachesis/src/log.(*Hook).Fire(0xc0001a6ea0, 0xc0611e3f80, 0x0, 0x0)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/src/log/hook.go:97 +0x18f\ngithub.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.LevelHooks.Fire(0xc0001bdd70, 0x2, 0xc0611e3f80, 0xe0aa055c06af, 0xc004b0aad6)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/hooks.go:28 +0x91\ngithub.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.(*Entry).fireHooks(0xc0611e3f80)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/entry.go:223 +0x8c\ngithub.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.Entry.log(0xc00010d740, 0xc05457bf80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/entry.go:201 +0xf6\ngithub.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.(*Entry).Error(0xc0611e3f20, 0xc0590a9d20, 0x1, 0x1)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/entry.go:277 +0xae\ngithub.com/Fantom-foundation/go-lachesis/src/node.(*Node).pull(0xc04eabc000, 0xc000023830, 0xf, 0x0, 0x0, 0xc000000005, 0xc05e16d500)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/src/node/node.go:403 +0x2fd\ngithub.com/Fantom-foundation/go-lachesis/src/node.(*Node).gossip(0xc04eabc000, 0xc000023830, 0xf, 0xc04eebcf60, 0xa, 0xc0006f27b0)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/src/node/node.go:358 +0x49\ngithub.com/Fantom-foundation/go-lachesis/src/node.(*Node).lachesis.func2()\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/src/node/node.go:211 +0x49\ngithub.com/Fantom-foundation/go-lachesis/src/node.(*nodeState).goFunc.func1(0xc04eabc000, 0xc09e1a91a0)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/src/node/state.go:53 +0x53\ncreated by github.com/Fantom-foundation/go-lachesis/src/node.(*nodeState).goFunc\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/src/node/state.go:51 +0x66\n"


time="2018-11-27T10:57:29+11:00" level=error msg="Failed to decode incoming command" error="write tcp 127.0.0.1:12015->127.0.0.1:49216: write: broken pipe" z_trace="goroutine 13832 [running]:\ngithub.com/Fantom-foundation/go-lachesis/src/log.(*Hook).Fire(0xc0001a6fc0, 0xc05c2f8fc0, 0x0, 0x0)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/src/log/hook.go:97 +0x18f\ngithub.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.LevelHooks.Fire(0xc0003103f0, 0x2, 0xc05c2f8fc0, 0xe0aaa592e6d7, 0xc02db1f68d)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/hooks.go:28 +0x91\ngithub.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.(*Entry).fireHooks(0xc05c2f8fc0)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/entry.go:223 +0x8c\ngithub.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.Entry.log(0xc00010d980, 0xc098711f80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/entry.go:201 +0xf6\ngithub.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.(*Entry).Error(0xc05c2f8f00, 0xc098fe5f00, 0x1, 0x1)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/entry.go:277 +0xae\ngithub.com/Fantom-foundation/go-lachesis/src/net.(*NetworkTransport).handleConn(0xc04e875260, 0xc51a00, 0xc0689d4648)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/src/net/net_transport.go:336 +0x3ad\ncreated by github.com/Fantom-foundation/go-lachesis/src/net.(*NetworkTransport).listen\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/src/net/net_transport.go:320 +0x440\n"

Subscriber based block subscription

Current proxy connection is a synchronous between two endpoints, change to a subscription based MQTT/WS model to facilitate block/transaction transfers

gRPC

Describe the solution you'd like
gRPC implementation

Join process via consensus

Nodes are currently a fixed peer list, allow new nodes to join via consensus agreement of all participants using the same poset graph

unknown rpc type 10 error

Run on multi nodes (5+ nodes). Got an intermittent error given below:

=====
ERRO[0040] Failed to decode incoming command error="unknown rpc type 10" z_trace="goroutine 257 [running]:\ngithub.com/Fantom-foundation/go-lachesis/src/log.(*Hook).Fire(0xc0001d41b0, 0xc01b496d80, 0x0, 0x0)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/src/log/hook.go:97 +0x18f\ngithub.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.LevelHooks.Fire(0xc0001c2810, 0x2, 0xc01b496d80, 0xdebf11696fe1, 0xc00ed90d03)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/hooks.go:28 +0x91\ngithub.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.(*Entry).fireHooks(0xc01b496d80)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/entry.go:223 +0x8c\ngithub.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.Entry.log(0xc000127080, 0xc01b4a47e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/entry.go:201 +0xf6\ngithub.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus.(*Entry).Error(0xc01b496d20, 0xc01a4bff00, 0x1, 0x1)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/vendor/github.com/sirupsen/logrus/entry.go:277 +0xae\ngithub.com/Fantom-foundation/go-lachesis/src/net.(*NetworkTransport).handleConn(0xc0000adc80, 0xc51a00, 0xc0000aa300)\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/src/net/net_transport.go:336 +0x3ad\ncreated by github.com/Fantom-foundation/go-lachesis/src/net.(*NetworkTransport).listen\n\t/home/qn/work/src/github.com/Fantom-foundation/go-lachesis/src/net/net_transport.go:320 +0x440\n"

CheckSelfParent not matching results

Describe the bug
DEBU[0008] checkSelfParent

creator=0x0419E735BA4250C0C143E9276BDB1758BCD746730DFE0846DE4F2040D0F1A12B1E50B3527A198F3C8EBBF74E4EA94D3F42334B9FAC4C20F355D2ADEE9C59A5E114
creatorLastKnown=0xFBA5CB84D56B5C57CBD9E24982137FC39156BE0E07CE3CDADAA343DC7958E730
id=513203061
selfParent=0xEDD51D57701CAFED90A31D6C79B4DD3B94334D57DAFFEBB10085278E1AE86D45

Add height vector to storage

Create a height vector array for each node to keep track of the current height index of each peer participant

Generation of event.pb.go requires modification to compile

To Reproduce
Steps to reproduce the behavior:

  1. Run protoc --proto_path=src/poset/ --go_out=paths=source_relative:./src/poset src/poset/*.proto to compile the protobuffer files
  2. Try to compile: make build
  3. See error

Expected behavior
The generation of go code should compile.

Additional context
The problem is that Event requires a protobuffer message in another package, Peer. In order to make it compile, it's necessary to add github.com/andrecronje/lachesis/src/peers as an import and then substitute all the Peer with peers.Peer in the file event.pb.go. Because Peer it's also sent, we have a peer.proto file, but it's in the poset package.

Possible solution to try:

  1. Move the peer.proto file to src/peers.
  2. Run protoc --proto_path=src/poset/ --proto_path=src/peers/ --go_out=paths=source_relative:./src/poset src/poset/*.proto.
  3. Check to see if it compiles now.

Unknown wevent.Body.CreatorID=0

Describe the bug
When I set cache size to 100 for lachesis store with the flag --cache-size=100 I get bunch of the following errors:

goroutine 11078 [running]:
runtime/debug.Stack(0xc058e660c0, 0xc111e85a68, 0x42bbb2)
        /usr/local/go/src/runtime/debug/stack.go:24 +0xa7
runtime/debug.PrintStack()
        /usr/local/go/src/runtime/debug/stack.go:16 +0x22
github.com/andrecronje/lachesis/src/log.(*Hook).Fire(0xc000340120, 0xc0593fac00, 0x0, 0x0)
        /home/ubuntu/go/src/github.com/andrecronje/lachesis/src/log/hook.go:96 +0x133
github.com/andrecronje/lachesis/vendor/github.com/sirupsen/logrus.LevelHooks.Fire(0xc00013d230, 0x2, 0xc0593fac00, 0x476be466517f, 0xc015cad9f5)
        /home/ubuntu/go/src/github.com/andrecronje/lachesis/vendor/github.com/sirupsen/logrus/hooks.go:28 +0x91
github.com/andrecronje/lachesis/vendor/github.com/sirupsen/logrus.(*Entry).fireHooks(0xc0593fac00)
        /home/ubuntu/go/src/github.com/andrecronje/lachesis/vendor/github.com/sirupsen/logrus/entry.go:223 +0x8c
github.com/andrecronje/lachesis/vendor/github.com/sirupsen/logrus.Entry.log(0xc00007c780, 0xc0eff61170, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/ubuntu/go/src/github.com/andrecronje/lachesis/vendor/github.com/sirupsen/logrus/entry.go:201 +0xf6
github.com/andrecronje/lachesis/vendor/github.com/sirupsen/logrus.(*Entry).Error(0xc0593fa7e0, 0xc111e85d38, 0x1, 0x1)
        /home/ubuntu/go/src/github.com/andrecronje/lachesis/vendor/github.com/sirupsen/logrus/entry.go:277 +0xae
github.com/andrecronje/lachesis/src/node.(*Node).processEagerSyncRequest(0xc058ec82a0, 0xbf3400, 0xc071bbf480, 0x0, 0x0, 0xc059a8a300, 0xc071bbf480)
        /home/ubuntu/go/src/github.com/andrecronje/lachesis/src/node/node.go:304 +0x322
github.com/andrecronje/lachesis/src/node.(*Node).processRPC(0xc058ec82a0, 0xbf3400, 0xc071bbf480, 0x0, 0x0, 0xc059a8a300)
        /home/ubuntu/go/src/github.com/andrecronje/lachesis/src/node/node.go:227 +0x1e8
github.com/andrecronje/lachesis/src/node.(*Node).lachesis.func1()
        /home/ubuntu/go/src/github.com/andrecronje/lachesis/src/node/node.go:204 +0xa6
github.com/andrecronje/lachesis/src/node.(*nodeState).goFunc.func1(0xc058ec82a0, 0xc14c5b4340)
        /home/ubuntu/go/src/github.com/andrecronje/lachesis/src/node/state.go:53 +0x53
created by github.com/andrecronje/lachesis/src/node.(*nodeState).goFunc
        /home/ubuntu/go/src/github.com/andrecronje/lachesis/src/node/state.go:51 +0x66
time="2018-11-08T04:13:12Z" level=error msg="n.sync(cmd.Events)" error="Unknown wevent.Body.CreatorID=0" this_id=855157020


There no such errors with default value of cache size (500).

To Reproduce
Steps to reproduce the behavior:

  1. Add --cache-size=100 switch to lachesis run switches in scripts/multi_run.bash
  2. Run multi-node lachesis:
    n=7 entry=main logshold=-1,-1,-1,85,0,0 BUILD_DIR="$PWD" ./scripts/multi.bash
  3. wait until these errors appear
  • OS: Ubuntu 18.04
  • lachesis at d474e03

Change all `int` that will be marshelled into int64 or int32

Describe the bug
While working on #55, I noticed something problematic: A bunch of the structures that are being serialized to be later transmitted in the net are using type int. This is bad, since int is an alias for the architecture of the cpu. Not specifying it may cause problems if a node is running in a 32-bit machine while another one is running in a 64-bit machine. Furthermore, it adds complexity in the process of switching between different serialization methods, since of them (correctly) force you to specify integer size (like protobuf).

Expected behavior
All int types in structures that are going to be sent in the web should be changed to use int64 or int32 instead.

Additional context
I'm currently doing a first step on this as part of #55, but I'm trying to change the bare minimum to have that functionality working. My implementation will lay down the first steps, but we have to move further once that's merged.

Proof-of-Stake

Describe the solution you'd like

  • Reserve SmartContract as part of the Genesis block (it can be empty at this stage)
  • Implement built-in emission
  • Find link between EVM and transaction fees. Rewire this logic to channel transaction fees towards block rewards
  • Distribute rewards to validators and reserve SmartContract. Keep it extensible because we will introduce weights later
  • Further specify and document the PoS logic
  • Write a set of SmartContracts to control the list of validators and their ‘bonded stakes’ (bonding, unbonding, slashing)
  • Link between this SmartContract logic and consensus participant set
  • Update Block rewards to distribute rewards proportionately to stake
  • Add support for dynamic validator set

[test] Fix TestCoreFastForward: BlockCache, 0, Not Found

Describe the bug
Commit b83d9e6 broke the tests.

To Reproduce
Step to reproduce the behavior:
make test

Expected behavior
No failed tests.

Screenshots

$ make test
glide novendor | grep -v -e "^\.$" | xargs go test -timeout 45s
?       github.com/andrecronje/lachesis/cmd/dummy       [no test files]
?       github.com/andrecronje/lachesis/cmd/dummy/commands      [no test files]
?       github.com/andrecronje/lachesis/cmd/dummy_client        [no test files]
?       github.com/andrecronje/lachesis/cmd/lachesis    [no test files]
?       github.com/andrecronje/lachesis/cmd/lachesis/commands   [no test files]
?       github.com/andrecronje/lachesis/tester  [no test files]
ok      github.com/andrecronje/lachesis/src/common      (cached)
ok      github.com/andrecronje/lachesis/src/crypto      (cached)
ok      github.com/andrecronje/lachesis/src/dummy       (cached)
?       github.com/andrecronje/lachesis/src/lachesis    [no test files]
?       github.com/andrecronje/lachesis/src/log [no test files]
?       github.com/andrecronje/lachesis/src/mobile      [no test files]
ok      github.com/andrecronje/lachesis/src/net (cached)
--- FAIL: TestConsensus (0.01s)
    core_test.go:716: length of consensus should be 6 not 0
--- FAIL: TestConsensusFF (0.01s)
    core_test.go:843: Cores[1] last consensus Round should be 1, not nil
--- FAIL: TestCoreFastForward (0.01s)
    core_test.go:878: BlockCache, 0, Not Found
FAIL
FAIL    github.com/andrecronje/lachesis/src/node        9.934s
?       github.com/andrecronje/lachesis/src/pb  [no test files]
ok      github.com/andrecronje/lachesis/src/peers       (cached)
ok      github.com/andrecronje/lachesis/src/poset       (cached)
ok      github.com/andrecronje/lachesis/src/proxy       (cached)
?       github.com/andrecronje/lachesis/src/proxy/internal      [no test files]
?       github.com/andrecronje/lachesis/src/proxy/proto [no test files]
?       github.com/andrecronje/lachesis/src/service     [no test files]
?       github.com/andrecronje/lachesis/src/utils       [no test files]
?       github.com/andrecronje/lachesis/src/version     [no test files]
make: *** [test] Error 123

Versioning protocol

Is your feature request related to a problem? Please describe.
Since we're allowing nodes to join—#8 #10—it would be cognisant on us to confirm the version of each node joining the network.

Describe the solution you'd like
To start with, let's force everyone joining to have the same version.

Describe alternatives you've considered
Later, we can do something more in depth, like in the SSH standard: https://tools.ietf.org/html/rfc4253#section-4.2

Additional context
Will also be handy to start versioning the code base, we've been on 0.3.2 for too long!

no Anchor Block in log

Describe the bug
Run 5 nodes. Got the following errors multiple times.

/home/qn/work/src/github.com/andrecronje/lachesis/cmd/lachesis/commands/run_lachesis_multi.go:49 +0x4a7
time="2018-11-12T21:03:59+11:00" level=error msg="n.requestFastForward(peer.NetAddr)" Error="no Anchor Block" this_id=3111831001

/home/qn/work/src/github.com/andrecronje/lachesis/src/node/state.go:51 +0x66
time="2018-11-12T21:03:59+11:00" level=error msg="n.core.GetAnchorBlockWithFrame()" error="no Anchor Block" this_id=945441204

To Reproduce
Run tests with 5 nodes

** OS **
Ubuntu 1, 64 bit

Bug: ey.firstDescendants[] is empty

When running large number of nodes

github.com/andrecronje/lachesis/src/node.(*nodeState).goFunc.func1(0xc0831e69a0, 0xc0eab61520)
/home/qn/work/src/github.com/andrecronje/lachesis/src/node/state.go:53 +0x53
created by github.com/andrecronje/lachesis/src/node.(*nodeState).goFunc
/home/qn/work/src/github.com/andrecronje/lachesis/src/node/state.go:51 +0x66
ERRO[0092] n.sync(resp.Events) error="ey.firstDescendants[] is empty" this_id=3568870598

tests on ./src/net/client_websocket_test.go timeout

Describe the bug
If you type:

go test ./src/net/...

If you wait long enough, you get:

SIGQUIT: quit
PC=0x45f9f1 m=0 sigcode=0

goroutine 0 [idle]:
runtime.futex(0xfcb980, 0x80, 0x0, 0x0, 0x0, 0x7ffe00000000, 0x0, 0x0, 0x7ffeea230f08, 0x40c472, ...)
	/opt/go/src/runtime/sys_linux_amd64.s:531 +0x21
runtime.futexsleep(0xfcb980, 0x7ffe00000000, 0xffffffffffffffff)
	/opt/go/src/runtime/os_linux.go:46 +0x4b
runtime.notesleep(0xfcb980)
	/opt/go/src/runtime/lock_futex.go:151 +0xa2
runtime.stoplockedm()
	/opt/go/src/runtime/proc.go:2165 +0x8a
runtime.schedule()
	/opt/go/src/runtime/proc.go:2565 +0x2d9
runtime.park_m(0xc0001ae300)
	/opt/go/src/runtime/proc.go:2676 +0xae
runtime.mcall(0x0)
	/opt/go/src/runtime/asm_amd64.s:299 +0x5b

goroutine 1 [chan receive]:
testing.(*T).Run(0xc0001b6100, 0xae2158, 0x13, 0xafe670, 0x47d816)
	/opt/go/src/testing/testing.go:879 +0x37a
testing.runTests.func1(0xc0001b6000)
	/opt/go/src/testing/testing.go:1119 +0x78
testing.tRunner(0xc0001b6000, 0xc000165e08)
	/opt/go/src/testing/testing.go:827 +0xbf
testing.runTests(0xc00018e0a0, 0xfc1280, 0xd, 0xd, 0x40d71f)
	/opt/go/src/testing/testing.go:1117 +0x2aa
testing.(*M).Run(0xc000196180, 0x0)
	/opt/go/src/testing/testing.go:1034 +0x165
main.main()
	_testmain.go:66 +0x13d

goroutine 34 [syscall]:
os/signal.signal_recv(0x0)
	/opt/go/src/runtime/sigqueue.go:139 +0x9c
os/signal.loop()
	/opt/go/src/os/signal/signal_unix.go:23 +0x22
created by os/signal.init.0
	/opt/go/src/os/signal/signal_unix.go:29 +0x41

goroutine 35 [chan receive]:
github.com/andrecronje/lachesis/src/net.TestClientWebSocket(0xc0001b6100)
	/opt/go/src/github.com/andrecronje/lachesis/src/net/client_websocket_test.go:79 +0x282
testing.tRunner(0xc0001b6100, 0xafe670)
	/opt/go/src/testing/testing.go:827 +0xbf
created by testing.(*T).Run
	/opt/go/src/testing/testing.go:878 +0x353

rax    0xca
rbx    0xfcb840
rcx    0x45f9f3
rdx    0x0
rdi    0xfcb980
rsi    0x80
rbp    0x7ffeea230ed0
rsp    0x7ffeea230e88
r8     0x0
r9     0x0
r10    0x0
r11    0x286
r12    0xc
r13    0xff
r14    0xb907b6
r15    0x0
rip    0x45f9f1
rflags 0x286
cs     0x33
fs     0x0
gs     0x0
*** Test killed with quit: ran too long (10m0s).
FAIL	github.com/andrecronje/lachesis/src/net	600.005s

To Reproduce

See above.

Expected behavior
The test should finish (hopefully in less than a second).

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.