-
Notifications
You must be signed in to change notification settings - Fork 187
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
Blob verification changes #321
Conversation
} | ||
|
||
// make sure that the stake signed for is greater than the given confirmationThresholdPercentage | ||
require(uint8(blobVerificationProof.batchMetadata.batchHeader.signedStakeForQuorums[uint8(blobVerificationProof.quorumThresholdIndexes[i])]) |
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.
Should we rename quorumThresholdIndexes
to just quorumIndices
?
@@ -29,6 +25,12 @@ abstract contract EigenDAServiceManagerStorage is IEigenDAServiceManager { | |||
* have to serve after they've deregistered. | |||
*/ | |||
uint32 public constant BLOCK_STALE_MEASURE = 150; | |||
|
|||
/// @notice The quorum adversary threshold percentages | |||
bytes public constant quorumAdversaryThresholdPercentages = hex"2121"; |
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.
This looks very cryptic. Can we comment on what this means?
IEigenDAServiceManager eigenDAServiceManager, | ||
uint256 quorumNumber | ||
) public view returns(uint8 adversaryThresholdPercentage) { | ||
if(eigenDAServiceManager.quorumAdversaryThresholdPercentages().length > quorumNumber){ |
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.
should it be >=
?
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.
should be > I think. If only quorum 0 and 1 are set we want to make sure those numbers are less than the length of the byte array (2)
require(msg.value == stakeRequired, "MockRollup.registerValidator: Must send stake required to register"); | ||
require(!validators[msg.sender], "MockRollup.registerValidator: Validator already registered"); | ||
require(!blacklist[msg.sender], "MockRollup.registerValidator: Validator blacklisted"); | ||
validators[msg.sender] = true; | ||
} | ||
|
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.
can anyone call mockrollup postcommitment?
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.
yes
require(validators[msg.sender], "MockRollup.postCommitment: Validator not registered"); | ||
require(commitments[block.timestamp].validator == address(0), "MockRollup.postCommitment: Commitment already posted"); | ||
// require commitment has not already been posted | ||
require(commitments[block.timestamp].confirmer == address(0), "MockRollup.postCommitment: Commitment already posted"); |
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.
should there be a check on who can call confirmer? or should the comment be not a confirmer?
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.
I removed the check to simplify so that we can just use any address to verify the blobs
@@ -45,7 +45,7 @@ interface IEigenDAServiceManager is IServiceManager { | |||
struct BatchHeader { | |||
bytes32 blobHeadersRoot; | |||
bytes quorumNumbers; // each byte is a different quorum number | |||
bytes quorumThresholdPercentages; // every bytes is an amount less than 100 specifying the percentage of stake | |||
bytes signedStakeForQuorums; // every bytes is an amount less than 100 specifying the percentage of stake | |||
// the must have signed in the corresponding quorum in `quorumNumbers` |
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.
"must have signed" -> "have actually signed"? The former is the threshold, whereas this looks the actual signed stake
), | ||
confirmedQuorumsBitmap | ||
), | ||
"EigenDARollupUtils.verifyBlob: confirmed quorums are not a subset of the required quorums" |
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.
nit: error message is reversed, should be "required quorums are not a subset of the confirmed quorums"
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.
good catch
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.
Just some nits, lgtm otherwise
* @notice gets the adversary threshold percentage for a given quorum | ||
* @param eigenDAServiceManager the contract in which the batch was confirmed | ||
* @param quorumNumber the quorum number to get the adversary threshold percentage for | ||
* @dev returns 0 if the quorumNumber is not found |
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.
There is no clause setting to 0 below for invalid quorumNumber. Does it implicit do so in Sol? Is it a good practice to set it explicitly?
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.
Yes because adversaryThresholdPercentage is defined as 0 by default with return it will return zero if a quorum is not found
Why are these changes needed?
We need to include canonical values for quorums and verify those values in our blob verification
Checks