-
Notifications
You must be signed in to change notification settings - Fork 21
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
feat: validate stacks fees #1430
base: main
Are you sure you want to change the base?
feat: validate stacks fees #1430
Conversation
Only adding Mateo and Daniel because you two were the active reviewers of #1392 |
Existing comments on this code can be found in the original PR of which this is half: |
This LGTM, but I'll let @djordon or @matteojug approve since I didn't spend much time on the previous PR. |
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.
Largely looks good. We need to get those child tickets sorted out. Also, we need to figure out when to update the immunefi branch.
#[test] | ||
fn zero_values_for_nonzero_fields_fail_in_signer_config() { | ||
fn test_one(field: &str) { | ||
clear_env(); | ||
std::env::set_var(format!("SIGNER_SIGNER__{}", field.to_uppercase()), "0"); | ||
let _ = Settings::new_from_default_config() | ||
.expect_err(&format!("Value for {field} must be non zero")); | ||
} | ||
test_one("stacks_fees_max_ustx"); | ||
} |
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.
We should combine this test with the one below to something like this
#[test_case("dkg_max_duration" ; "dkg_max_duration")]
#[test_case("bitcoin_presign_request_max_duration" ; "bitcoin_presign_request_max_duration")]
#[test_case("signer_round_max_duration" ; "signer_round_max_duration")]
#[test_case("stacks_fees_max_ustx" ; "stacks_fees_max_ustx")]
fn zero_values_for_nonzero_fields_fail_in_signer_config(field: &str) {
clear_env();
std::env::set_var(format!("SIGNER_SIGNER__{}", field.to_uppercase()), "0");
Settings::new_from_default_config()
.expect_err("value for must be non zero");
}
You'll probably need to add use test_case::test_case
near the top of the tests
module.
# | ||
# Required: false | ||
# Environment: SIGNER_SIGNER__STACKS_FEES_MAX_USTX | ||
stacks_fees_max_ustx = 1500000 |
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.
Shouldn't this stay commented, since we don't want to give the impression that signers should set it unless they need to?
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 even sure we want this block here, we usually don't add the ones with a default we may want to "silently" change in this file (not even commented out)
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.
Yeah, let's remove it.
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 everywhere.
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.
Well we want it in the default.toml
, just not in the mainnet or devenv ones.
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.
Actually, you can keep it in the devenv one too, just not the mainnet one.
# The maximum fee in microSTX that a signer will accept for a Stacks transaction. | ||
# If the coordinator suggests a fee higher than this value for a transaction the | ||
# signer will reject it. |
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.
We should mention that this value must be greater than zero.
# | ||
# Required: false | ||
# Environment: SIGNER_SIGNER__STACKS_FEES_MAX_USTX | ||
stacks_fees_max_ustx = 1500000 |
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 even sure we want this block here, we usually don't add the ones with a default we may want to "silently" change in this file (not even commented out)
Description
Closes #1439
This PR is from another PR (#1392) that got split up to separate Bitcoin and Stacks behavior.
Changes
Testing Information
unit and integration tests
Checklist: