Skip to content
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

Atx invalid sequence handling #901

Merged
merged 7 commits into from May 16, 2019

Conversation

Projects
None yet
2 participants
@antonlerner
Copy link
Member

commented May 15, 2019

No description provided.

@antonlerner antonlerner requested a review from noamnelke May 15, 2019

@@ -138,14 +141,24 @@ func (db *ActivationDb) ValidateAtx(atx *types.ActivationTx) error {
if atx.PrevATXId != *types.EmptyAtxId {
prevATX, err := db.GetAtx(atx.PrevATXId)
if err != nil {
return fmt.Errorf("prevATX not found")
return fmt.Errorf("validation failed: prevATX not found")

This comment has been minimized.

Copy link
@noamnelke

noamnelke May 15, 2019

Contributor

why assume this is the error? let's include the error received.

if l > 1 {
lastAtx, err := db.getAtxUnlocked(atxs[0])
if err != nil {
return errors.New("could not get all atxs from database ")

This comment has been minimized.

Copy link
@noamnelke

noamnelke May 15, 2019

Contributor

wrong error message?

@@ -272,6 +281,8 @@ func (b *Builder) GetPositioningAtxId(epochId types.EpochId) (*types.AtxId, erro
return &atxId, nil
}

// GetLastSequence retruns the last sequence number of atx reported by node id node
// it will return 0 if no previous atx was found for the requested nod

This comment has been minimized.

Copy link
@noamnelke

noamnelke May 15, 2019

Contributor
Suggested change
// it will return 0 if no previous atx was found for the requested nod
// it will return 0 if no previous atx was found for the requested node
@@ -140,6 +145,8 @@ func (b *Builder) loop() {
}
}

// PublishActivationTx attempts to publish an atx for the given epoch ech, it returns an error if an atx cannot be created

This comment has been minimized.

Copy link
@noamnelke

noamnelke May 15, 2019

Contributor
Suggested change
// PublishActivationTx attempts to publish an atx for the given epoch ech, it returns an error if an atx cannot be created
// PublishActivationTx attempts to publish an atx for the given epoch, it returns an error if an atx cannot be created

(this is not the argument name)

@@ -341,6 +397,22 @@ func (db *ActivationDb) GetEpochAtxIds(epochId types.EpochId) ([]types.AtxId, er
return atxs, nil
}

// getAtxUnlocked gets the atx from db, this function is not thread safe and should be called under db lock
// this function returns a pointer and

This comment has been minimized.

Copy link
@noamnelke

noamnelke May 15, 2019

Contributor
Suggested change
// this function returns a pointer and
// this function returns a pointer

(not sure if you wanted to add something here)

@noamnelke
Copy link
Contributor

left a comment

note that tests are failing

antonlerner added some commits May 15, 2019

@antonlerner antonlerner merged commit b1f7e73 into develop May 16, 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
You can’t perform that action at this time.