File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ type TimelockCallScheduled interface {
2626 Index () int
2727 BlockNumber () * big.Int
2828 TxHash () string
29+ Predecessor () eth.Hash
30+ Salt () eth.Hash
2931}
3032
3133type Scheduler interface {
Original file line number Diff line number Diff line change 44 "fmt"
55 "math/big"
66
7+ eth "github.com/ethereum/go-ethereum/common"
78 bindings "github.com/smartcontractkit/ccip-owner-contracts/gethwrappers"
89)
910
@@ -34,3 +35,11 @@ func (cs *evmTimelockCallScheduled) BlockNumber() *big.Int {
3435func (cs * evmTimelockCallScheduled ) TxHash () string {
3536 return fmt .Sprintf ("%x" , cs .callScheduled .Raw .TxHash [:])
3637}
38+
39+ func (cs * evmTimelockCallScheduled ) Predecessor () eth.Hash {
40+ return cs .callScheduled .Predecessor
41+ }
42+
43+ func (cs * evmTimelockCallScheduled ) Salt () eth.Hash {
44+ return cs .callScheduled .Salt
45+ }
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ package timelock
22
33import (
44 "math/big"
5+
6+ eth "github.com/ethereum/go-ethereum/common"
57)
68
79var _ TimelockCallScheduled = NewEVMTimelockCallScheduled (nil )
@@ -31,3 +33,11 @@ func (cs *solanaTimelockCallScheduled) BlockNumber() *big.Int {
3133func (cs * solanaTimelockCallScheduled ) TxHash () string {
3234 return cs .callScheduledEvent .TxHash
3335}
36+
37+ func (cs * solanaTimelockCallScheduled ) Predecessor () eth.Hash {
38+ return cs .callScheduledEvent .Predecessor
39+ }
40+
41+ func (cs * solanaTimelockCallScheduled ) Salt () eth.Hash {
42+ return cs .callScheduledEvent .Salt
43+ }
Original file line number Diff line number Diff line change 88 "math/big"
99 "strings"
1010
11+ eth "github.com/ethereum/go-ethereum/common"
1112 bin "github.com/gagliardetto/binary"
1213 "github.com/gagliardetto/solana-go"
1314 "github.com/gagliardetto/solana-go/rpc"
@@ -34,8 +35,8 @@ type SolanaTimelockCallScheduledEvent struct {
3435 ID operationKey
3536 Index uint64
3637 Target solana.PublicKey
37- Predecessor operationKey
38- Salt [ 32 ] byte
38+ Predecessor eth. Hash
39+ Salt eth. Hash
3940 Delay uint64
4041 Data []byte
4142 BlockNumber * big.Int `borsh_skip:"true"`
Original file line number Diff line number Diff line change @@ -12,14 +12,16 @@ import (
1212
1313 "github.com/gagliardetto/solana-go"
1414 "github.com/gagliardetto/solana-go/rpc"
15-
1615 "go.uber.org/zap"
16+
17+ mcmssolanasdk "github.com/smartcontractkit/mcms/sdk/solana"
1718)
1819
1920// WorkerSolana represents a solana worker instance. It fetches periodically the latest signatures
2021// and transactions from the Solana RPC node and dispatches them to the scheduler.
2122type WorkerSolana struct {
2223 solanaClient * rpc.Client
24+ timelockAddress string
2325 timelockProgramKey solana.PublicKey
2426 pollPeriod int64
2527 listenerPollPeriod int64
@@ -28,6 +30,7 @@ type WorkerSolana struct {
2830 logger * zap.SugaredLogger
2931 privateKey solana.PrivateKey
3032 lastSignature * solana.Signature // last signature processed
33+ inspector * mcmssolanasdk.TimelockInspector
3134 scheduler Scheduler
3235}
3336
@@ -80,12 +83,13 @@ func NewTimelockWorkerSolana(
8083 dryRun : dryRun ,
8184 logger : logger ,
8285 privateKey : privateKeySolana ,
86+ inspector : mcmssolanasdk .NewTimelockInspector (client ),
8387 }
8488
8589 if dryRun {
86- tWorker .scheduler = nil // TODO: add solana nopScheduler implementation
90+ tWorker .scheduler = newNopScheduler ( logger )
8791 } else {
88- tWorker .scheduler = nil // TODO: add solana Scheduler implementation
92+ tWorker .scheduler = newScheduler ( time . Duration ( pollPeriod ) * time . Second , logger , tWorker . execute )
8993 }
9094
9195 return tWorker , nil
You can’t perform that action at this time.
0 commit comments