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

Check message on-chain consistency before initializing context #1251

Merged
merged 1 commit into from
Apr 17, 2023

Conversation

awrichar
Copy link
Contributor

This prevents inserting a group from a malformed "group init" message.

Possible/partial fix for #1247

@@ -469,6 +469,12 @@ func (ag *aggregator) processMessage(ctx context.Context, manifest *core.BatchMa
case !dataAvailable:
l.Errorf("Message '%s' in batch '%s' is missing data", msgEntry.ID, manifest.ID)
default:
// Check the pin signer is valid for the message
action, err = ag.checkOnchainConsistency(ctx, msg, pin)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the main goal of the PR - to move this check earlier instead of having it as part of attemptMessageDispatch.

However, since this call returns a core.MessageAction, it also made sense to refactor common handling of retry/wait actions up into this method as well, so consequently I split up attemptMessageDispatch a little bit to make that happen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: core.MessageAction is definitely imperfect and can be slightly confusing. ActionRetry means "I also should have returned a non-nil err and you should treat that as retryable" (an err is ignored for any other action). ActionConfirm kind of means "looks good to me, go ahead to confirm or continue with the next step if there is one". There could be some further thought on how to handle success vs. the 3 distinct problem scenarios (wait/retry/reject).

This prevents inserting a group from a malformed "group init" message.

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
for _, unmaskedContext := range unmaskedContexts {
state.SetContextBlockedBy(ctx, *unmaskedContext, pin.Sequence)
}
return nil
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note - there a few earlier branches of this method which return nil without marking the context blocked. Still trying to decide if that was intentional for some reason, or if they should all fall down to here instead.

@peterbroadhurst peterbroadhurst merged commit a59f923 into hyperledger:main Apr 17, 2023
14 checks passed
@peterbroadhurst peterbroadhurst deleted the checksigner branch April 17, 2023 15:05
awrichar added a commit to kaleido-io/firefly that referenced this pull request Apr 18, 2023
Fixes regression from hyperledger#1251

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
awrichar added a commit to kaleido-io/firefly that referenced this pull request Apr 21, 2023
Fixes regression from hyperledger#1251

Signed-off-by: Andrew Richardson <andrew.richardson@kaleido.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants