@@ -20,6 +20,8 @@ import (
20
20
"github.com/smartcontractkit/timelock-worker/pkg/isclosed"
21
21
)
22
22
23
+ var validNodeUrlSchemesSolana = []string {"http" , "https" }
24
+
23
25
// WorkerSolana represents a solana worker instance. It fetches periodically the latest signatures
24
26
// and transactions from the Solana RPC node and dispatches them to the scheduler.
25
27
type WorkerSolana struct {
@@ -58,8 +60,8 @@ func NewTimelockWorkerSolana(
58
60
return nil , err
59
61
}
60
62
61
- if ! slices .Contains (validNodeUrlSchemes , u .Scheme ) {
62
- return nil , fmt .Errorf ("invalid node URL: %s (accepted schemes are: %v)" , nodeURL , validNodeUrlSchemes )
63
+ if ! slices .Contains (validNodeUrlSchemesSolana , u .Scheme ) {
64
+ return nil , fmt .Errorf ("invalid node URL: %s (accepted schemes are: %v)" , nodeURL , validNodeUrlSchemesEVM )
63
65
}
64
66
65
67
timelockPubKey , instanceSeed , err := mcmssolanasdk .ParseContractAddress (timelockAddress )
@@ -178,6 +180,7 @@ func (w *WorkerSolana) pollSignatures(ctx context.Context, sigCh chan<- solana.S
178
180
w .logger .Info ("pollSignatures context cancelled" )
179
181
return
180
182
case <- ticker .C :
183
+ w .logger .Infow ("polling signatures timelock solana" , "timelockProgramKey" , w .timelockProgramKey , "lastSignature" , w .lastSignature )
181
184
var until solana.Signature
182
185
if w .lastSignature != nil {
183
186
until = * w .lastSignature
@@ -197,9 +200,10 @@ func (w *WorkerSolana) pollSignatures(ctx context.Context, sigCh chan<- solana.S
197
200
continue
198
201
}
199
202
if len (sigs ) == 0 {
203
+ w .logger .Info ("no new signatures found, poll again in the next cycle" )
200
204
continue
201
205
}
202
-
206
+ w . logger . Infow ( "found new signatures" , "numSignatures" , len ( sigs ))
203
207
slices .Reverse (sigs )
204
208
for _ , info := range sigs {
205
209
select {
@@ -363,7 +367,7 @@ func (w *WorkerSolana) handleTx(ctx context.Context, tx *rpc.TransactionWithMeta
363
367
// handleEventCancelled checks if the operation is cancelled and deletes it from the scheduler if it is.
364
368
func (w * WorkerSolana ) handleEventCancelled (_ context.Context , event SolanaTimelockCallCancelledEvent ) {
365
369
w .logger .With (operationID , fmt .Sprintf ("%x" , event .ID )).
366
- Infow ("event received, cancelling operation" , "event type" , eventCancelled )
370
+ Infow ("event Cancelled received, cancelling operation" , "event type" , eventCancelled )
367
371
368
372
w .scheduler .delFromScheduler (event .ID )
369
373
}
@@ -379,7 +383,7 @@ func (w *WorkerSolana) handleEventExecuted(ctx context.Context, event SolanaTime
379
383
return fmt .Errorf ("timelock.isOperationDone call failed (operation id: %x): %w" , event .ID , err )
380
384
}
381
385
if isDone {
382
- logger .Infow ("event received, deleting operation from scheduler" , "event type " , eventCallExecuted )
386
+ logger .Infow ("event CallExecuted received, deleting operation from scheduler" , "event type " , eventCallExecuted )
383
387
384
388
w .scheduler .delFromScheduler (event .ID )
385
389
} else {
0 commit comments