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

Merged
merged 16 commits into from Feb 10, 2019

Conversation

Projects
None yet
3 participants
@antonlerner
Copy link
Collaborator

antonlerner commented Jan 28, 2019

No description provided.

@antonlerner antonlerner requested a review from almogdepaz Jan 28, 2019

func (m *Mesh) AddLayer(layer *Layer) error {
m.lMutex.Lock()
defer m.lMutex.Unlock()
count := LayerID(m.LocalLayer())
count := LayerID(m.LatestSeenLayer())

This comment has been minimized.

@almogdepaz

almogdepaz Feb 5, 2019

Member

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)

This comment has been minimized.

@almogdepaz

almogdepaz Feb 5, 2019

Member

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()))

This comment has been minimized.

@almogdepaz

almogdepaz Feb 5, 2019

Member

this basically overwrites lastSeenLayer which could be higher

This comment has been minimized.

@antonlerner

antonlerner Feb 6, 2019

Author Collaborator

there is a check above that validates that this layer is exactly +1 from previous recevied

@antonlerner antonlerner force-pushed the real_node branch from ad583a1 to ac15451 Feb 6, 2019

@antonlerner antonlerner changed the title [WIP] full node UT full node UT Feb 6, 2019

@antonlerner antonlerner force-pushed the real_node branch 2 times, most recently from 54beed3 to 3acc142 Feb 6, 2019

antonlerner added some commits Jan 21, 2019

running working 2 node with simulator accepting 1 trans
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

@antonlerner antonlerner force-pushed the real_node branch from 3acc142 to f340ea5 Feb 7, 2019

app/main.go Outdated

app.NodeInitCallback <- true
app.P2P = swarm

This comment has been minimized.

@y0sher

y0sher Feb 7, 2019

Collaborator

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

//if broker.inbox != nil { // Start has been called at least twice
// log.Error("Could not start instance")
// return StartInstanceError(errors.New("instance already started"))
//}

This comment has been minimized.

@y0sher

y0sher Feb 7, 2019

Collaborator

you can move registration back here and uncomment above code. the only rule is that protocols should register before swarm is started.

@@ -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}

This comment has been minimized.

@y0sher

y0sher Feb 7, 2019

Collaborator

if we really want to start testing that so we should configure this now

This comment has been minimized.

@antonlerner

antonlerner Feb 10, 2019

Author Collaborator

lets talk about it with @gavraz, I'll leave it as is for the meanwhile

antonlerner added some commits Feb 10, 2019

ch <- t.currentLayer
//log.Info("iv'e notified number : %v", t.ids[ch])

This comment has been minimized.

@y0sher

y0sher Feb 10, 2019

Collaborator

why comment?

@@ -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())

This comment has been minimized.

@y0sher

y0sher Feb 10, 2019

Collaborator

remove

This comment has been minimized.

@y0sher

y0sher Feb 10, 2019

Collaborator

even though it should never happen.

This comment has been minimized.

@y0sher

y0sher Feb 10, 2019

Collaborator

maybe in shutdown

@y0sher

y0sher approved these changes Feb 10, 2019

Copy link
Collaborator

y0sher left a comment

added some comments

@@ -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())

This comment has been minimized.

@y0sher

y0sher Feb 10, 2019

Collaborator

maybe in shutdown

return bo.oc.Eligible(uint32(id), bo.committeeSize, pubKey)
}

/*
type HareOracle interface {

This comment has been minimized.

@y0sher

y0sher Feb 10, 2019

Collaborator

remove it

This comment has been minimized.

@antonlerner

antonlerner Feb 10, 2019

Author Collaborator

what in shutdown?

atomic.AddInt32(&m.orphanBlockCount, -1)
for _, layermap := range m.orphanBlocks{
if _, has := layermap[b]; has {
m.Log.Info("delete block ", b, "from orphans")

This comment has been minimized.

@y0sher

y0sher Feb 10, 2019

Collaborator

probably shouldn't be info. (will make noise)

panic("got error starting services : " + err.Error())
}

app.startServices()

err = app.P2P.Start()

This comment has been minimized.

@y0sher

y0sher Feb 10, 2019

Collaborator

could go in startServices

This comment has been minimized.

@antonlerner

antonlerner Feb 10, 2019

Author Collaborator

can't, it is created from outside services and passed as parameter so i'd rather the code that does that will start

@antonlerner antonlerner force-pushed the real_node branch from 819bb48 to 9ea57e2 Feb 10, 2019

@antonlerner antonlerner merged commit 9615801 into develop Feb 10, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment