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

mock: add proven tx builder #474

Merged
merged 1 commit into from
Feb 28, 2024
Merged

mock: add proven tx builder #474

merged 1 commit into from
Feb 28, 2024

Conversation

hackaugusto
Copy link
Contributor

@hackaugusto hackaugusto commented Feb 16, 2024

Adds a mock builder for proven transactions.

Prep work for 0xPolygonMiden/miden-node#79

Note: This is based on top of #479 , which fixes the clippy warnings.


fn to_envelope(&self) -> NoteEnvelope {
NoteEnvelope::new(self.id(), self.metadata())
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ToEnvelope requires PartialEq, so I couldn't use trait objects.
The OutputNotes<T> struct is parametrized, and ProvenTransaction requires it to be OutputNotes<NoteEnvelope>. So I can't the generic OutputNotes<T> constructor.

/// Each transaction needs a unique builder.
#[derive(Debug, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
pub struct ProvenTransactionBuilder {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this meant to replace MockProvenTxBuilder in miden-node?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it is possible, I would think it is a good idea. The rationale is that having fewer utilities doing the same is best, and the utilities in miden-base can be used on the other projects, like miden-client.

@hackaugusto hackaugusto force-pushed the hacka-proven-tx-builder branch 2 times, most recently from 357c06d to 4ace031 Compare February 23, 2024 13:06
@hackaugusto hackaugusto changed the base branch from main to hacka-fix-clippy-redundant-import-warning February 23, 2024 13:07
@hackaugusto hackaugusto force-pushed the hacka-fix-clippy-redundant-import-warning branch from 9f3ea1f to 188e6d6 Compare February 26, 2024 16:10
Base automatically changed from hacka-fix-clippy-redundant-import-warning to main February 26, 2024 16:33
@hackaugusto hackaugusto requested a review from plafer February 27, 2024 17:38
@hackaugusto hackaugusto force-pushed the hacka-proven-tx-builder branch from 4ace031 to 91c0918 Compare February 27, 2024 17:39
@hackaugusto
Copy link
Contributor Author

@bobbinth or @plafer , can I get a review of this PR?

@hackaugusto hackaugusto force-pushed the hacka-proven-tx-builder branch from 91c0918 to 69e040d Compare February 28, 2024 16:42
Copy link
Contributor

@plafer plafer left a comment

Choose a reason for hiding this comment

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

LGTM

mock/Cargo.toml Outdated Show resolved Hide resolved
mock/Cargo.toml Outdated Show resolved Hide resolved
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you! I left a couple of comments about the dependencies which hopefully help with the failing CI.

On a broader note, I think we may need to revisit the mock crate soon. Specifically:

  • I'm not sure we actually use any of the serialized blockchain data and what we currently have there may be obsolete.
  • The crate has features to enable no_std - but it is actually not compatible with no_std (e.g., importing it without default features causes issues on the node).

Let's create an issue for this.

@hackaugusto hackaugusto force-pushed the hacka-proven-tx-builder branch from 69e040d to 577fbc5 Compare February 28, 2024 17:51
@hackaugusto hackaugusto mentioned this pull request Feb 28, 2024
@hackaugusto hackaugusto merged commit 4b843cc into main Feb 28, 2024
8 checks passed
@hackaugusto hackaugusto deleted the hacka-proven-tx-builder branch February 28, 2024 18:05
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