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

Build the commitment without bincode #2194

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Build the commitment without bincode #2194

wants to merge 3 commits into from

Conversation

ImJeremyHe
Copy link
Member

This PR builds the commitment of v0.3 header without bincode, which helps other language be align with the Rust code.

This PR:

  • Implements the Committable trait for some types required in v0.3 Header
  • Modifies the commit in v0.3 Header
  • Updates the reference test

This PR does not:

  • Change any other logic

Relevant PR:

EspressoSystems/espresso-sequencer-go#52

Copy link
Contributor

@tbro tbro left a comment

Choose a reason for hiding this comment

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

FYI this code will not be enabled this year, so this probably shouldn't be a big priority.

fn tag() -> String {
"BID_TX".to_string()
}

fn commit(&self) -> Commitment<Self> {
let comm = committable::RawCommitmentBuilder::new(&Self::tag())
.field("body", self.body.commit())
Copy link
Contributor

@tbro tbro Oct 22, 2024

Choose a reason for hiding this comment

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

I think it was probably a previous mistake to have an explicit commitment for BidTxBody. The BidTx can just access body methods (or fields) directly in its own commitment. Having a body is a structural necessity for signing but behavior should act as if all the fields are on BidTx.

Copy link
Member Author

@ImJeremyHe ImJeremyHe Oct 23, 2024

Choose a reason for hiding this comment

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

Do you mean we don't need to implemnt the commitable for the BodyTxBody? But its commit function is used here

let signature = FeeAccount::sign_builder_message(key, self.commit().as_ref())?;

And BodyTx has an extra field signature. I am not sure if we need to build the commitment of BodyTx with the signature field. But since it is shown in the header, I think it's better to build the commitment with it.

fn tag() -> String {
"BID_TX_BODY".to_string()
}

Copy link
Contributor

@tbro tbro Oct 22, 2024

Choose a reason for hiding this comment

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

It doesn't appear in the diff, but on line 57 there is another call to bincode. We should remove this one as well, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

@ImJeremyHe
Copy link
Member Author

@tbro I wonder which version will be used on our mainnet? v0.2?

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.

2 participants