File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed
rs/nns/governance/src/proposals Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -175,7 +175,9 @@ impl ValidProposalAction {
175175 }
176176 }
177177
178- /// Converts the proposal action to a self describing representation of itself.
178+ /// Converts the proposal action to a self describing representation of itself. Note that it is
179+ /// async because we need to call `ic0.canister_metadata` to get the candid file of an external
180+ /// canister.
179181 pub async fn to_self_describing (
180182 & self ,
181183 _env : Arc < dyn Environment > ,
Original file line number Diff line number Diff line change @@ -25,13 +25,14 @@ pub trait LocallyDescribableProposalAction {
2525
2626impl LocallyDescribableProposalAction for Motion {
2727 const TYPE_NAME : & ' static str = "Motion" ;
28+
2829 const TYPE_DESCRIPTION : & ' static str = "A motion is a text that can be adopted or rejected. \
2930 No code is executed when a motion is adopted. An adopted motion should guide the future \
3031 strategy of the Internet Computer ecosystem.";
3132
3233 fn to_value ( & self ) -> Value {
3334 ValueBuilder :: new ( )
34- . add_string_field ( "motion_text" . to_string ( ) , self . motion_text . clone ( ) )
35+ . add_string_field ( "motion_text" , self . motion_text . clone ( ) )
3536 . build ( )
3637 }
3738}
@@ -48,11 +49,11 @@ impl ValueBuilder {
4849 }
4950 }
5051
51- pub fn add_string_field ( mut self , key : String , value : String ) -> Self {
52+ pub fn add_string_field ( mut self , key : impl ToString , value : String ) -> Self {
5253 self . fields . insert (
53- key,
54+ key. to_string ( ) ,
5455 Value {
55- value : Some ( Text ( value) ) ,
56+ value : Some ( Text ( value. to_string ( ) ) ) ,
5657 } ,
5758 ) ;
5859 self
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ use super::*;
33use ic_nns_governance_api:: Value as ApiValue ;
44use maplit:: hashmap;
55
6+ #[ track_caller]
67fn assert_self_describing_value_is (
78 action : impl LocallyDescribableProposalAction ,
89 expected : ApiValue ,
You can’t perform that action at this time.
0 commit comments