/
challenger.go
64 lines (49 loc) · 1.67 KB
/
challenger.go
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
package challenger
import (
"context"
"crypto/ecdsa"
_ "net/http/pprof"
"sync"
"time"
abi "github.com/ethereum/go-ethereum/accounts/abi"
common "github.com/ethereum/go-ethereum/common"
ethclient "github.com/ethereum/go-ethereum/ethclient"
log "github.com/ethereum/go-ethereum/log"
bindings "github.com/refcell/op-challenger/contracts/bindings"
metrics "github.com/refcell/op-challenger/metrics"
opBindings "github.com/ethereum-optimism/optimism/op-bindings/bindings"
eth "github.com/ethereum-optimism/optimism/op-node/eth"
sources "github.com/ethereum-optimism/optimism/op-node/sources"
txmgr "github.com/ethereum-optimism/optimism/op-service/txmgr"
)
var supportedL2OutputVersion = eth.Bytes32{}
const (
// FaultDisputeGameType is the uint8 enum value for the fault dispute game
FaultDisputeGameType = 0
// ValidityDisputeGameType is the uint8 enum value for the validity dispute game
ValidityDisputeGameType = 1
// AttestationDisputeGameType is the uint8 enum value for the attestation dispute game
AttestationDisputeGameType = 2
)
// Challenger is responsible for disputing L2OutputOracle outputs
type Challenger struct {
txMgr txmgr.TxManager
wg sync.WaitGroup
done chan struct{}
log log.Logger
metr metrics.Metricer
privateKey *ecdsa.PrivateKey
from common.Address
ctx context.Context
cancel context.CancelFunc
l1Client *ethclient.Client
rollupClient *sources.RollupClient
l2ooContract *opBindings.L2OutputOracleCaller
l2ooContractAddr common.Address
l2ooABI *abi.ABI
dgfContract *bindings.MockDisputeGameFactoryCaller
dgfContractAddr common.Address
dgfABI *abi.ABI
adgABI *abi.ABI
networkTimeout time.Duration
}