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

Reuse witnesses for identical secrets when building transactions #459

Merged
merged 5 commits into from
May 24, 2023

Conversation

Voxelot
Copy link
Member

@Voxelot Voxelot commented May 24, 2023

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.

@Voxelot Voxelot marked this pull request as ready for review May 24, 2023 17:43
@Voxelot Voxelot requested a review from a team May 24, 2023 17:44
Copy link
Collaborator

@xgreenx xgreenx left a 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

@Voxelot
Copy link
Member Author

Voxelot commented May 24, 2023

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.

xgreenx
xgreenx previously approved these changes May 24, 2023
CHANGELOG.md Outdated Show resolved Hide resolved
Co-authored-by: Green Baneling <XgreenX9999@gmail.com>
@Voxelot Voxelot requested a review from xgreenx May 24, 2023 18:44
@Voxelot
Copy link
Member Author

Voxelot commented May 24, 2023

Made a specs ticket here: FuelLabs/fuel-specs#488

@Voxelot Voxelot added this pull request to the merge queue May 24, 2023
Merged via the queue into master with commit 736987b May 24, 2023
@Voxelot Voxelot deleted the Voxelot/witness-reuse branch May 24, 2023 19:43
@@ -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 {
Copy link
Contributor

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 👍

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.

Witness signature: dedup by owner
3 participants