-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathIBoltChallenger.sol
81 lines (67 loc) · 2.08 KB
/
IBoltChallenger.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;
interface IBoltChallenger {
enum ChallengeStatus {
Open,
Defended,
Lost
}
struct Challenge {
bytes32 id;
uint48 openedAt;
ChallengeStatus status;
address challenger;
address target;
SignedCommitment commitment;
}
struct SignedCommitment {
uint64 slot;
bytes signature;
bytes signedTx;
}
struct BlockHeaderData {
bytes32 stateRoot;
bytes32 txRoot;
uint256 blockNumber;
uint256 timestamp;
uint256 baseFee;
}
struct AccountData {
uint256 nonce;
uint256 balance;
}
struct Proof {
bytes blockHeaderRLP;
bytes accountMerkleProof;
bytes txMerkleProof;
uint256 blockNumber;
uint256 txIndexInBlock;
}
error SlotInTheFuture();
error BlockIsNotFinalized();
error InsufficientChallengeBond();
error ChallengeAlreadyExists();
error ChallengeAlreadyResolved();
error ChallengeDoesNotExist();
error BlockIsTooOld();
error InvalidBlockHash();
error AccountDoesNotExist();
error TransactionNotIncluded();
error WrongTransactionHashProof();
error InvalidBlockNumber();
error BondTransferFailed();
error ChallengeNotExpired();
event ChallengeOpened(bytes32 indexed challengeId, address indexed challenger, address indexed target);
event ChallengeDefended(bytes32 indexed challengeId);
event ChallengeLost(bytes32 indexed challengeId);
function getAllChallenges() external view returns (Challenge[] memory);
function getOpenChallenges() external view returns (Challenge[] memory);
function getChallengeByID(
bytes32 challengeID
) external view returns (Challenge memory);
function openChallenge(
SignedCommitment calldata commitment
) external payable;
function resolveRecentChallenge(bytes32 challengeID, Proof calldata proof) external;
function resolveChallenge(bytes32 challengeID, Proof calldata proof) external;
}