diff --git a/fhevm-engine/fhevm-go-coproc/fhevm/fhelib.go b/fhevm-engine/fhevm-go-coproc/fhevm/fhelib.go index 3de00751..1b92f33b 100644 --- a/fhevm-engine/fhevm-go-coproc/fhevm/fhelib.go +++ b/fhevm-engine/fhevm-go-coproc/fhevm/fhelib.go @@ -56,19 +56,19 @@ func FheLibMethods() []*FheLibMethod { Name: "fheBitAnd", ArgTypes: "(uint256,uint256,bytes1)", runFunction: fheBitAndRun, - ScalarSupport: false, + ScalarSupport: true, }, { Name: "fheBitOr", ArgTypes: "(uint256,uint256,bytes1)", runFunction: fheBitOrRun, - ScalarSupport: false, + ScalarSupport: true, }, { Name: "fheBitXor", ArgTypes: "(uint256,uint256,bytes1)", runFunction: fheBitXorRun, - ScalarSupport: false, + ScalarSupport: true, }, { Name: "fheShl", diff --git a/fhevm-engine/fhevm-go-coproc/fhevm/fhelib_ops.go b/fhevm-engine/fhevm-go-coproc/fhevm/fhelib_ops.go index 883ad58f..080c19cb 100644 --- a/fhevm-engine/fhevm-go-coproc/fhevm/fhelib_ops.go +++ b/fhevm-engine/fhevm-go-coproc/fhevm/fhelib_ops.go @@ -342,36 +342,33 @@ func fheBitAndRun(sess CoprocessorSession, unslicedInput []byte, _ ExtraData, ou } operation := FheBitAnd - if !isScalar { - lhs, rhs, err := get2FheOperands(sess, input) - if err != nil { - return err - } + lhs, rhs, err := get2FheOperands(sess, input) + if err != nil { + return err + } - err = sess.GetStore().InsertComputation(ComputationToInsert{ - Operation: operation, - OutputHandle: outputHandle, - Operands: []ComputationOperand{ - { - Handle: lhs, - FheUintType: handleType(lhs), - IsScalar: false, - }, - { - Handle: rhs, - FheUintType: handleType(rhs), - IsScalar: isScalar, - }, + err = sess.GetStore().InsertComputation(ComputationToInsert{ + Operation: operation, + OutputHandle: outputHandle, + Operands: []ComputationOperand{ + { + Handle: lhs, + FheUintType: handleType(lhs), + IsScalar: false, }, - }) - if err != nil { - return err - } - - return nil - } else { - return errors.New("scalar fheBitAnd is not supported") + { + Handle: rhs, + FheUintType: handleType(rhs), + IsScalar: isScalar, + }, + }, + }) + if err != nil { + return err } + + return nil + } func fheBitOrRun(sess CoprocessorSession, unslicedInput []byte, _ ExtraData, outputHandle []byte) error { @@ -386,36 +383,32 @@ func fheBitOrRun(sess CoprocessorSession, unslicedInput []byte, _ ExtraData, out } operation := FheBitOr - if !isScalar { - lhs, rhs, err := get2FheOperands(sess, input) - if err != nil { - return err - } + lhs, rhs, err := get2FheOperands(sess, input) + if err != nil { + return err + } - err = sess.GetStore().InsertComputation(ComputationToInsert{ - Operation: operation, - OutputHandle: outputHandle, - Operands: []ComputationOperand{ - { - Handle: lhs, - FheUintType: handleType(lhs), - IsScalar: false, - }, - { - Handle: rhs, - FheUintType: handleType(rhs), - IsScalar: isScalar, - }, + err = sess.GetStore().InsertComputation(ComputationToInsert{ + Operation: operation, + OutputHandle: outputHandle, + Operands: []ComputationOperand{ + { + Handle: lhs, + FheUintType: handleType(lhs), + IsScalar: false, }, - }) - if err != nil { - return err - } - - return nil - } else { - return errors.New("scalar fheBitOr is not supported") + { + Handle: rhs, + FheUintType: handleType(rhs), + IsScalar: isScalar, + }, + }, + }) + if err != nil { + return err } + + return nil } func fheBitXorRun(sess CoprocessorSession, unslicedInput []byte, _ ExtraData, outputHandle []byte) error { @@ -430,36 +423,32 @@ func fheBitXorRun(sess CoprocessorSession, unslicedInput []byte, _ ExtraData, ou } operation := FheBitXor - if !isScalar { - lhs, rhs, err := get2FheOperands(sess, input) - if err != nil { - return err - } + lhs, rhs, err := get2FheOperands(sess, input) + if err != nil { + return err + } - err = sess.GetStore().InsertComputation(ComputationToInsert{ - Operation: operation, - OutputHandle: outputHandle, - Operands: []ComputationOperand{ - { - Handle: lhs, - FheUintType: handleType(lhs), - IsScalar: false, - }, - { - Handle: rhs, - FheUintType: handleType(rhs), - IsScalar: isScalar, - }, + err = sess.GetStore().InsertComputation(ComputationToInsert{ + Operation: operation, + OutputHandle: outputHandle, + Operands: []ComputationOperand{ + { + Handle: lhs, + FheUintType: handleType(lhs), + IsScalar: false, }, - }) - if err != nil { - return err - } - - return nil - } else { - return errors.New("scalar fheBitXor is not supported") + { + Handle: rhs, + FheUintType: handleType(rhs), + IsScalar: isScalar, + }, + }, + }) + if err != nil { + return err } + + return nil } func fheShlRun(sess CoprocessorSession, unslicedInput []byte, _ ExtraData, outputHandle []byte) error {