@@ -11,15 +11,6 @@ import (
1111 sdktypes "github.com/trufnetwork/sdk-go/core/types"
1212)
1313
14- // BinaryActionResultIDs defines the action IDs that return boolean results
15- // These are the binary attestation actions (IDs 6-9)
16- var BinaryActionResultIDs = map [uint16 ]bool {
17- 6 : true , // price_above_threshold
18- 7 : true , // price_below_threshold
19- 8 : true , // value_in_range
20- 9 : true , // value_equals
21- }
22-
2314// Security limits to prevent memory exhaustion attacks
2415const (
2516 maxRows = 100000 // Maximum rows in query result
@@ -569,7 +560,7 @@ func ParseBooleanResult(payload []byte) (result bool, actionID uint16, err error
569560 offset += 2
570561
571562 // Validate this is a binary action
572- if ! BinaryActionResultIDs [ actionID ] {
563+ if ! sdktypes . IsBinaryActionID ( actionID ) {
573564 return false , actionID , fmt .Errorf ("action ID %d is not a binary action (expected 6-9)" , actionID )
574565 }
575566
@@ -617,7 +608,7 @@ func ParseBooleanResultFromParsed(parsed *sdktypes.ParsedAttestationPayload) (bo
617608 }
618609
619610 // Validate this is a binary action
620- if ! BinaryActionResultIDs [ parsed .ActionID ] {
611+ if ! sdktypes . IsBinaryActionID ( parsed .ActionID ) {
621612 return false , fmt .Errorf ("action ID %d is not a binary action (expected 6-9)" , parsed .ActionID )
622613 }
623614
@@ -652,5 +643,5 @@ func ParseBooleanResultFromParsed(parsed *sdktypes.ParsedAttestationPayload) (bo
652643
653644// IsBinaryActionResult returns true if the action ID corresponds to a binary action
654645func IsBinaryActionResult (actionID uint16 ) bool {
655- return BinaryActionResultIDs [ actionID ]
646+ return sdktypes . IsBinaryActionID ( actionID )
656647}
0 commit comments