-
Notifications
You must be signed in to change notification settings - Fork 225
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: initial implementation of walletv2 #6429
base: master
Are you sure you want to change the base?
Conversation
bf6127b
to
68aae67
Compare
41ee984
to
2e36e7a
Compare
6582968
to
994083a
Compare
DustAmount, | ||
#[error("Federation returned an error: {0}")] | ||
FederationError(String), | ||
#[error("The federation has no vetted gateways")] |
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.
wrong message?
FederationError(String), | ||
#[error("The federation has no vetted gateways")] | ||
NoConsensusFeerateAvailable, | ||
#[error("The client does not have sufficicent funds to send the payment")] |
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.
#[error("The client does not have sufficicent funds to send the payment")] | |
#[error("The client does not have sufficient funds to send the payment")] |
pub enum SendError { | ||
#[error("Address is from a different network then the federation.")] | ||
WrongNetwork, | ||
#[error("The amount is to small to be send on-chain")] |
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.
#[error("The amount is to small to be send on-chain")] | |
#[error("The amount is too small to be sent on-chain")] |
/// | ||
/// # Errors | ||
/// - This constructor returns an error if the relative fee is in excess of | ||
/// one thousand parts per million. |
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.
ten thousand?
// change in feerate it stays invalid. Otherwise there exists a race condition | ||
// where a client might consider a actually accepted transaction as rejected. |
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.
// change in feerate it stays invalid. Otherwise there exists a race condition | |
// where a client might consider a actually accepted transaction as rejected. | |
// change in feerate, it remains invalid. Otherwise, there exists a race condition | |
// where a client might consider an actually accepted transaction as rejected. |
#[derive(Debug, Clone, Eq, PartialEq, Hash, Deserialize, Serialize, Encodable, Decodable)] | ||
pub struct ReceiveFee { | ||
// This index ensures that once a Fedimint transaction becomes invalid due to a | ||
// change in feerate it stays invalid. Otherwise there exists a race condition |
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.
ditto
WrongOutputScript, | ||
#[error("No up to date feerate is available at the moment. Please try again later.")] | ||
NoConsensusFeerateAvailable, | ||
#[error("The fee index is outdated. Please construct an new transaction.")] |
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.
#[error("The fee index is outdated. Please construct an new transaction.")] | |
#[error("The fee index is outdated. Please construct a new transaction.")] |
NoConsensusFeerateAvailable, | ||
#[error("The fee index is outdated. Please construct an new transaction.")] | ||
IncorrectFeeRateIndex, | ||
#[error("The total transaction fee is to low. Please construct an new transaction.")] |
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.
#[error("The total transaction fee is to low. Please construct an new transaction.")] | |
#[error("The total transaction fee is too low. Please construct a new transaction.")] |
IncorrectFeeRateIndex, | ||
#[error("The total transaction fee is to low. Please construct an new transaction.")] | ||
InsufficientTotalFee, | ||
#[error("Constructing the pegin transaction caused and arithmetic overflow")] |
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.
#[error("Constructing the pegin transaction caused and arithmetic overflow")] | |
#[error("Constructing the pegin transaction caused an arithmetic overflow")] |
pub enum WalletOutputError { | ||
#[error("The wallet output version is not supported by this federation")] | ||
UnknownOutputVariant(#[from] UnknownWalletOutputVariantError), | ||
#[error("Connected bitcoind is on wrong network.")] |
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.
wrong message
NoFederationUTXO, | ||
#[error("No up to date feerate is available at the moment. Please try again later.")] | ||
NoConsensusFeerateAvailable, | ||
#[error("The fee index is outdated. Please construct an new transaction.")] |
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.
...
NoConsensusFeerateAvailable, | ||
#[error("The fee index is outdated. Please construct an new transaction.")] | ||
IncorrectFeeRateIndex, | ||
#[error("The total transaction fee is to low. Please construct an new transaction.")] |
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.
...
#[error("The fee index is outdated. Please construct an new transaction.")] | ||
IncorrectFeeRateIndex, | ||
#[error("The total transaction fee is to low. Please construct an new transaction.")] | ||
InsufficicentTotalFee, |
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.
InsufficicentTotalFee, | |
InsufficientTotalFee, |
IncorrectFeeRateIndex, | ||
#[error("The total transaction fee is to low. Please construct an new transaction.")] | ||
InsufficicentTotalFee, | ||
#[error("Constructing the pegout transaction caused and arithmetic overflow")] |
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.
...
let outpoint = bitcoin::OutPoint { | ||
txid: transaction.compute_txid(), | ||
vout: u32::try_from(vout).expect( | ||
"Bitcoin transaction has more then u32::MAX outputs", |
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.
"Bitcoin transaction has more then u32::MAX outputs", | |
"Bitcoin transaction has more than u32::MAX outputs", |
if Some(feerate) == dbtx.insert_entry(&FeeRateVoteKey(peer), &feerate).await { | ||
bail!("Fee rate vote is redundant"); | ||
} |
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.
if Some(feerate) == dbtx.insert_entry(&FeeRateVoteKey(peer), &feerate).await { | |
bail!("Fee rate vote is redundant"); | |
} | |
ensure!( | |
Some(feerate) != dbtx.insert_entry(&FeeRateVoteKey(peer), &feerate).await, | |
"Fee rate vote is redundant" | |
); |
// Since the total number of transactions is bound the following addition | ||
// and cast cannot overflow or truncate. | ||
|
||
(unsigned_count + pending_count) as u32 |
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.
(unsigned_count + pending_count) as u32 | |
(unsigned_count + pending_count).try_into().expect("Since the total number of transactions is bound the addition cannot overflow or truncate") |
Concept NACK if the goal is to replace the "wallet v1" module. The primary issue here is that creating a single UTXO for the federation effectively and unavoidably turns the federation into a "mixer" by default. While a mixer might be an interesting project from a cypherpunk perspective, it poses significant risks for guardians and gateway operators, which could hinder its adoption by most real-world communities. Additionally, it may attract unwanted attention to the project and its developers. My main objection isn't to the existence of this module, but to it being the standard or default for fedimints. The standard module should have reasonable UTXO management suitable for all use cases. At a minimum, it should avoid unnecessary mixing of UTXOs. |
@@ -6,7 +6,7 @@ if grep -E "(fedimint-mint|fedimint-wallet|fedimint-ln)" fedimint-server/Cargo.t | |||
>&2 echo "fedimint-server/Cargo.toml must not depend on modules" | |||
return 1 | |||
fi | |||
if grep -E "(fedimint-mint|fedimint-wallet|fedimint-ln-(server|client))" fedimint-testing/Cargo.toml >&2 ; then | |||
if grep -E "(fedimint-mint|fedimint-wallet-|fedimint-ln-(server|client))" fedimint-testing/Cargo.toml >&2 ; then |
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.
v2 module is also a module ... IIRC this rule is to prevent circular deps.
No description provided.