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

feat(solver/app): basic event processor #2386

Merged
merged 1 commit into from
Nov 6, 2024
Merged

Conversation

corverroos
Copy link
Collaborator

@corverroos corverroos commented Nov 5, 2024

Basic solver architecture based on a well-abstracted event processor.

issue: #2384

@corverroos corverroos force-pushed the corver/solverlogic branch 2 times, most recently from 62f8f91 to c0c6198 Compare November 5, 2024 17:34
@corverroos corverroos changed the title wip: solver arch feat(solver/app): basic event processor Nov 6, 2024
@corverroos corverroos marked this pull request as ready for review November 6, 2024 11:28
req, _, err := deps.GetRequest(ctx, chainID, reqID)
if err != nil {
return errors.Wrap(err, "current status")
} else if event.Status != req.Status {
Copy link
Contributor

Choose a reason for hiding this comment

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

does it make sense to also check for case where event status is further than request status and mark it as a bug? so event status is fullffilled but request status is pending, because if this happens (if it can) we might miss a bug here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah, good point, I'll add this in next PR

ignored = ""
)

func TestEventProcessor(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

)

var (
inboxABI = mustGetABI(bindings.SolveInboxMetaData)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: use the Golang init function pattern instead of mustGet*

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

init should be avoided at all costs I think

)

// procDeps abstracts dependencies for the event processor allowed simplified testing.
type procDeps struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this should be an interface, interface is used to do exactly what the comment says "abstracts dependencies for ... allowed simplified testing"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it is a style thing, I prefer funcs, since the implementations are not related, this allows better decoupling,

return deps.Reject(ctx, chainID, req, reason)
}

return deps.Accept(ctx, chainID, req)
Copy link
Contributor

@kc1116 kc1116 Nov 6, 2024

Choose a reason for hiding this comment

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

Can you explain why we don't Fulfill at this step?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

First Accept, if that succeeds, then fulfil

Copy link
Contributor

@kc1116 kc1116 left a comment

Choose a reason for hiding this comment

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

Couple nits related to Go styling, and one comment for clarification.

@corverroos corverroos merged commit 4252e94 into main Nov 6, 2024
18 of 20 checks passed
@corverroos corverroos deleted the corver/solverlogic branch November 6, 2024 13:21
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.

3 participants