Repository navigation
refactor(nervous_system): Add a Request trait to simplify interacting with our canisters - #1091
Merged
Merged
Conversation
anchpop
force-pushed
the
@anchpop/request-trait
branch
from
August 23, 2024 02:12
a5c3ca3 to
fe357e8
Compare
anchpop
commented
Aug 23, 2024
anchpop
marked this pull request as draft
August 23, 2024 02:16
anchpop
marked this pull request as ready for review
August 23, 2024 02:22
anchpop
marked this pull request as draft
August 23, 2024 02:23
anchpop
force-pushed
the
@anchpop/request-trait
branch
2 times, most recently
from
August 23, 2024 03:06
d15e630 to
8124ed8
Compare
anchpop
marked this pull request as ready for review
August 23, 2024 05:10
Request trait to simplify interacting with our canisters #1090Request trait to simplify interacting with our canisters
anchpop
force-pushed
the
@anchpop/create-nervous-system-interactions-crate
branch
from
August 23, 2024 21:52
414c387 to
840ece9
Compare
anchpop
force-pushed
the
@anchpop/request-trait
branch
from
August 23, 2024 21:53
8124ed8 to
6f9c3aa
Compare
anchpop
force-pushed
the
@anchpop/create-nervous-system-interactions-crate
branch
from
August 24, 2024 02:05
840ece9 to
ce57b01
Compare
anchpop
force-pushed
the
@anchpop/request-trait
branch
from
August 24, 2024 02:05
6f9c3aa to
fbddb63
Compare
anchpop
force-pushed
the
@anchpop/create-nervous-system-interactions-crate
branch
from
August 24, 2024 02:15
ce57b01 to
8b3eee8
Compare
anchpop
force-pushed
the
@anchpop/request-trait
branch
2 times, most recently
from
August 24, 2024 02:29
c5ccac3 to
7e9d9b9
Compare
anchpop
force-pushed
the
@anchpop/create-nervous-system-interactions-crate
branch
from
August 24, 2024 02:37
8b3eee8 to
7263dd2
Compare
anchpop
force-pushed
the
@anchpop/request-trait
branch
from
August 24, 2024 02:37
7e9d9b9 to
09da59c
Compare
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Aug 24, 2024
…teracting with the NNS and SNSes (#1087) I thought it would make sense to have a crate where we would put various helper functions for interaction with SNSes and the NNS. Right now, the only rust helper functions I'm aware of are in some in `//rs/nervous_system/tools/sync-with-released-nevous-system-wasms` for interacting with SNS-W, so I moved just those for now. There are also some that were developed for use in system tests, but they are not trivial to extract so I haven't yet. [Next PR →](#1091)
Base automatically changed from
@anchpop/create-nervous-system-interactions-crate
to
master
August 24, 2024 03:37
anchpop
force-pushed
the
@anchpop/request-trait
branch
from
August 24, 2024 03:55
09da59c to
805c376
Compare
anchpop
force-pushed
the
@anchpop/request-trait
branch
from
August 26, 2024 08:17
805c376 to
7d7e84c
Compare
anchpop
force-pushed
the
@anchpop/request-trait
branch
from
August 27, 2024 12:19
7d7e84c to
55ba2ad
Compare
jasonz-dfinity
approved these changes
Aug 27, 2024
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Aug 28, 2024
I accidentally committed this WIP file in a previous PR (#1091). No other file references it. Let's delete it :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Making requests to canisters in rust code is quite tedious because we must get the request type, encode it, send it, check if the canister returned an error, then decode the response. It is also
Solution
Add a
Requesttrait which can be used to contain the information needed to perform a request: its method string, whether it's an update call, and its response type.Check out
interactions/sns_wasm.rsto see how much it cleans up the code.Notes
In the future I would like to automatically generate Request implementations from our candid files or from the code that causes them to be generated, but for now they are not that bad to implement manually.
Right now, I only actually implement the trait for SNS-W's api, and only use it in the
nervous_system/interactioncrate. I want to implement this trait for other canisters' types as well, and use them in canister code.← Previous PR