-
Notifications
You must be signed in to change notification settings - Fork 93
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
Reuse witnesses for identical secrets when building transactions #459
Conversation
…append a new witness when adding an unsigned coin
# Conflicts: # fuel-tx/src/builder.rs
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.
Do we want to add a new validity rule: Each witness should be unique? It also will remove duplicate contracts from the transaction
We could, although that should go through the specs first. |
Co-authored-by: Green Baneling <[email protected]>
Made a specs ticket here: FuelLabs/fuel-specs#488 |
@@ -278,6 +281,20 @@ impl<Tx: Buildable> TransactionBuilder<Tx> { | |||
self | |||
} | |||
|
|||
/// Adds a secret to the builder, and adds a corresponding witness if it's a new entry | |||
#[cfg(feature = "std")] | |||
fn upsert_secret(&mut self, secret_key: SecretKey) -> u8 { |
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.
upsert
- I had to look that one up 👍
This PR fixes #440 by reusing witness data for matching keys.
It also adds a breaking change by requiring add_unsigned_input for plain transaction (non-builder mode) to specify a witness index instead of naively adding a new witness for each input automatically.