Commit 53fd3b49 authored by clabby's avatar clabby Committed by GitHub

feat(ctb): Delete `IBondManager` (#8811)

* Delete `IBondManager`

semver/slither

* @tynes nits
parent 87f50eb5
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -92,8 +92,8 @@ ...@@ -92,8 +92,8 @@
"sourceCodeHash": "0xb6cc80e4e2c5bb6b527d4b523eafb72facff75cb25de036052eab380cb2d3213" "sourceCodeHash": "0xb6cc80e4e2c5bb6b527d4b523eafb72facff75cb25de036052eab380cb2d3213"
}, },
"src/dispute/FaultDisputeGame.sol": { "src/dispute/FaultDisputeGame.sol": {
"initCodeHash": "0x86328a03426488472fea8ff7eca00e46c6601d5d0adab9f07ee1bc5f98605d48", "initCodeHash": "0xc4a78ec3e597821009e07f833edc8718b5c2211b09f9a74f43658b7576e746e0",
"sourceCodeHash": "0x52dd7c52bbb57fa0bdf80cc1993a5e3fc4ff6638cec13eeba59a4a17ac0570f0" "sourceCodeHash": "0x684aa7cc10c4c88753829f886a5e9aacff3281a2aeb485438cc7b9318c2768e7"
}, },
"src/legacy/DeployerWhitelist.sol": { "src/legacy/DeployerWhitelist.sol": {
"initCodeHash": "0x8de80fb23b26dd9d849f6328e56ea7c173cd9e9ce1f05c9beea559d1720deb3d", "initCodeHash": "0x8de80fb23b26dd9d849f6328e56ea7c173cd9e9ce1f05c9beea559d1720deb3d",
......
...@@ -99,19 +99,6 @@ ...@@ -99,19 +99,6 @@
"stateMutability": "payable", "stateMutability": "payable",
"type": "function" "type": "function"
}, },
{
"inputs": [],
"name": "bondManager",
"outputs": [
{
"internalType": "contract IBondManager",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
......
...@@ -159,19 +159,6 @@ ...@@ -159,19 +159,6 @@
"stateMutability": "payable", "stateMutability": "payable",
"type": "function" "type": "function"
}, },
{
"inputs": [],
"name": "bondManager",
"outputs": [
{
"internalType": "contract IBondManager",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
......
...@@ -20,53 +20,46 @@ ...@@ -20,53 +20,46 @@
"slot": "0", "slot": "0",
"type": "enum GameStatus" "type": "enum GameStatus"
}, },
{
"bytes": "20",
"label": "bondManager",
"offset": 0,
"slot": "1",
"type": "contract IBondManager"
},
{ {
"bytes": "32", "bytes": "32",
"label": "l1Head", "label": "l1Head",
"offset": 0, "offset": 0,
"slot": "2", "slot": "1",
"type": "Hash" "type": "Hash"
}, },
{ {
"bytes": "32", "bytes": "32",
"label": "claimData", "label": "claimData",
"offset": 0, "offset": 0,
"slot": "3", "slot": "2",
"type": "struct IFaultDisputeGame.ClaimData[]" "type": "struct IFaultDisputeGame.ClaimData[]"
}, },
{ {
"bytes": "32", "bytes": "32",
"label": "claims", "label": "claims",
"offset": 0, "offset": 0,
"slot": "4", "slot": "3",
"type": "mapping(ClaimHash => bool)" "type": "mapping(ClaimHash => bool)"
}, },
{ {
"bytes": "32", "bytes": "32",
"label": "subgames", "label": "subgames",
"offset": 0, "offset": 0,
"slot": "5", "slot": "4",
"type": "mapping(uint256 => uint256[])" "type": "mapping(uint256 => uint256[])"
}, },
{ {
"bytes": "1", "bytes": "1",
"label": "subgameAtRootResolved", "label": "subgameAtRootResolved",
"offset": 0, "offset": 0,
"slot": "6", "slot": "5",
"type": "bool" "type": "bool"
}, },
{ {
"bytes": "1", "bytes": "1",
"label": "initialized", "label": "initialized",
"offset": 1, "offset": 1,
"slot": "6", "slot": "5",
"type": "bool" "type": "bool"
} }
] ]
\ No newline at end of file
...@@ -13,13 +13,6 @@ ...@@ -13,13 +13,6 @@
"slot": "0", "slot": "0",
"type": "enum GameStatus" "type": "enum GameStatus"
}, },
{
"bytes": "20",
"label": "bondManager",
"offset": 9,
"slot": "0",
"type": "contract IBondManager"
},
{ {
"bytes": "32", "bytes": "32",
"label": "l1Head", "label": "l1Head",
......
...@@ -4,7 +4,6 @@ pragma solidity ^0.8.15; ...@@ -4,7 +4,6 @@ pragma solidity ^0.8.15;
import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol"; import { IDisputeGame } from "src/dispute/interfaces/IDisputeGame.sol";
import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol"; import { IFaultDisputeGame } from "src/dispute/interfaces/IFaultDisputeGame.sol";
import { IInitializable } from "src/dispute/interfaces/IInitializable.sol"; import { IInitializable } from "src/dispute/interfaces/IInitializable.sol";
import { IBondManager } from "src/dispute/interfaces/IBondManager.sol";
import { IBigStepper, IPreimageOracle } from "src/dispute/interfaces/IBigStepper.sol"; import { IBigStepper, IPreimageOracle } from "src/dispute/interfaces/IBigStepper.sol";
import { Clone } from "src/libraries/Clone.sol"; import { Clone } from "src/libraries/Clone.sol";
...@@ -60,9 +59,6 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver { ...@@ -60,9 +59,6 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver {
/// @inheritdoc IDisputeGame /// @inheritdoc IDisputeGame
GameStatus public status; GameStatus public status;
/// @inheritdoc IDisputeGame
IBondManager public bondManager;
/// @inheritdoc IFaultDisputeGame /// @inheritdoc IFaultDisputeGame
Hash public l1Head; Hash public l1Head;
...@@ -82,8 +78,8 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver { ...@@ -82,8 +78,8 @@ contract FaultDisputeGame is IFaultDisputeGame, Clone, ISemver {
bool internal initialized; bool internal initialized;
/// @notice Semantic version. /// @notice Semantic version.
/// @custom:semver 0.0.21 /// @custom:semver 0.0.22
string public constant version = "0.0.21"; string public constant version = "0.0.22";
/// @param _gameType The type ID of the game. /// @param _gameType The type ID of the game.
/// @param _absolutePrestate The absolute prestate of the instruction trace. /// @param _absolutePrestate The absolute prestate of the instruction trace.
......
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;
/// @title IBondManager
/// @notice The Bond Manager holds ether posted as a bond for a bond id.
interface IBondManager {
/// @notice BondPosted is emitted when a bond is posted.
/// @param bondId is the id of the bond.
/// @param owner is the address that owns the bond.
/// @param expiration is the time at which the bond expires.
/// @param amount is the amount of the bond.
event BondPosted(bytes32 bondId, address owner, uint256 expiration, uint256 amount);
/// @notice BondSeized is emitted when a bond is seized.
/// @param bondId is the id of the bond.
/// @param owner is the address that owns the bond.
/// @param seizer is the address that seized the bond.
/// @param amount is the amount of the bond.
event BondSeized(bytes32 bondId, address owner, address seizer, uint256 amount);
/// @notice BondReclaimed is emitted when a bond is reclaimed by the owner.
/// @param bondId is the id of the bond.
/// @param claiment is the address that reclaimed the bond.
/// @param amount is the amount of the bond.
event BondReclaimed(bytes32 bondId, address claiment, uint256 amount);
/// @notice Post a bond with a given id and owner.
/// @dev This function will revert if the provided bondId is already in use.
/// @param _bondId is the id of the bond.
/// @param _bondOwner is the address that owns the bond.
/// @param _minClaimHold is the minimum amount of time the owner
/// must wait before reclaiming their bond.
function post(bytes32 _bondId, address _bondOwner, uint128 _minClaimHold) external payable;
/// @notice Seizes the bond with the given id.
/// @dev This function will revert if there is no bond at the given id.
/// @param _bondId is the id of the bond.
function seize(bytes32 _bondId) external;
/// @notice Seizes the bond with the given id and distributes it to recipients.
/// @dev This function will revert if there is no bond at the given id.
/// @param _bondId is the id of the bond.
/// @param _claimRecipients is a set of addresses to split the bond amongst.
///
function seizeAndSplit(bytes32 _bondId, address[] calldata _claimRecipients) external;
/// @notice Reclaims the bond of the bond owner.
/// @dev This function will revert if there is no bond at the given id.
/// @param _bondId is the id of the bond.
function reclaim(bytes32 _bondId) external;
}
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity ^0.8.15; pragma solidity ^0.8.15;
import { IBondManager } from "./IBondManager.sol"; import { IInitializable } from "src/dispute/interfaces/IInitializable.sol";
import { IInitializable } from "./IInitializable.sol";
import "src/libraries/DisputeTypes.sol"; import "src/libraries/DisputeTypes.sol";
...@@ -37,10 +36,6 @@ interface IDisputeGame is IInitializable { ...@@ -37,10 +36,6 @@ interface IDisputeGame is IInitializable {
/// @return extraData_ Any extra data supplied to the dispute game contract by the creator. /// @return extraData_ Any extra data supplied to the dispute game contract by the creator.
function extraData() external pure returns (bytes memory extraData_); function extraData() external pure returns (bytes memory extraData_);
/// @notice Returns the address of the `BondManager` used.
/// @return bondManager_ The address of the `BondManager` used.
function bondManager() external view returns (IBondManager bondManager_);
/// @notice If all necessary information has been gathered, this function should mark the game /// @notice If all necessary information has been gathered, this function should mark the game
/// status as either `CHALLENGER_WINS` or `DEFENDER_WINS` and return the status of /// status as either `CHALLENGER_WINS` or `DEFENDER_WINS` and return the status of
/// the resolved game. It is at this stage that the bonds should be awarded to the /// the resolved game. It is at this stage that the bonds should be awarded to the
......
...@@ -8,8 +8,6 @@ ...@@ -8,8 +8,6 @@
- [The Bond Problem](#the-bond-problem) - [The Bond Problem](#the-bond-problem)
- [Simple Bond](#simple-bond) - [Simple Bond](#simple-bond)
- [Variable Bond](#variable-bond) - [Variable Bond](#variable-bond)
- [Contract Interface](#contract-interface)
- [Bond Manager Implementation](#bond-manager-implementation)
<!-- END doctoc generated TOC please keep comment here to allow auto update --> <!-- END doctoc generated TOC please keep comment here to allow auto update -->
...@@ -80,68 +78,3 @@ separate oracle contract, `GasPriceFluctuationTracker`, that tracks gas fluctuat ...@@ -80,68 +78,3 @@ separate oracle contract, `GasPriceFluctuationTracker`, that tracks gas fluctuat
within a pre-determined bounds. This replaces the ideal solution of tracking within a pre-determined bounds. This replaces the ideal solution of tracking
challenge costs over all L1 blocks, but provides a reasonable bounds. The initial challenge costs over all L1 blocks, but provides a reasonable bounds. The initial
actors posting this bond are responsible for funding this contract. actors posting this bond are responsible for funding this contract.
## Contract Interface
Below is a minimal interface for the bond manager contract.
```solidity
/**
* @title IBondManager
* @notice The IBondManager is an interface for a contract that handles bond management.
*/
interface IBondManager {
/**
* @notice Post a bond with a given id and owner.
* @dev This function will revert if the provided bondId is already in use.
* @param bondId is the id of the bond.
* @param owner is the address that owns the bond.
* @param minClaimHold is the minimum amount of time the owner must wait before reclaiming their bond.
*/
function post(bytes32 bondId, address owner, uint64 minClaimHold) external payable;
/**
* @notice Seizes the bond with the given id.
* @dev This function will revert if there is no bond at the given id.
* @param bondId is the id of the bond.
*/
function seize(bytes32 bondId) external;
/**
* @notice Seizes the bond with the given id and distributes it to recipients.
* @dev This function will revert if there is no bond at the given id.
* @param bondId is the id of the bond.
* @param recipients is a set of addresses to split the bond amongst.
*/
function seizeAndSplit(bytes32 bondId, address[] calldata recipients) external;
/**
* @notice Reclaims the bond of the bond owner.
* @dev This function will revert if there is no bond at the given id.
* @param bondId is the id of the bond.
*/
function reclaim(bytes32 bondId) external;
}
```
**Note**
The `bytes32 bondId` can be constructed using the `keccak256` hash of a given identifier.
For example, the `L2OutputOracle` can create a `bondId` by taking the `keccak256` hash of
the `l2BlockNumber` associated with the output proposal since there will only ever be one
outstanding output proposal for a given `l2BlockNumber`.
This also avoids the issue where an output proposer can have multiple bonds if bonds were
instead tied to the address of the output proposer.
## Bond Manager Implementation
Initially, the bond manager will only be used by the `L2OutputOracle` contract
for output proposals in the attestation [dispute game](./dispute-game-interface.md). Since
the attestation dispute game has a permissioned set of attestors, there are no
intermediate steps in the game that would require bonds.
In the future however, Fault-based dispute games will be introduced and will
require bond management. In addition to the bond posted by the output proposer,
bonds will be posted at each step of the dispute game. Once the game is resolved,
bonds are dispersed to either the output challengers or defenders
(including the proposer).
...@@ -225,10 +225,6 @@ interface IDisputeGame is IInitializable { ...@@ -225,10 +225,6 @@ interface IDisputeGame is IInitializable {
/// @return extraData_ Any extra data supplied to the dispute game contract by the creator. /// @return extraData_ Any extra data supplied to the dispute game contract by the creator.
function extraData() external pure returns (bytes memory extraData_); function extraData() external pure returns (bytes memory extraData_);
/// @notice Returns the address of the `BondManager` used.
/// @return bondManager_ The address of the `BondManager` used.
function bondManager() external view returns (IBondManager bondManager_);
/// @notice If all necessary information has been gathered, this function should mark the game /// @notice If all necessary information has been gathered, this function should mark the game
/// status as either `CHALLENGER_WINS` or `DEFENDER_WINS` and return the status of /// status as either `CHALLENGER_WINS` or `DEFENDER_WINS` and return the status of
/// the resolved game. It is at this stage that the bonds should be awarded to the /// the resolved game. It is at this stage that the bonds should be awarded to the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment