Skip to content

Commit

Permalink
update escrow interface and quote structure
Browse files Browse the repository at this point in the history
  • Loading branch information
just-mitch committed Sep 24, 2024
1 parent 09d3064 commit d83289e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
6 changes: 3 additions & 3 deletions l1-contracts/src/core/Rollup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,17 @@ contract Rollup is Leonidas, IRollup, ITestRollup {
// We don't currently unstake,
// but we will as part of https://github.com/AztecProtocol/aztec-packages/issues/8652.
// Blocked on submitting epoch proofs to this contract.
address bondProvider = PROOF_COMMITMENT_ESCROW.stakeBond(_quote.signature, _quote.bondAmount);
PROOF_COMMITMENT_ESCROW.stakeBond(_quote.bondAmount, _quote.prover);

proofClaim = DataStructures.EpochProofClaim({
epochToProve: epochToProve,
basisPointFee: _quote.basisPointFee,
bondAmount: _quote.bondAmount,
bondProvider: bondProvider,
bondProvider: _quote.prover,
proposerClaimant: msg.sender
});

emit ProofRightClaimed(epochToProve, bondProvider, msg.sender, _quote.bondAmount, currentSlot);
emit ProofRightClaimed(epochToProve, _quote.prover, msg.sender, _quote.bondAmount, currentSlot);
}

/**
Expand Down
7 changes: 2 additions & 5 deletions l1-contracts/src/core/interfaces/IProofCommitmentEscrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import {SignatureLib} from "../libraries/SignatureLib.sol";
interface IProofCommitmentEscrow {
function deposit(uint256 _amount) external;
function withdraw(uint256 _amount) external;
// returns the address of the bond provider
function stakeBond(SignatureLib.Signature calldata _signature, uint256 _bondAmount)
external
returns (address);
function unstakeBond(uint256 _bondAmount) external;
function stakeBond(uint256 _bondAmount, address _prover) external;
function unstakeBond(uint256 _bondAmount, address _prover) external;
}
1 change: 1 addition & 0 deletions l1-contracts/src/core/libraries/DataStructures.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ library DataStructures {
uint256 epochToProve;
uint256 validUntilSlot;
uint256 bondAmount;
address prover;
uint32 basisPointFee;
}

Expand Down
11 changes: 3 additions & 8 deletions l1-contracts/src/mock/MockProofCommitmentEscrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,11 @@ contract MockProofCommitmentEscrow is IProofCommitmentEscrow {
// do nothing
}

function unstakeBond(uint256 _amount) external override {
function unstakeBond(uint256 _amount, address _prover) external override {
// do nothing
}

function stakeBond(SignatureLib.Signature calldata, uint256)
external
pure
override
returns (address)
{
return address(0);
function stakeBond(uint256 _amount, address _prover) external override {
// do nothing
}
}
12 changes: 11 additions & 1 deletion l1-contracts/test/Rollup.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ contract RollupTest is DecoderBase {
epochToProve: 0,
validUntilSlot: 1,
bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(),
prover: address(this),
basisPointFee: 0
});

Expand All @@ -115,6 +116,7 @@ contract RollupTest is DecoderBase {
epochToProve: 1,
validUntilSlot: 1,
bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(),
prover: address(this),
basisPointFee: 0
});

Expand All @@ -132,6 +134,7 @@ contract RollupTest is DecoderBase {
epochToProve: 0,
validUntilSlot: 1,
bondAmount: 0,
prover: address(this),
basisPointFee: 0
});

Expand All @@ -153,6 +156,7 @@ contract RollupTest is DecoderBase {
epochToProve: 0,
validUntilSlot: 0,
bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(),
prover: address(this),
basisPointFee: 0
});

Expand All @@ -172,6 +176,7 @@ contract RollupTest is DecoderBase {
epochToProve: 0,
validUntilSlot: 1,
bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(),
prover: address(0),
basisPointFee: 0
});

Expand Down Expand Up @@ -207,6 +212,7 @@ contract RollupTest is DecoderBase {
epochToProve: 0,
validUntilSlot: 1,
bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(),
prover: address(this),
basisPointFee: 0
});

Expand Down Expand Up @@ -242,6 +248,7 @@ contract RollupTest is DecoderBase {
epochToProve: 0,
validUntilSlot: 1,
bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(),
prover: address(this),
basisPointFee: 0
});

Expand All @@ -265,6 +272,7 @@ contract RollupTest is DecoderBase {
epochToProve: 0,
validUntilSlot: 2 * Constants.AZTEC_EPOCH_DURATION,
bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(),
prover: address(this),
basisPointFee: 0
});

Expand All @@ -286,6 +294,7 @@ contract RollupTest is DecoderBase {
epochToProve: 0,
validUntilSlot: 2 * Constants.AZTEC_EPOCH_DURATION,
bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(),
prover: address(this),
basisPointFee: 0
});

Expand Down Expand Up @@ -313,6 +322,7 @@ contract RollupTest is DecoderBase {
epochToProve: 0,
validUntilSlot: 2 * Constants.AZTEC_EPOCH_DURATION,
bondAmount: rollup.PROOF_COMMITMENT_MIN_BOND_AMOUNT_IN_TST(),
prover: address(this),
basisPointFee: 0
});

Expand All @@ -329,7 +339,7 @@ contract RollupTest is DecoderBase {
vm.expectEmit(true, true, true, true);
emit IRollup.ProofRightClaimed(
quote.epochToProve,
address(0),
address(this),
address(this),
quote.bondAmount,
Constants.AZTEC_EPOCH_DURATION * 2
Expand Down

0 comments on commit d83289e

Please sign in to comment.