Skip to content

Commit

Permalink
refactor: Rename cstaskmanager to taskmanager
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyodar committed Feb 1, 2024
1 parent 95ef813 commit 133da50
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 80 deletions.
16 changes: 8 additions & 8 deletions aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/NethermindEth/near-sffl/core/chainio"
"github.com/NethermindEth/near-sffl/core/config"

cstaskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
taskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
)

const (
Expand Down Expand Up @@ -69,9 +69,9 @@ type Aggregator struct {
avsWriter chainio.AvsWriterer
// aggregation related fields
blsAggregationService blsagg.BlsAggregationService
tasks map[types.TaskIndex]cstaskmanager.CheckpointTask
tasks map[types.TaskIndex]taskmanager.CheckpointTask
tasksMu sync.RWMutex
taskResponses map[types.TaskIndex]map[sdktypes.TaskResponseDigest]cstaskmanager.CheckpointTaskResponse
taskResponses map[types.TaskIndex]map[sdktypes.TaskResponseDigest]taskmanager.CheckpointTaskResponse
taskResponsesMu sync.RWMutex
}

Expand Down Expand Up @@ -113,8 +113,8 @@ func NewAggregator(c *config.Config) (*Aggregator, error) {
serverIpPortAddr: c.AggregatorServerIpPortAddr,
avsWriter: avsWriter,
blsAggregationService: blsAggregationService,
tasks: make(map[types.TaskIndex]cstaskmanager.CheckpointTask),
taskResponses: make(map[types.TaskIndex]map[sdktypes.TaskResponseDigest]cstaskmanager.CheckpointTaskResponse),
tasks: make(map[types.TaskIndex]taskmanager.CheckpointTask),
taskResponses: make(map[types.TaskIndex]map[sdktypes.TaskResponseDigest]taskmanager.CheckpointTaskResponse),
}, nil
}

Expand Down Expand Up @@ -161,15 +161,15 @@ func (agg *Aggregator) sendAggregatedResponseToContract(blsAggServiceResp blsagg
// panicing to help with debugging (fail fast), but we shouldn't panic if we run this in production
panic(blsAggServiceResp.Err)
}
nonSignerPubkeys := []cstaskmanager.BN254G1Point{}
nonSignerPubkeys := []taskmanager.BN254G1Point{}
for _, nonSignerPubkey := range blsAggServiceResp.NonSignersPubkeysG1 {
nonSignerPubkeys = append(nonSignerPubkeys, core.ConvertToBN254G1Point(nonSignerPubkey))
}
quorumApks := []cstaskmanager.BN254G1Point{}
quorumApks := []taskmanager.BN254G1Point{}
for _, quorumApk := range blsAggServiceResp.QuorumApksG1 {
quorumApks = append(quorumApks, core.ConvertToBN254G1Point(quorumApk))
}
nonSignerStakesAndSignature := cstaskmanager.IBLSSignatureCheckerNonSignerStakesAndSignature{
nonSignerStakesAndSignature := taskmanager.IBLSSignatureCheckerNonSignerStakesAndSignature{
NonSignerPubkeys: nonSignerPubkeys,
QuorumApks: quorumApks,
ApkG2: core.ConvertToBN254G2Point(blsAggServiceResp.SignersApkG2),
Expand Down
6 changes: 3 additions & 3 deletions aggregator/aggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

"github.com/NethermindEth/near-sffl/aggregator/mocks"
"github.com/NethermindEth/near-sffl/aggregator/types"
cstaskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
taskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
chainiomocks "github.com/NethermindEth/near-sffl/core/chainio/mocks"
)

Expand Down Expand Up @@ -88,8 +88,8 @@ func createMockAggregator(
logger: logger,
avsWriter: mockAvsWriter,
blsAggregationService: mockBlsAggregationService,
tasks: make(map[types.TaskIndex]cstaskmanager.CheckpointTask),
taskResponses: make(map[types.TaskIndex]map[sdktypes.TaskResponseDigest]cstaskmanager.CheckpointTaskResponse),
tasks: make(map[types.TaskIndex]taskmanager.CheckpointTask),
taskResponses: make(map[types.TaskIndex]map[sdktypes.TaskResponseDigest]taskmanager.CheckpointTaskResponse),
}
return aggregator, mockAvsWriter, mockBlsAggregationService, nil
}
Expand Down
6 changes: 3 additions & 3 deletions aggregator/mocks/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (
opstateretriever "github.com/Layr-Labs/eigensdk-go/contracts/bindings/OperatorStateRetriever"
"github.com/Layr-Labs/eigensdk-go/crypto/bls"
"github.com/NethermindEth/near-sffl/aggregator/types"
cstaskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
taskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
)

