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

Optimize number of share commitments signed over when creating a WirePayForMessage #236

Closed
Tracked by #514
evan-forbes opened this issue Mar 9, 2022 · 1 comment

Comments

@evan-forbes
Copy link
Member

evan-forbes commented Mar 9, 2022

Currently, when block producers are preparing a proposal, they are requiring that the user include a commitment for that exact square size.

for _, commit := range msg.MessageShareCommitment {
if commit.K == squareSize {
shareCommit = &commit
}

This does not account for the fact that commitments do not change if the largest power of two that is smaller than the message can fit on a single row. Meaning that if the largest power of 2 that fits in a message can fit on a single row of square size x, then that commitment is valid for all square sizes >= x.

To be more efficient, block producers should also compare the the number shares taken up by the message. If a commitment for a square size that can fit the entire message in a single row is included in the WirePayForMessage, then that commitment can be used for any square size equal to or greater than that size.

we could replace the above code segment with something along the lines of

for _, commit := range msg.MessageShareCommitment {
	if commit.K == squareSize {
		shareCommit = &commit
	}
	if msgShareCount <= commit.K && commit.K <= squareSize {
		shareCommit = &commit
	}

This will allow for a user to be more confident that their message will be included in an upcoming block. Instead of creating a WirePayForMessage that includes signatures for all possible square sizes, if their message is smaller than the max square size, then they only have to the sign over commitments for square sizes that are smaller than the total number of shares that their message takes up.

With our current max square size, this wouldn't save the user from creating and including that many share commitments, but in the future if we increase the max square size significantly, then this could help reduce the size of WirePayForMessages.

@evan-forbes evan-forbes moved this to TODO in Celestia Node Mar 9, 2022
@evan-forbes evan-forbes changed the title Optimize picking square sizes when creating a WirePayForMessage Optimize number of share commitment signed over when creating a WirePayForMessage Mar 9, 2022
@evan-forbes evan-forbes changed the title Optimize number of share commitment signed over when creating a WirePayForMessage Optimize number of share commitments signed over when creating a WirePayForMessage Mar 9, 2022
@evan-forbes
Copy link
Member Author

we only use a single commitment now since #917

Repository owner moved this from TODO to Done in Celestia Node Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

No branches or pull requests

1 participant