Skip to content

Commit

Permalink
Remove transactor interface
Browse files Browse the repository at this point in the history
  • Loading branch information
mooselumph committed Oct 23, 2024
1 parent dd7d9c5 commit 7ba3c79
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 196 deletions.
103 changes: 54 additions & 49 deletions core/tx.go → core/chainio.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,52 +29,11 @@ type OperatorSetParam struct {

type OperatorStakes map[QuorumID]map[OperatorIndex]OperatorStake

type TransactorOld interface {
type Reader interface {

// GetRegisteredQuorumIdsForOperator returns the quorum ids that the operator is registered in with the given public key.
GetRegisteredQuorumIdsForOperator(ctx context.Context, operatorID OperatorID) ([]QuorumID, error)

// RegisterOperator registers a new operator with the given public key and socket with the provided quorum ids.
// If the operator is already registered with a given quorum id, the transaction will fail (noop) and an error
// will be returned.
RegisterOperator(
ctx context.Context,
keypair *KeyPair,
socket string,
quorumIds []QuorumID,
operatorEcdsaPrivateKey *ecdsa.PrivateKey,
operatorToAvsRegistrationSigSalt [32]byte,
operatorToAvsRegistrationSigExpiry *big.Int,
) error

// RegisterOperatorWithChurn registers a new operator with the given public key and socket with the provided quorum ids
// with the provided signature from the churner
RegisterOperatorWithChurn(
ctx context.Context,
keypair *KeyPair,
socket string,
quorumIds []QuorumID,
operatorEcdsaPrivateKey *ecdsa.PrivateKey,
operatorToAvsRegistrationSigSalt [32]byte,
operatorToAvsRegistrationSigExpiry *big.Int,
churnReply *churner.ChurnReply,
) error

// DeregisterOperator deregisters an operator with the given public key from the all the quorums that it is
// registered with at the supplied block number. To fully deregister an operator, this function should be called
// with the current block number.
// If the operator isn't registered with any of the specified quorums, this function will return error, and
// no quorum will be deregistered.
DeregisterOperator(ctx context.Context, pubkeyG1 *G1Point, blockNumber uint32, quorumIds []QuorumID) error

// UpdateOperatorSocket updates the socket of the operator in all the quorums that it is registered with.
UpdateOperatorSocket(ctx context.Context, socket string) error

// BuildEjectOperatorsTxn returns a transaction that ejects operators from AVS registryCoordinator.
// The operatorsByQuorum provides a list of operators for each quorum. Within a quorum,
// the operators are ordered; in case of rate limiting, the first operators will be ejected.
BuildEjectOperatorsTxn(ctx context.Context, operatorsByQuorum [][]OperatorID) (*types.Transaction, error)

// GetOperatorStakes returns the stakes of all operators within the quorums that the operator represented by operatorId
// is registered with. The returned stakes are for the block number supplied. The indices of the operators within each quorum
// are also returned.
Expand All @@ -84,15 +43,9 @@ type TransactorOld interface {
// The indices of the operators within each quorum are also returned.
GetOperatorStakesForQuorums(ctx context.Context, quorums []QuorumID, blockNumber uint32) (OperatorStakes, error)

// BuildConfirmBatchTxn builds a transaction to confirm a batch header and signature aggregation.
BuildConfirmBatchTxn(ctx context.Context, batchHeader *BatchHeader, quorums map[QuorumID]*QuorumResult, signatureAggregation *SignatureAggregation) (*types.Transaction, error)

// ConfirmBatch confirms a batch header and signature aggregation. The signature aggregation must satisfy the quorum thresholds
// specified in the batch header. If the signature aggregation does not satisfy the quorum thresholds, the transaction will fail.
ConfirmBatch(ctx context.Context, batchHeader *BatchHeader, quorums map[QuorumID]*QuorumResult, signatureAggregation *SignatureAggregation) (*types.Receipt, error)

// GetBlockStaleMeasure returns the BLOCK_STALE_MEASURE defined onchain.
GetBlockStaleMeasure(ctx context.Context) (uint32, error)

// GetStoreDurationBlocks returns the STORE_DURATION_BLOCKS defined onchain.
GetStoreDurationBlocks(ctx context.Context) (uint32, error)

Expand Down Expand Up @@ -159,3 +112,55 @@ type TransactorOld interface {
// GetOnDemandPayments returns all on-demand payments
GetOnDemandPaymentByAccount(ctx context.Context, blockNumber uint32, accountID string) (OnDemandPayment, error)
}

type Writer interface {
Reader

// RegisterOperator registers a new operator with the given public key and socket with the provided quorum ids.
// If the operator is already registered with a given quorum id, the transaction will fail (noop) and an error
// will be returned.
RegisterOperator(
ctx context.Context,
keypair *KeyPair,
socket string,
quorumIds []QuorumID,
operatorEcdsaPrivateKey *ecdsa.PrivateKey,
operatorToAvsRegistrationSigSalt [32]byte,
operatorToAvsRegistrationSigExpiry *big.Int,
) error

// RegisterOperatorWithChurn registers a new operator with the given public key and socket with the provided quorum ids
// with the provided signature from the churner
RegisterOperatorWithChurn(
ctx context.Context,
keypair *KeyPair,
socket string,
quorumIds []QuorumID,
operatorEcdsaPrivateKey *ecdsa.PrivateKey,
operatorToAvsRegistrationSigSalt [32]byte,
operatorToAvsRegistrationSigExpiry *big.Int,
churnReply *churner.ChurnReply,
) error

// DeregisterOperator deregisters an operator with the given public key from the all the quorums that it is
// registered with at the supplied block number. To fully deregister an operator, this function should be called
// with the current block number.
// If the operator isn't registered with any of the specified quorums, this function will return error, and
// no quorum will be deregistered.
DeregisterOperator(ctx context.Context, pubkeyG1 *G1Point, blockNumber uint32, quorumIds []QuorumID) error

// UpdateOperatorSocket updates the socket of the operator in all the quorums that it is registered with.
UpdateOperatorSocket(ctx context.Context, socket string) error

// BuildEjectOperatorsTxn returns a transaction that ejects operators from AVS registryCoordinator.
// The operatorsByQuorum provides a list of operators for each quorum. Within a quorum,
// the operators are ordered; in case of rate limiting, the first operators will be ejected.
BuildEjectOperatorsTxn(ctx context.Context, operatorsByQuorum [][]OperatorID) (*types.Transaction, error)

// BuildConfirmBatchTxn builds a transaction to confirm a batch header and signature aggregation.
BuildConfirmBatchTxn(ctx context.Context, batchHeader *BatchHeader, quorums map[QuorumID]*QuorumResult, signatureAggregation *SignatureAggregation) (*types.Transaction, error)

// ConfirmBatch confirms a batch header and signature aggregation. The signature aggregation must satisfy the quorum thresholds
// specified in the batch header. If the signature aggregation does not satisfy the quorum thresholds, the transaction will fail.
ConfirmBatch(ctx context.Context, batchHeader *BatchHeader, quorums map[QuorumID]*QuorumResult, signatureAggregation *SignatureAggregation) (*types.Receipt, error)
}
147 changes: 0 additions & 147 deletions core/reader.go

This file was deleted.

0 comments on commit 7ba3c79

Please sign in to comment.