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
Merged

Conversation

@antonlerner
Copy link
Member

@antonlerner antonlerner 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")
Copy link
Member

@noamnelke noamnelke May 15, 2019

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 ")
Copy link
Member

@noamnelke noamnelke May 15, 2019

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
Copy link
Member

@noamnelke noamnelke May 15, 2019

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
Copy link
Member

@noamnelke noamnelke May 15, 2019

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
Copy link
Member

@noamnelke noamnelke May 15, 2019

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

(not sure if you wanted to add something here)

Copy link
Member

@noamnelke noamnelke left a comment

note that tests are failing

@antonlerner antonlerner merged commit b1f7e73 into develop May 16, 2019
1 check passed
@y0sher y0sher deleted the atx_invalid_sequence_handling branch Jun 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants