-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
Set prot cfg fields in test #13178
Set prot cfg fields in test #13178
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -1384,12 +1384,6 @@ impl ProtocolConfig { | |||
|
|||
// Setters for tests | |||
impl ProtocolConfig { | |||
pub fn set_max_function_definitions_for_testing(&mut self, m: u64) { |
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.
Removed these as they're now auto-derived
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.
Changes LGTM, but to clarify the initial request that I think this is for, the feature request was to be able to apply the limits from an actual protocol config when running the tests by default so that an operation that would fail on-chain would also fail locally, rather than having a way to override an individual config for tests.
@amnn yes this PR was already in the works and is for a whole different feature needed by replay tool and Sui CLI. |
## Description Allows setting/overriding protocol config fields more easily in tests either by calling functions or referencing fields by string name. This will be used to power CLI features for overriding prot configs in test and debug. Examples ``` let mut prot: ProtocolConfig = ProtocolConfig::get_for_version(ProtocolVersion::new(1), Chain::Unknown); ``` * By value in function call ``` prot.set_max_arguments_for_testing(123); assert_eq!(prot.max_arguments(), 123); ``` * By string value in function call ``` prot.set_max_arguments_from_str_for_testing("321".to_string()); assert_eq!(prot.max_arguments(), 321); ``` * By string value and string field name ``` prot.set_attr_for_testing("max_arguments".to_string(), "456".to_string()); assert_eq!(prot.max_arguments(), 456); ``` * Unset a field ``` prot.disable_max_arguments_for_testing(); assert_eq!(prot.max_arguments_as_option(), None); ``` ## Test Plan Unit tests --- If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process. ### Type of Change (Check all that apply) - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes
Description
Allows setting/overriding protocol config fields more easily in tests either by calling functions or referencing fields by string name.
This will be used to power CLI features for overriding prot configs in test and debug.
Examples
Test Plan
Unit tests
If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process.
Type of Change (Check all that apply)
Release notes