New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
full node UT #491
full node UT #491
Conversation
mesh/mesh.go
Outdated
func (m *Mesh) AddLayer(layer *Layer) error { | ||
m.lMutex.Lock() | ||
defer m.lMutex.Unlock() | ||
count := LayerID(m.LocalLayer()) | ||
count := LayerID(m.LatestSeenLayer()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change the name to something that indicates that we already received
like latestSynced/latestReceived or something
@@ -92,18 +130,51 @@ func (m *Mesh) AddLayer(layer *Layer) error { | |||
m.Debug("can't add layer", layer.Index(), " missing previous layers") | |||
return errors.New("can't add layer missing previous layers") | |||
} | |||
|
|||
atomic.StoreUint32(&m.lastSeenLayer, uint32(layer.Index())) | |||
m.addLayer(layer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
layer should be sent to verification as part of this method
@@ -92,18 +130,51 @@ func (m *Mesh) AddLayer(layer *Layer) error { | |||
m.Debug("can't add layer", layer.Index(), " missing previous layers") | |||
return errors.New("can't add layer missing previous layers") | |||
} | |||
|
|||
atomic.StoreUint32(&m.lastSeenLayer, uint32(layer.Index())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this basically overwrites lastSeenLayer which could be higher
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a check above that validates that this layer is exactly +1 from previous recevied
ad583a1
to
ac15451
Compare
54beed3
to
3acc142
Compare
fixed getting blocks for layer from layerDB and not from orphans unified all componenets into spacemeshApp, refactored tests to support multiple instances and written proper teardown added basic genesis block config passing UT with no real node tests after another merge added timeouts to sync tests after CR review removed -v from tests for debugging in travis
3acc142
to
f340ea5
Compare
app/main.go
Outdated
|
||
app.NodeInitCallback <- true | ||
app.P2P = swarm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this happens 3 times. in line 373 (which is probably the correct one since app.setupTestFeatures
already consumes app.P2P
.)
again here and again in initServices
hare/broker.go
Outdated
//if broker.inbox != nil { // Start has been called at least twice | ||
// log.Error("Could not start instance") | ||
// return StartInstanceError(errors.New("instance already started")) | ||
//} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can move registration back here and uncomment above code. the only rule is that protocols should register before swarm
is started.
hare/config/config.go
Outdated
@@ -10,5 +10,5 @@ type Config struct { | |||
} | |||
|
|||
func DefaultConfig() Config { | |||
return Config{800, 400, 200, time.Second * time.Duration(15)} | |||
return Config{2, 1, 2, 500 *time.Millisecond} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we really want to start testing that so we should configure this now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets talk about it with @gavraz, I'll leave it as is for the meanwhile
timesync/clock.go
Outdated
ch <- t.currentLayer | ||
//log.Info("iv'e notified number : %v", t.ids[ch]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why comment?
p2p/service/sim.go
Outdated
@@ -225,6 +225,7 @@ func (sn *Node) sendMessageImpl(nodeID p2pcrypto.PublicKey, protocol string, pay | |||
return nil | |||
} | |||
log.Debug("%v >> %v (%v)", sn.Node.PublicKey(), nodeID, payload) | |||
panic("could not find " + protocol + " handler for node: " + nodeID.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even though it should never happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe in shutdown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added some comments
p2p/service/sim.go
Outdated
@@ -225,6 +225,7 @@ func (sn *Node) sendMessageImpl(nodeID p2pcrypto.PublicKey, protocol string, pay | |||
return nil | |||
} | |||
log.Debug("%v >> %v (%v)", sn.Node.PublicKey(), nodeID, payload) | |||
panic("could not find " + protocol + " handler for node: " + nodeID.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe in shutdown
oracle/oracle.go
Outdated
return bo.oc.Eligible(uint32(id), bo.committeeSize, pubKey) | ||
} | ||
|
||
/* | ||
type HareOracle interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what in shutdown?
mesh/mesh.go
Outdated
atomic.AddInt32(&m.orphanBlockCount, -1) | ||
for _, layermap := range m.orphanBlocks{ | ||
if _, has := layermap[b]; has { | ||
m.Log.Info("delete block ", b, "from orphans") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably shouldn't be info. (will make noise)
panic("got error starting services : " + err.Error()) | ||
} | ||
|
||
app.startServices() | ||
|
||
err = app.P2P.Start() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could go in startServices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't, it is created from outside services and passed as parameter so i'd rather the code that does that will start
819bb48
to
9ea57e2
Compare
No description provided.