// ====== TaskManager Mocks ======

func MockSendNewCheckpointTask(blockNum, taskNum uint32, fromNearBlock, toNearBlock uint64) (cstaskmanager.CheckpointTask, uint32, error) {
task := cstaskmanager.CheckpointTask{
func MockSendNewCheckpointTask(blockNum, taskNum uint32, fromNearBlock, toNearBlock uint64) (taskmanager.CheckpointTask, uint32, error) {
task := taskmanager.CheckpointTask{
FromNearBlock: fromNearBlock,
ToNearBlock: toNearBlock,
TaskCreatedBlock: blockNum,
Expand Down
6 changes: 3 additions & 3 deletions aggregator/rpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/http"
"net/rpc"

cstaskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
taskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
"github.com/NethermindEth/near-sffl/core"

"github.com/Layr-Labs/eigensdk-go/crypto/bls"
Expand Down Expand Up @@ -38,7 +38,7 @@ func (agg *Aggregator) startServer(ctx context.Context) error {
}

type SignedCheckpointTaskResponse struct {
TaskResponse cstaskmanager.CheckpointTaskResponse
TaskResponse taskmanager.CheckpointTaskResponse
BlsSignature bls.Signature
OperatorId bls.OperatorId
}
Expand All @@ -56,7 +56,7 @@ func (agg *Aggregator) ProcessSignedCheckpointTaskResponse(signedCheckpointTaskR
}
agg.taskResponsesMu.Lock()
if _, ok := agg.taskResponses[taskIndex]; !ok {
agg.taskResponses[taskIndex] = make(map[sdktypes.TaskResponseDigest]cstaskmanager.CheckpointTaskResponse)
agg.taskResponses[taskIndex] = make(map[sdktypes.TaskResponseDigest]taskmanager.CheckpointTaskResponse)
}
if _, ok := agg.taskResponses[taskIndex][taskResponseDigest]; !ok {
agg.taskResponses[taskIndex][taskResponseDigest] = signedCheckpointTaskResponse.TaskResponse
Expand Down
4 changes: 2 additions & 2 deletions aggregator/rpc_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/Layr-Labs/eigensdk-go/crypto/bls"
sdktypes "github.com/Layr-Labs/eigensdk-go/types"
"github.com/NethermindEth/near-sffl/aggregator/types"
cstaskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
taskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
"github.com/NethermindEth/near-sffl/core"
)

Expand Down Expand Up @@ -74,7 +74,7 @@ func keccak256(num uint64) [32]byte {

// mocks an operator signing on a task response
func createMockSignedCheckpointTaskResponse(mockTask MockTask, keypair bls.KeyPair) (*SignedCheckpointTaskResponse, error) {
taskResponse := &cstaskmanager.CheckpointTaskResponse{
taskResponse := &taskmanager.CheckpointTaskResponse{
ReferenceTaskIndex: mockTask.TaskNum,
StateRootUpdatesRoot: keccak256(mockTask.FromNearBlock),
OperatorSetUpdatesRoot: keccak256(mockTask.ToNearBlock),
Expand Down
12 changes: 6 additions & 6 deletions core/chainio/avs_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ import (
logging "github.com/Layr-Labs/eigensdk-go/logging"

erc20mock "github.com/NethermindEth/near-sffl/contracts/bindings/ERC20Mock"
cstaskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
taskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
"github.com/NethermindEth/near-sffl/core/config"
)

type AvsReaderer interface {
sdkavsregistry.AvsRegistryReader

CheckSignatures(
ctx context.Context, msgHash [32]byte, quorumNumbers []byte, referenceBlockNumber uint32, nonSignerStakesAndSignature cstaskmanager.IBLSSignatureCheckerNonSignerStakesAndSignature,
) (cstaskmanager.IBLSSignatureCheckerQuorumStakeTotals, error)
ctx context.Context, msgHash [32]byte, quorumNumbers []byte, referenceBlockNumber uint32, nonSignerStakesAndSignature taskmanager.IBLSSignatureCheckerNonSignerStakesAndSignature,
) (taskmanager.IBLSSignatureCheckerQuorumStakeTotals, error)
GetErc20Mock(ctx context.Context, tokenAddr gethcommon.Address) (*erc20mock.ContractERC20Mock, error)
}

Expand Down Expand Up @@ -55,13 +55,13 @@ func NewAvsReader(avsRegistryReader sdkavsregistry.AvsRegistryReader, avsService
}

func (r *AvsReader) CheckSignatures(
ctx context.Context, msgHash [32]byte, quorumNumbers []byte, referenceBlockNumber uint32, nonSignerStakesAndSignature cstaskmanager.IBLSSignatureCheckerNonSignerStakesAndSignature,
) (cstaskmanager.IBLSSignatureCheckerQuorumStakeTotals, error) {
ctx context.Context, msgHash [32]byte, quorumNumbers []byte, referenceBlockNumber uint32, nonSignerStakesAndSignature taskmanager.IBLSSignatureCheckerNonSignerStakesAndSignature,
) (taskmanager.IBLSSignatureCheckerQuorumStakeTotals, error) {
stakeTotalsPerQuorum, _, err := r.AvsServiceBindings.TaskManager.CheckSignatures(
&bind.CallOpts{}, msgHash, quorumNumbers, referenceBlockNumber, nonSignerStakesAndSignature,
)
if err != nil {
return cstaskmanager.IBLSSignatureCheckerQuorumStakeTotals{}, err
return taskmanager.IBLSSignatureCheckerQuorumStakeTotals{}, err
}
return stakeTotalsPerQuorum, nil
}
Expand Down
14 changes: 7 additions & 7 deletions core/chainio/avs_subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
"github.com/Layr-Labs/eigensdk-go/chainio/clients/eth"
sdklogging "github.com/Layr-Labs/eigensdk-go/logging"

cstaskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
taskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
"github.com/NethermindEth/near-sffl/core/config"
)

type AvsSubscriberer interface {
SubscribeToNewTasks(checkpointTaskCreatedChan chan *cstaskmanager.ContractSFFLTaskManagerCheckpointTaskCreated) event.Subscription
SubscribeToTaskResponses(taskResponseLogs chan *cstaskmanager.ContractSFFLTaskManagerCheckpointTaskResponded) event.Subscription
ParseCheckpointTaskResponded(rawLog types.Log) (*cstaskmanager.ContractSFFLTaskManagerCheckpointTaskResponded, error)
SubscribeToNewTasks(checkpointTaskCreatedChan chan *taskmanager.ContractSFFLTaskManagerCheckpointTaskCreated) event.Subscription
SubscribeToTaskResponses(taskResponseLogs chan *taskmanager.ContractSFFLTaskManagerCheckpointTaskResponded) event.Subscription
ParseCheckpointTaskResponded(rawLog types.Log) (*taskmanager.ContractSFFLTaskManagerCheckpointTaskResponded, error)
}

// Subscribers use a ws connection instead of http connection like Readers
Expand Down Expand Up @@ -53,7 +53,7 @@ func NewAvsSubscriber(avsContractBindings *AvsManagersBindings, logger sdkloggin
}
}

func (s *AvsSubscriber) SubscribeToNewTasks(checkpointTaskCreatedChan chan *cstaskmanager.ContractSFFLTaskManagerCheckpointTaskCreated) event.Subscription {
func (s *AvsSubscriber) SubscribeToNewTasks(checkpointTaskCreatedChan chan *taskmanager.ContractSFFLTaskManagerCheckpointTaskCreated) event.Subscription {
sub, err := s.AvsContractBindings.TaskManager.WatchCheckpointTaskCreated(
&bind.WatchOpts{}, checkpointTaskCreatedChan, nil,
)
Expand All @@ -64,7 +64,7 @@ func (s *AvsSubscriber) SubscribeToNewTasks(checkpointTaskCreatedChan chan *csta
return sub
}

func (s *AvsSubscriber) SubscribeToTaskResponses(taskResponseChan chan *cstaskmanager.ContractSFFLTaskManagerCheckpointTaskResponded) event.Subscription {
func (s *AvsSubscriber) SubscribeToTaskResponses(taskResponseChan chan *taskmanager.ContractSFFLTaskManagerCheckpointTaskResponded) event.Subscription {
sub, err := s.AvsContractBindings.TaskManager.WatchCheckpointTaskResponded(
&bind.WatchOpts{}, taskResponseChan,
)
Expand All @@ -75,6 +75,6 @@ func (s *AvsSubscriber) SubscribeToTaskResponses(taskResponseChan chan *cstaskma
return sub
}

func (s *AvsSubscriber) ParseCheckpointTaskResponded(rawLog types.Log) (*cstaskmanager.ContractSFFLTaskManagerCheckpointTaskResponded, error) {
func (s *AvsSubscriber) ParseCheckpointTaskResponded(rawLog types.Log) (*taskmanager.ContractSFFLTaskManagerCheckpointTaskResponded, error) {
return s.AvsContractBindings.TaskManager.ContractSFFLTaskManagerFilterer.ParseCheckpointTaskResponded(rawLog)
}
42 changes: 21 additions & 21 deletions core/chainio/avs_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/Layr-Labs/eigensdk-go/chainio/txmgr"
logging "github.com/Layr-Labs/eigensdk-go/logging"

cstaskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
taskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
"github.com/NethermindEth/near-sffl/core/config"
)

Expand All @@ -24,18 +24,18 @@ type AvsWriterer interface {
toNearBlock uint64,
quorumThreshold uint32,
quorumNumbers []byte,
) (cstaskmanager.CheckpointTask, uint32, error)
) (taskmanager.CheckpointTask, uint32, error)
RaiseChallenge(
ctx context.Context,
task cstaskmanager.CheckpointTask,
taskResponse cstaskmanager.CheckpointTaskResponse,
taskResponseMetadata cstaskmanager.CheckpointTaskResponseMetadata,
pubkeysOfNonSigningOperators []cstaskmanager.BN254G1Point,
task taskmanager.CheckpointTask,
taskResponse taskmanager.CheckpointTaskResponse,
taskResponseMetadata taskmanager.CheckpointTaskResponseMetadata,
pubkeysOfNonSigningOperators []taskmanager.BN254G1Point,
) (*types.Receipt, error)
SendAggregatedResponse(ctx context.Context,
task cstaskmanager.CheckpointTask,
taskResponse cstaskmanager.CheckpointTaskResponse,
nonSignerStakesAndSignature cstaskmanager.IBLSSignatureCheckerNonSignerStakesAndSignature,
task taskmanager.CheckpointTask,
taskResponse taskmanager.CheckpointTaskResponse,
nonSignerStakesAndSignature taskmanager.IBLSSignatureCheckerNonSignerStakesAndSignature,
) (*types.Receipt, error)
}

Expand Down Expand Up @@ -75,34 +75,34 @@ func NewAvsWriter(avsRegistryWriter avsregistry.AvsRegistryWriter, avsServiceBin
}

// returns the tx receipt, as well as the task index (which it gets from parsing the tx receipt logs)
func (w *AvsWriter) SendNewCheckpointTask(ctx context.Context, fromNearBlock uint64, toNearBlock uint64, quorumThreshold uint32, quorumNumbers []byte) (cstaskmanager.CheckpointTask, uint32, error) {
func (w *AvsWriter) SendNewCheckpointTask(ctx context.Context, fromNearBlock uint64, toNearBlock uint64, quorumThreshold uint32, quorumNumbers []byte) (taskmanager.CheckpointTask, uint32, error) {
txOpts, err := w.TxMgr.GetNoSendTxOpts()
if err != nil {
w.logger.Errorf("Error getting tx opts")
return cstaskmanager.CheckpointTask{}, 0, err
return taskmanager.CheckpointTask{}, 0, err
}
tx, err := w.AvsContractBindings.TaskManager.CreateCheckpointTask(txOpts, fromNearBlock, toNearBlock, quorumThreshold, quorumNumbers)
if err != nil {
w.logger.Errorf("Error assembling CreateCheckpointTask tx")
return cstaskmanager.CheckpointTask{}, 0, err
return taskmanager.CheckpointTask{}, 0, err
}
receipt, err := w.TxMgr.Send(ctx, tx)
if err != nil {
w.logger.Errorf("Error submitting CreateCheckpointTask tx")
return cstaskmanager.CheckpointTask{}, 0, err
return taskmanager.CheckpointTask{}, 0, err
}
checkpointTaskCreatedEvent, err := w.AvsContractBindings.TaskManager.ContractSFFLTaskManagerFilterer.ParseCheckpointTaskCreated(*receipt.Logs[0])
if err != nil {
w.logger.Error("Aggregator failed to parse new task created event", "err", err)
return cstaskmanager.CheckpointTask{}, 0, err
return taskmanager.CheckpointTask{}, 0, err
}
return checkpointTaskCreatedEvent.Task, checkpointTaskCreatedEvent.TaskIndex, nil
}

func (w *AvsWriter) SendAggregatedResponse(
ctx context.Context, task cstaskmanager.CheckpointTask,
taskResponse cstaskmanager.CheckpointTaskResponse,
nonSignerStakesAndSignature cstaskmanager.IBLSSignatureCheckerNonSignerStakesAndSignature,
ctx context.Context, task taskmanager.CheckpointTask,
taskResponse taskmanager.CheckpointTaskResponse,
nonSignerStakesAndSignature taskmanager.IBLSSignatureCheckerNonSignerStakesAndSignature,
) (*types.Receipt, error) {
txOpts, err := w.TxMgr.GetNoSendTxOpts()
if err != nil {
Expand All @@ -124,10 +124,10 @@ func (w *AvsWriter) SendAggregatedResponse(

func (w *AvsWriter) RaiseChallenge(
ctx context.Context,
task cstaskmanager.CheckpointTask,
taskResponse cstaskmanager.CheckpointTaskResponse,
taskResponseMetadata cstaskmanager.CheckpointTaskResponseMetadata,
pubkeysOfNonSigningOperators []cstaskmanager.BN254G1Point,
task taskmanager.CheckpointTask,
taskResponse taskmanager.CheckpointTaskResponse,
taskResponseMetadata taskmanager.CheckpointTaskResponseMetadata,
pubkeysOfNonSigningOperators []taskmanager.BN254G1Point,
) (*types.Receipt, error) {
txOpts, err := w.TxMgr.GetNoSendTxOpts()
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions core/chainio/bindings.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import (
regcoord "github.com/Layr-Labs/eigensdk-go/contracts/bindings/RegistryCoordinator"
erc20mock "github.com/NethermindEth/near-sffl/contracts/bindings/ERC20Mock"
csservicemanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLServiceManager"
cstaskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
taskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
)

type AvsManagersBindings struct {
TaskManager *cstaskmanager.ContractSFFLTaskManager
TaskManager *taskmanager.ContractSFFLTaskManager
ServiceManager *csservicemanager.ContractSFFLServiceManager
ethClient eth.EthClient
logger logging.Logger
Expand All @@ -41,7 +41,7 @@ func NewAvsManagersBindings(registryCoordinatorAddr, operatorStateRetrieverAddr
logger.Error("Failed to fetch TaskManager address", "err", err)
return nil, err
}
contractTaskManager, err := cstaskmanager.NewContractSFFLTaskManager(taskManagerAddr, ethclient)
contractTaskManager, err := taskmanager.NewContractSFFLTaskManager(taskManagerAddr, ethclient)
if err != nil {
logger.Error("Failed to fetch ISFFLTaskManager contract", "err", err)
return nil, err
Expand Down
18 changes: 9 additions & 9 deletions core/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import (
"math/big"

"github.com/Layr-Labs/eigensdk-go/crypto/bls"
cstaskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
taskmanager "github.com/NethermindEth/near-sffl/contracts/bindings/SFFLTaskManager"
"github.com/ethereum/go-ethereum/accounts/abi"
"golang.org/x/crypto/sha3"
)

// this hardcodes abi.encode() for cstaskmanager.CheckpointTaskResponse
// this hardcodes abi.encode() for taskmanager.CheckpointTaskResponse
// unclear why abigen doesn't provide this out of the box...
func AbiEncodeCheckpointTaskResponse(h *cstaskmanager.CheckpointTaskResponse) ([]byte, error) {
func AbiEncodeCheckpointTaskResponse(h *taskmanager.CheckpointTaskResponse) ([]byte, error) {

// The order here has to match the field ordering of cstaskmanager.CheckpointTaskResponse
// The order here has to match the field ordering of taskmanager.CheckpointTaskResponse
taskResponseType, err := abi.NewType("tuple", "", []abi.ArgumentMarshaling{
{
Name: "referenceTaskIndex",
Expand Down Expand Up @@ -46,7 +46,7 @@ func AbiEncodeCheckpointTaskResponse(h *cstaskmanager.CheckpointTaskResponse) ([
}

// GetCheckpointTaskResponseDigest returns the hash of the TaskResponse, which is what operators sign over
func GetCheckpointTaskResponseDigest(h *cstaskmanager.CheckpointTaskResponse) ([32]byte, error) {
func GetCheckpointTaskResponseDigest(h *taskmanager.CheckpointTaskResponse) ([32]byte, error) {

encodeTaskResponseByte, err := AbiEncodeCheckpointTaskResponse(h)
if err != nil {
Expand All @@ -66,16 +66,16 @@ func GetCheckpointTaskResponseDigest(h *cstaskmanager.CheckpointTaskResponse) ([
// BN254.sol is a library, so bindings for G1 Points and G2 Points are only generated
// in every contract that imports that library. Thus the output here will need to be
// type casted if G1Point is needed to interface with another contract (eg: BLSPublicKeyCompendium.sol)
func ConvertToBN254G1Point(input *bls.G1Point) cstaskmanager.BN254G1Point {
output := cstaskmanager.BN254G1Point{
func ConvertToBN254G1Point(input *bls.G1Point) taskmanager.BN254G1Point {
output := taskmanager.BN254G1Point{
X: input.X.BigInt(big.NewInt(0)),
Y: input.Y.BigInt(big.NewInt(0)),
}
return output
}

func ConvertToBN254G2Point(input *bls.G2Point) cstaskmanager.BN254G2Point {
output := cstaskmanager.BN254G2Point{
func ConvertToBN254G2Point(input *bls.G2Point) taskmanager.BN254G2Point {
output := taskmanager.BN254G2Point{
X: [2]*big.Int{input.X.A1.BigInt(big.NewInt(0)), input.X.A0.BigInt(big.NewInt(0))},
Y: [2]*big.Int{input.Y.A1.BigInt(big.NewInt(0)), input.Y.A0.BigInt(big.NewInt(0))},
}
Expand Down
Loading

0 comments on commit 133da50

Please sign in to comment.