From d83289eae6e0a4d5bd058778eac8a88da0f5754a Mon Sep 17 00:00:00 2001 From: Mitch Date: Tue, 24 Sep 2024 10:19:42 -0400 Subject: [PATCH] update escrow interface and quote structure --- l1-contracts/src/core/Rollup.sol | 6 +++--- .../src/core/interfaces/IProofCommitmentEscrow.sol | 7 ++----- l1-contracts/src/core/libraries/DataStructures.sol | 1 + l1-contracts/src/mock/MockProofCommitmentEscrow.sol | 11 +++-------- l1-contracts/test/Rollup.t.sol | 12 +++++++++++- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/l1-contracts/src/core/Rollup.sol b/l1-contracts/src/core/Rollup.sol index d9d26527873..40dab5df5e9 100644 --- a/l1-contracts/src/core/Rollup.sol +++ b/l1-contracts/src/core/Rollup.sol @@ -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); } /** diff --git a/l1-contracts/src/core/interfaces/IProofCommitmentEscrow.sol b/l1-contracts/src/core/interfaces/IProofCommitmentEscrow.sol index 77b3fba206c..5aa2be81ec8 100644 --- a/l1-contracts/src/core/interfaces/IProofCommitmentEscrow.sol +++ b/l1-contracts/src/core/interfaces/IProofCommitmentEscrow.sol @@ -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; } diff --git a/l1-contracts/src/core/libraries/DataStructures.sol b/l1-contracts/src/core/libraries/DataStructures.sol index f22eb10cd0d..8a114ce55c0 100644 --- a/l1-contracts/src/core/libraries/DataStructures.sol +++ b/l1-contracts/src/core/libraries/DataStructures.sol @@ -87,6 +87,7 @@ library DataStructures { uint256 epochToProve; uint256 validUntilSlot; uint256 bondAmount; + address prover; uint32 basisPointFee; } diff --git a/l1-contracts/src/mock/MockProofCommitmentEscrow.sol b/l1-contracts/src/mock/MockProofCommitmentEscrow.sol index 9f62f7b76c7..89e61d3c241 100644 --- a/l1-contracts/src/mock/MockProofCommitmentEscrow.sol +++ b/l1-contracts/src/mock/MockProofCommitmentEscrow.sol @@ -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 } } diff --git a/l1-contracts/test/Rollup.t.sol b/l1-contracts/test/Rollup.t.sol index 5c318419316..27e20595c59 100644 --- a/l1-contracts/test/Rollup.t.sol +++ b/l1-contracts/test/Rollup.t.sol @@ -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 }); @@ -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 }); @@ -132,6 +134,7 @@ contract RollupTest is DecoderBase { epochToProve: 0, validUntilSlot: 1, bondAmount: 0, + prover: address(this), basisPointFee: 0 }); @@ -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 }); @@ -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 }); @@ -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 }); @@ -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 }); @@ -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 }); @@ -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 }); @@ -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 }); @@ -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