Skip to content
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

Add an enumeration of standard fee rules. #1018

Merged
merged 3 commits into from
Oct 26, 2023

Conversation

nuttycom
Copy link
Contributor

In order to pass a FeeRule across a serialization boundary, it is necessary for the type of the fee rule to be known. The simplest approach to this is to add serialization for a fixed set of types. StandardFeeRule provides such a set of known fee rules, so that we can serialize and deserialize them.

Extracted from #891

@codecov
Copy link

codecov bot commented Oct 12, 2023

Codecov Report

Attention: 16 lines in your changes are missing coverage. Please review.

Files Coverage Δ
zcash_client_backend/src/data_api/wallet.rs 85.13% <100.00%> (+1.19%) ⬆️
zcash_client_sqlite/src/wallet/sapling.rs 77.55% <ø> (ø)
zcash_primitives/src/transaction/fees.rs 92.30% <92.30%> (ø)
zcash_client_backend/src/fees.rs 53.57% <44.44%> (-1.75%) ⬇️
zcash_client_backend/src/fees/standard.rs 71.42% <71.42%> (ø)

📢 Thoughts on this report? Let us know!.

@nuttycom nuttycom force-pushed the wallet/standard_fee_rule branch 2 times, most recently from 61191cb to 2f6f5f0 Compare October 12, 2023 19:49
@nuttycom nuttycom force-pushed the wallet/standard_fee_rule branch 2 times, most recently from 2861677 to 42e23b7 Compare October 24, 2023 22:31
`StandardFeeRule` is an enumeration of the standard fees that have
existed in the history of Zcash zips. It is provided to simplify
transition to new fee strategies; legacy elements of this enumeration
are introduced already-deprecated.
@nuttycom nuttycom force-pushed the wallet/standard_fee_rule branch from 42e23b7 to f1c0869 Compare October 25, 2023 14:08
@daira daira self-requested a review October 26, 2023 19:43
Comment on lines +76 to +84
.compute_balance(
params,
target_height,
transparent_inputs,
transparent_outputs,
sapling_inputs,
sapling_outputs,
dust_output_policy,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I'll ever get used to the need for this kind of duplication in Rust :-/ I hope there's some language improvement that addresses it.

daira
daira previously approved these changes Oct 26, 2023
Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK with comments.

daira
daira previously approved these changes Oct 26, 2023
Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK modulo the rustfmt failure.

Co-authored-by: Daira Emma Hopwood <[email protected]>
Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@nuttycom nuttycom merged commit 113f558 into zcash:main Oct 26, 2023
13 of 14 checks passed
@nuttycom nuttycom deleted the wallet/standard_fee_rule branch October 26, 2023 22:10
Comment on lines +207 to +208
GreedyInputSelectorError<Zip317FeeError, DbT::NoteRef>,
Zip317FeeError,
Copy link
Contributor

@str4d str4d Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a change to a public API that should be documented in the changelog.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in #1030.

/// * `change_memo`: A memo to be included in any change output that is created.
#[allow(clippy::too_many_arguments)]
#[allow(clippy::type_complexity)]
pub fn propose_standard_transfer_to_address<DbT, ParamsT, CommitmentTreeErrT>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addition should be documented in the changelog.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in #1030.

@@ -118,6 +119,28 @@ pub enum ChangeError<E, NoteRefT> {
StrategyError(E),
}

impl<E, NoteRefT> ChangeError<E, NoteRefT> {
pub fn map<E0, F: FnOnce(E) -> E0>(self, f: F) -> ChangeError<E0, NoteRefT> {
Copy link
Contributor

@str4d str4d Nov 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addition should be documented in the changelog, or removed from the public API.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in #1030.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants