- 
                Notifications
    
You must be signed in to change notification settings  - Fork 100
 
First Public Spec library draft and Request ID calculation in Rust #42
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
Conversation
| 
           @paulyoung Let's sync tomorrow for solving the Nix issues. I think those should be fixed in my other PR then rebased here.  | 
    
          
 Nice idea. But I think “public_spec” is a bad name (are people starting to use “public spec” as a name, rather than a description). Maybe “ic-http-api”?  | 
    
| 
           @nomeata What do you think about a more direct   | 
    
          
 I think renaming the document would help me to know how to refer to it  | 
    
| 
           @hansl said this is still WIP so I'm going to hold off on reviewing this for now  | 
    
| 
           
  | 
    
4767cec    to
    445b539      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still recognize that this is WIP. Commenting so that the Pull Reminders bot will leave me alone :)
7b0de34    to
    30e5960      
    Compare
  
    b00319c    to
    3712121      
    Compare
  
    | 
           I'm getting real close to a reviewable PR.  | 
    
3712121    to
    0482f4e      
    Compare
  
    It was committed by mistake.
3c88565    to
    a10ea84      
    Compare
  
    | 
           @paulyoung Please review this PR. This is ready.  | 
    
| 
           @paulyoung This PR can be reviewed without the OSX build passing. I'm investigating it but the Linux one is, so the code is valid, it might just be Nix acting differently.  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am trying to help unblock @hansl
So, I am giving an approval here without high confidence or a deep review.
| /// code samples (including this library). For now, we newtype it to abstract its usage | ||
| /// from a number, and will change its internal type when time comes. | ||
| #[derive(Clone, Debug, PartialEq, Eq)] | ||
| pub struct CanisterId(Blob); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Using Rust at DFINITY" mentions this crate: https://docs.rs/newtype_derive/0.1.6/newtype_derive/
It seems useful in general but not sure if it's worth adding in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't seem used anymore. Can't find any mention of custom_derive in the rust folder.
| name = "${oldAttrs.name}-debug"; | ||
| }); | ||
| rust-workspace-doc = rust-workspace-debug.doc; | ||
| e2e-tests = super.callPackage ../e2e-tests.nix {}; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These e2e tests are specific to dfx so I think they should be named that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal here is to have global e2e tests, including frontend ones. So I'd say it's not scoped to dfx. Right now they are.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My point is that if I want to add end-to-end tests for the JS user library, I don't think they belong in this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree in the sense that dfinity-sdk.packages.e2e-tests should cover all e2e tests.
I'm also not 100% sure what you mean here. Are you saying that nix/overlays/dfinity-sdk.nix should not have JavaScript things in it? I was working with the impression all packages should be defined here, and those used by whatever layers should be referenced from their directory, here. Essentially you would have a default.nix in the userlib/js/ folder (or wherever) that points to dfinity-sdk.packages.userlib.js. That's what I thought was the plan.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not saying that the SDK overlay shouldn't have JavaScript things in it. I'm saying that I anticipate end-to-end tests for dfx to be quite different to end-to-end tests for other parts of the SDK.
I think this is influenced by older ideas about what would be in the SDK (e.g. a "Try ActorScript in a browser" type tool I was working on) so happy to leave this as-is for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Yes, that makes a lot of sense. When it happens I'd split e2e-tests into multiple subpackages, and have e2e-tests be a set of those.
4f1444f    to
    abf94f4      
    Compare
  
    | 
           @paulyoung Thanks a lot for the valuable feedback. Please take another look, I think I answered all your comments (sorry if I missed one).  | 
    
          
 Which dev dependency?  | 
    
          
 
 I thought at one point   | 
    
          
 It's used when generating a nonce.  | 
    
| 
           @paulyoung Am I missing anything left on this PR?  | 
    
It creates the types for RequestId (and serializes it), CanisterId and Blob. Allows for serde serialization of all.
Also move every usage of RequestId, CanisterId and Blob to ic-http-agent.
It handles request ID and other improvements.
With a few starter tests.
We should keep arguments (at least deps) sorted to facilitate merges. Also we should not depend on the -debug build of DFINITY. We should use -debug for debug build, otherwise release build.
9c0b8e6    to
    f39b5e2      
    Compare
  
    | 
           Just rebased everything, forced push, waiting for CI then merging.  | 
    
This is diff based onto PR #41, so commit 8f9b127 does not need to be reviewed.
feat: add public_spec library and Request Id serializer …
The public_spec library would be ideal to separate the CLI with parts that
can be reused if interacting with the public spec. Its also a good way to
formalize the public spec in Rust for us.
The serializer is a simple Serde serializer that errors for everything
except messages of supported types and forms (no recursive structures, etc).
refactor: use the public_spec exported types in api_client
TODO after this:
request-statusmessages.lib/public_specfor at least running CI on it.