-
Notifications
You must be signed in to change notification settings - Fork 15
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
Rfp #110
Rfp #110
Conversation
… that only admin can add rfp, tests for get_rfp_ids, labels
…ine. rename editor field in is_allowed_to_write_rfps. tests for allowed_to_edit, timeline edit, allowed_labels, incorrect category
…submission state, moved check category up, added settting categories first in devhub proposals test
…sals are allowed to link and unlink to this RFP except admin. test included
Important Auto Review SkippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe update brings significant enhancements to the project by enabling the "unstable" feature in the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
…, add promise handling for edit_rfp -> edit_proposal 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.
Actionable comments posted: 1
Out of diff range and nitpick comments (2)
src/proposal/repost.rs (2)
Line range hint
8-24
: Optimize cloning operations inproposal_repost_text
.Similar to the RFP repost function, consider reducing the use of
clone()
when accessing the latest version of the proposal body. This could improve performance, especially if the body is large.
Line range hint
27-49
: Ensure efficient JSON handling inrepost_internal
andpublish_to_socialdb_feed
.The JSON construction in
repost_internal
could be optimized by avoiding redundant conversions to strings. Additionally, ensure that the division of gas inpublish_to_socialdb_feed
is appropriate and does not lead to gas exhaustion.
Co-authored-by: Vlad Frolov <[email protected]>
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.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/lib.rs (19 hunks)
Additional comments not posted (15)
src/lib.rs (15)
Line range hint
9-22
: Addition of therfp
module and related imports looks good.
58-60
: New fields for managing RFPs in theContract
struct are correctly added and initialized.Also applies to: 83-85
169-183
: New methods for retrieving RFPs are correctly implemented.
348-407
: Theadd_rfp
method is well-implemented with necessary checks.
420-428
: Theset_rfp_block_height_callback
method is correctly implemented.
459-465
: Theget_rfps_by_label
method is correctly implemented.
519-522
: Theis_allowed_to_write_rfps
method is correctly implemented.
932-941
: Theedit_rfp
method is well-implemented with necessary checks.
943-963
: Thecancel_rfp
method is correctly implemented and handles related proposals.
965-974
: Theedit_rfp_timeline
method is correctly implemented.
976-1062
: Theedit_rfp_internal
method is well-implemented with necessary checks.
1082-1087
: Theget_rfp_linked_proposals
method is correctly implemented.
1089-1104
: Theset_global_labels
method is correctly implemented.
1403-1412
: Theget_moderators
method is correctly implemented.
1420-1431
: TheLabelInfo
andLabelInfoExtended
structs are correctly defined and implemented.
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.
Actionable comments posted: 1
Out of diff range and nitpick comments (9)
src/lib.rs (9)
9-9
: Add a comment explaining the purpose of therfp
module.pub mod rfp; // Module for managing Requests for Proposals (RFPs)
169-172
: Consider adding a comment to explain the purpose of theget_rfps
method./// Retrieves all RFPs. pub fn get_rfps(&self) -> Vec<VersionedRFP> {
174-177
: Consider adding a comment to explain the purpose of theget_rfp
method./// Retrieves a specific RFP by its ID. pub fn get_rfp(&self, rfp_id: RFPId) -> VersionedRFP {
179-182
: Consider adding a comment to explain the purpose of theget_all_rfp_ids
method./// Retrieves all RFP IDs. pub fn get_all_rfp_ids(&self) -> Vec<RFPId> {
420-429
: Consider adding a comment to explain the purpose of theset_rfp_block_height_callback
method./// Callback to set the block height for an RFP. pub fn set_rfp_block_height_callback(
460-466
: Consider adding a comment to explain the purpose of theget_rfps_by_label
method./// Retrieves RFPs by a specific label. pub fn get_rfps_by_label(&self, label: String) -> Vec<RFPId> {
520-523
: Consider adding a comment to explain the purpose of theis_allowed_to_write_rfps
method./// Checks if the editor is allowed to write RFPs. pub fn is_allowed_to_write_rfps(&self, editor: AccountId) -> bool {
1078-1083
: Consider adding a comment to explain the purpose of theget_rfp_linked_proposals
method./// Retrieves proposals linked to a specific RFP. pub fn get_rfp_linked_proposals(&self, rfp_id: RFPId) -> Vec<ProposalId> {
1399-1408
: Consider adding a comment to explain the purpose of theget_moderators
method./// Retrieves the list of moderators. fn get_moderators(&self) -> HashSet<AccountId> {
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/lib.rs (19 hunks)
Additional comments not posted (7)
src/lib.rs (7)
83-85
: Ensure the initialization ofrfps
,label_to_rfps
, andglobal_labels_info
is correct.
348-407
: Ensure proper error handling and validation in theadd_rfp
method.
933-942
: Ensure proper error handling and validation in theedit_rfp
method.
944-964
: Ensure proper error handling and validation in thecancel_rfp
method.
966-975
: Ensure proper error handling and validation in theedit_rfp_timeline
method.
977-1058
: Ensure proper error handling and validation in theedit_rfp_internal
method.
1085-1100
: Ensure proper error handling and validation in theset_global_labels
method.
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.
Actionable comments posted: 2
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/lib.rs (19 hunks)
Additional comments not posted (10)
src/lib.rs (10)
9-9
: Ensure the newrfp
module is correctly integrated and follows the project's module organization conventions.
Line range hint
70-85
: Ensure the new fields for RFP management are correctly initialized and follow best practices.
169-172
: Ensure theget_rfps
method is correctly implemented and follows best practices.
174-177
: Ensure theget_rfp
method is correctly implemented and follows best practices.
348-399
: Ensure theadd_rfp
method is correctly implemented and follows best practices.
925-934
: Ensure theedit_rfp
method is correctly implemented and follows best practices.
936-956
: Ensure thecancel_rfp
method is correctly implemented and follows best practices.
958-967
: Ensure theedit_rfp_timeline
method is correctly implemented and follows best practices.
452-458
: Ensure theget_rfps_by_label
method is correctly implemented and follows best practices.
1062-1077
: Ensure theset_global_labels
method is correctly implemented and follows best practices.
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.
Actionable comments posted: 3
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- src/lib.rs (20 hunks)
- src/proposal/mod.rs (4 hunks)
- src/rfp/mod.rs (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/rfp/mod.rs
Additional comments not posted (13)
src/proposal/mod.rs (5)
8-10
: Ensure that the new imports are necessary and used within the file.Please verify that the
Contract
,str_serializers
, andrfp::RFPId
imports are utilized within this module.
88-107
: TheProposalBodyV1
struct is well-defined and follows the existing pattern. Ensure that all necessary fields are included.
113-115
: TheVersionedProposalBody
enum correctly includes the newV1
variant, maintaining backward compatibility.
117-133
: TheFrom
implementations forProposalBodyV0
andProposalBodyV1
ensure proper conversion between versions and handle the conversion logic appropriately.Also applies to: 145-149
167-169
: Thelatest_version
method inVersionedProposalBody
is straightforward and correctly implemented.src/lib.rs (8)
Line range hint
70-85
: Initialization logic for new fields related to RFPs looks good.
161-163
: Theget_rfps
method implementation looks good.
165-167
: Theget_rfp
method implementation looks good.
334-384
: Theadd_rfp
method implementation looks good and includes necessary checks.
709-717
: Theedit_rfp
method implementation looks good.
719-738
: Thecancel_rfp
method implementation looks good and includes necessary logic for handling related proposals.
433-438
: Theget_rfps_by_label
method implementation looks good.
397-406
: Theset_rfp_block_height_callback
method implementation looks good.
use rfp::{ | ||
RFPId, RFPSnapshot, TimelineStatus as RFPTimelineStatus, VersionedRFP, VersionedRFPBody, RFP, | ||
}; |
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.
Consider grouping related imports together for better readability. For example, group all rfp
related imports together.
use rfp::{
RFPId, RFPSnapshot, TimelineStatus as RFPTimelineStatus, VersionedRFP, VersionedRFPBody, RFP,
};
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
use rfp::{ | |
RFPId, RFPSnapshot, TimelineStatus as RFPTimelineStatus, VersionedRFP, VersionedRFPBody, RFP, | |
}; | |
use rfp::{ | |
RFPId, RFPSnapshot, TimelineStatus as RFPTimelineStatus, VersionedRFP, VersionedRFPBody, RFP, | |
}; |
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.
Actionable comments posted: 2
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- src/lib.rs (20 hunks)
- src/rfp/mod.rs (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/rfp/mod.rs
Additional comments not posted (14)
src/lib.rs (14)
161-163
: Theget_rfps
method looks good. Ensure that theVersionedRFP
type is correctly handled in the calling code.
165-167
: Theget_rfp
method looks good. Ensure that theRFPId
type is correctly handled in the calling code.
169-171
: Theget_all_rfp_ids
method looks good. Ensure that theRFPId
type is correctly handled in the calling code.
334-384
: Theadd_rfp
method is well-implemented. Ensure that theVersionedRFPBody
type is correctly handled in the calling code and that the required permissions are properly managed.
397-406
: Theset_rfp_block_height_callback
method is well-implemented. Ensure that theSetReturnType
type is correctly handled in the calling code.
433-438
: Theget_rfps_by_label
method looks good. Ensure that theRFPId
type is correctly handled in the calling code.
487-489
: Theis_allowed_to_write_rfps
method is well-implemented. Ensure that the required permissions are properly managed.
709-717
: Theedit_rfp
method is well-implemented. Ensure that theVersionedRFPBody
type is correctly handled in the calling code and that the required permissions are properly managed.
739-746
: Theedit_rfp_timeline
method is well-implemented. Ensure that theRFPTimelineStatus
type is correctly handled in the calling code and that the required permissions are properly managed.
752-761
: Theget_global_labels
method is well-implemented. Ensure that theLabelInfoExtended
type is correctly handled in the calling code.
763-767
: Theget_rfp_linked_proposals
method looks good. Ensure that theRFPId
andProposalId
types are correctly handled in the calling code.
769-781
: Theset_global_labels
method is well-implemented. Ensure that theLabelInfoExtended
type is correctly handled in the calling code and that the required permissions are properly managed.
1098-1101
: TheLabelInfo
struct is well-defined. Ensure that the optional fields are correctly handled in the calling code.
1103-1108
: TheLabelInfoExtended
struct is well-defined. Ensure that the optional fields are correctly handled in the calling code.
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.
Actionable comments posted: 10
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- src/lib.rs (20 hunks)
- src/migrations.rs (12 hunks)
- src/proposal/mod.rs (4 hunks)
- src/rfp/mod.rs (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/rfp/mod.rs
Additional comments not posted (7)
src/proposal/mod.rs (5)
90-107
:ProposalBodyV1
struct looks good and correctly extendsProposalBodyV0
with thelinked_rfp
field.
113-115
:VersionedProposalBody
enum is well-defined with variants forV0
andV1
.
117-133
: TheFrom
implementations forProposalBodyV0
,ProposalBodyV1
, andVersionedProposalBody
are correctly implemented.Also applies to: 145-149, 160-163
166-169
: Thelatest_version
method inVersionedProposalBody
is correctly implemented to returnProposalBodyV1
.
Line range hint
172-180
: Theget_subscribers
function is well-implemented to extract subscribers fromProposalBodyV1
.src/migrations.rs (2)
652-687
: Theunsafe_add_rfp
function correctly handles the migration to include RFP-related fields in the contract state.
692-709
: TheContractV11
struct is well-defined and includes necessary fields for managing RFPs.
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.
Actionable comments posted: 9
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- Cargo.toml (1 hunks)
- src/lib.rs (20 hunks)
- src/migrations.rs (13 hunks)
Files skipped from review due to trivial changes (1)
- Cargo.toml
Additional comments not posted (4)
src/migrations.rs (2)
691-710
: LGTM! TheContractV11
struct definition is consistent with the previous versions and includes the new fields for RFP management.
816-819
: LGTM! The migration logic forStateVersion::V10
toStateVersion::V11
is correctly added to theunsafe_migrate
function.src/lib.rs (2)
9-9
: The import statement for therfp
module is correctly added and grouped with related imports.
59-61
: The new fieldsrfps
,label_to_rfps
, andglobal_labels_info
are correctly added to theContract
struct and initialized in thenew
method.
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.
Actionable comments posted: 0
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.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/lib.rs (20 hunks)
Additional comments not posted (12)
src/lib.rs (12)
9-9
: Addedpub mod rfp
to expose RFP-related functionality.
20-22
: Grouped RFP-related imports for better organization and readability.
59-61
: Added new fields to theContract
struct to support RFP functionality.
84-86
: Initialized new fields in theContract
constructor.
162-164
: Methodget_rfps
retrieves all RFPs. Consider handling potential errors when converting theVector
to aVec
.
166-168
: Methodget_rfp
retrieves a specific RFP by ID. Consider handling potential errors more gracefully.
170-172
: Methodget_all_rfp_ids
retrieves all RFP IDs. Consider handling potential errors when converting theVector
length.
381-390
: Methodset_rfp_block_height_callback
sets the block height for an RFP. Consider handling potential errors more gracefully.
417-422
: Methodget_rfps_by_label
retrieves RFPs by label. Consider handling potential errors more gracefully.
471-473
: Methodis_allowed_to_write_rfps
checks if the editor is allowed to write RFPs. Consider handling potential errors more gracefully.
693-701
: Methodedit_rfp
edits an RFP. Consider handling potential errors more gracefully.
736-745
: Methodget_global_labels
retrieves global labels. Consider handling potential errors more gracefully.
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.
This is the last round of review. Please, address these several comments and let's get it merged
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.
@PolyProgrammist Great job! Thanks for addressing the review comments quickly.
Summary by CodeRabbit
New Features
Improvements
near-sdk
.Bug Fixes