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

Simplify service requests #3581

Merged
merged 5 commits into from
Mar 17, 2025
Merged

Simplify service requests #3581

merged 5 commits into from
Mar 17, 2025

Conversation

ma2bd
Copy link
Contributor

@ma2bd ma2bd commented Mar 16, 2025

Motivation

After #3217, we do not need to introspect service queries to applications.

Proposal

  • Minimize assumptions about application APIs. After this PR, we only assume UTF8 bytes as input and JSON as output.
  • Simplify requests handlers
  • Somehow this revealed silently failing queries in our README files. Also fix that.

Note the assumption on JSON outputs could be relaxed if we stopped returning the hash of the certified block and return the query response instead. However, this is a breaking change so this should be a separate PR.

Test Plan

CI

applicationId: "$APP_ID_1"
) }
```

If you enter the `applications` query again, both entries will appear in the second wallet as
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mmm this looks outdated. I'll make another pass on the README files before landing the PR.


trace!("Query requested a new block with operations: {operations:?}");
Copy link
Contributor

@afck afck Mar 17, 2025

Choose a reason for hiding this comment

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

Maybe there should be a way for the user to tell the client that they do not want to create a new block, regardless of what the application returns.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we're certainly not going to auto-sign block proposals like this in the future but instead properly integrate with wallets.

Comment on lines +928 to +929
let response = async_graphql::Response::new(hash.to_value());
Ok(serde_json::to_vec(&response)?)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if this is really an improvement - sure the type is Vec<u8> but it is a serialized JSON. If it can't be anything else I think the previous type was better b/c it more precisely defined how to handle the data. Right now callers have to read the docs, previously it was in the type.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, wouldn't it be more consistent to not return the block hash here, and instead return the response from the QueryOutcome, just like in line 903 above?

Copy link
Contributor Author

@ma2bd ma2bd Mar 17, 2025

Choose a reason for hiding this comment

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

Yes see the summary

@ma2bd ma2bd merged commit 4a8d4c9 into linera-io:main Mar 17, 2025
23 checks passed
@ma2bd ma2bd deleted the service_requests branch March 17, 2025 21:01
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.

4 participants