Skip to content

Commit

Permalink
Node/Watcher: Update solana min accounts check (#3367)
Browse files Browse the repository at this point in the history
  • Loading branch information
bruce-riley authored Sep 11, 2023
1 parent bd666ef commit 846deb2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions node/pkg/watchers/solana/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ func (c ConsistencyLevel) Commitment() (rpc.CommitmentType, error) {
}

const (
postMessageInstructionNumAccounts = 9
postMessageInstructionID = 0x01
postMessageUnreliableInstructionID = 0x08
accountPrefixReliable = "msg"
accountPrefixUnreliable = "msu"
postMessageInstructionMinNumAccounts = 8
postMessageInstructionID = 0x01
postMessageUnreliableInstructionID = 0x08
accountPrefixReliable = "msg"
accountPrefixUnreliable = "msu"
)

// PostMessageData represents the user-supplied, untrusted instruction data
Expand Down Expand Up @@ -609,9 +609,9 @@ func (s *SolanaWatcher) processInstruction(ctx context.Context, logger *zap.Logg
return false, nil
}

if len(inst.Accounts) != postMessageInstructionNumAccounts {
return false, fmt.Errorf("invalid number of accounts: %d instead of %d",
len(inst.Accounts), postMessageInstructionNumAccounts)
if len(inst.Accounts) < postMessageInstructionMinNumAccounts {
return false, fmt.Errorf("invalid number of accounts: %d, must be at least %d",
len(inst.Accounts), postMessageInstructionMinNumAccounts)
}

// Decode instruction data (UNTRUSTED)
Expand Down

0 comments on commit 846deb2

Please sign in to comment.