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

feat: proofClaim in Rollup #8636

Merged

Conversation

just-mitch
Copy link
Contributor

@just-mitch just-mitch commented Sep 19, 2024

Fix #8608

Add the proofClaim to the rollup.

Update the canPrune logic to account for it.

@just-mitch just-mitch changed the title Mt/8608-track-proofclaim-in-rollup feat: proofClaim in Rollup Sep 19, 2024
function _prune() internal {
delete proofClaim;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

otherwise it will be there when we reorg

Copy link
Contributor

Choose a reason for hiding this comment

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

When reached in a call to prune (outside of proposals) this will incur higher cost than something like the approach we discussed with the forced inclusion. Here it is fix size, and should overall make it slightly cheaper when happening in the intended flow, e.g., as part of proposing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -44,23 +44,29 @@ library Errors {
error Outbox__BlockNotProven(uint256 l2BlockNumber); // 0x0e194a6d

// Rollup
Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorted alphabetically

Copy link
Contributor

@LHerskind LHerskind left a comment

Choose a reason for hiding this comment

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

Did not read through the full test, but here are some comments for now.

@@ -53,6 +53,9 @@ contract Rollup is Leonidas, IRollup, ITestRollup {
// @todo #8018
uint256 public constant TIMELINESS_PROVING_IN_SLOTS = 100;

uint256 public constant CLAIM_DURATION_IN_L2_SLOTS = 13;
uint256 public constant PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST = 1000;
Copy link
Contributor

Choose a reason for hiding this comment

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

For the sake of sanity we should probably shove this into a constants file, since we will likely be needing it in the node as well, so having it in one place should help us a bit there.

function _prune() internal {
delete proofClaim;
Copy link
Contributor

Choose a reason for hiding this comment

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

When reached in a call to prune (outside of proposals) this will incur higher cost than something like the approach we discussed with the forced inclusion. Here it is fix size, and should overall make it slightly cheaper when happening in the intended flow, e.g., as part of proposing.

@@ -156,6 +160,59 @@ contract Rollup is Leonidas, IRollup, ITestRollup {
vkTreeRoot = _vkTreeRoot;
}

function claimEpochProofRight(DataStructures.EpochProofQuote calldata _quote)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I like the claim name, mainly as claiming usually is claiming rewards or the like, but here your claim is practically "reducing" your balance because of the stake.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it's a tricky thing to name, since the proposer is the one doing it, but the provers bond is the one getting staked. Open to suggestions.

address currentProposer = getCurrentProposer();
uint256 epochToProve = getEpochToProve();

if (currentProposer != address(0) && currentProposer != msg.sender) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If currentProposer == address(0) you don't have a committee, does it become weird with epochs then? At that point issue is essentially that sure you can have an epoch, but as anyone could propose into it, it seems likely that you would not end up being able to rely on it, so seems more likely that it would be the "proposeAndProof" at the same time similar to the fallback. Might just be the sanest to be in fallback if there is no committee actually.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Might just be the sanest to be in fallback if there is no committee actually.

I think I agree with this. We'll see how this needs to change in response when based fallback lands.

}

if (currentSlot % Constants.AZTEC_EPOCH_DURATION >= CLAIM_DURATION_IN_L2_SLOTS) {
revert Errors.Rollup__NotInClaimPhase(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a more useful error message would likely be:

error Rollup__NotInClaimPhase(uint256 slotInEpoch, uint256 claimSlotsInEpoch);

Reasoning being that you then get information that is more useful for debugging without needing the figure out what the constant is. This way if you get 13, 13 you know instantly that it was sent too late and you know it must be within the first 13 slots so you were 1 off.

@@ -53,6 +53,9 @@ contract Rollup is Leonidas, IRollup, ITestRollup {
// @todo #8018
uint256 public constant TIMELINESS_PROVING_IN_SLOTS = 100;
Copy link
Contributor

Choose a reason for hiding this comment

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

This one is kinda redundant with your stuff just below 🤷

revert Errors.Rollup__QuoteExpired(currentSlot, _quote.validUntilSlot);
}

address bondProvider = PROOF_COMMITMENT_ESCROW.stakeBond(_quote);
Copy link
Contributor

Choose a reason for hiding this comment

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

You stake, but there won't ever be an unstake. Bye bye money. See comment in other pr.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was waiting to unstake the bond until the proof of epoch landed.

I filed #8652.

l1-contracts/test/Rollup.t.sol Outdated Show resolved Hide resolved
l1-contracts/test/Rollup.t.sol Outdated Show resolved Hide resolved
l1-contracts/test/Rollup.t.sol Outdated Show resolved Hide resolved
@just-mitch just-mitch merged commit 77cdb19 into mt/8572-prune-if-needed Sep 20, 2024
46 checks passed
@just-mitch just-mitch deleted the mt/8608-track-proofclaim-in-rollup branch September 20, 2024 00:19
just-mitch added a commit that referenced this pull request Sep 20, 2024
Fix #8608 

Add the proofClaim to the rollup.

Update the `canPrune` logic to account for it.
just-mitch added a commit that referenced this pull request Sep 27, 2024
Fix #8608

Add the proofClaim to the rollup.

Update the `canPrune` logic to account for it.
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