-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b186cb7
commit 10952c6
Showing
2 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package mock | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/Layr-Labs/eigenda/chainio" | ||
"github.com/Layr-Labs/eigenda/chainio/thegraph" | ||
"github.com/stretchr/testify/mock" | ||
) | ||
|
||
type MockIndexedChainState struct { | ||
mock.Mock | ||
} | ||
|
||
var _ thegraph.IndexedChainState = (*MockIndexedChainState)(nil) | ||
|
||
func (m *MockIndexedChainState) GetIndexedOperatorState(ctx context.Context, blockNumber uint, quorums []chainio.QuorumID) (*chainio.IndexedOperatorState, error) { | ||
args := m.Called() | ||
var value *chainio.IndexedOperatorState | ||
if args.Get(0) != nil { | ||
value = args.Get(0).(*chainio.IndexedOperatorState) | ||
} | ||
return value, args.Error(1) | ||
} | ||
|
||
func (m *MockIndexedChainState) GetIndexedOperatorInfoByOperatorId(ctx context.Context, operatorId chainio.OperatorID, blockNumber uint32) (*chainio.IndexedOperatorInfo, error) { | ||
args := m.Called() | ||
var value *chainio.IndexedOperatorInfo | ||
if args.Get(0) != nil { | ||
value = args.Get(0).(*chainio.IndexedOperatorInfo) | ||
} | ||
return value, args.Error(1) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package mock | ||
|
||
import ( | ||
"context" | ||
"crypto/ecdsa" | ||
"math/big" | ||
|
||
"github.com/Layr-Labs/eigenda/api/grpc/churner" | ||
"github.com/Layr-Labs/eigenda/chainio" | ||
"github.com/Layr-Labs/eigenda/crypto/ecc/bn254" | ||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/stretchr/testify/mock" | ||
) | ||
|
||
type MockWriter struct { | ||
mock.Mock | ||
} | ||
|
||
var _ chainio.Writer = (*MockWriter)(nil) | ||
|
||
func (t *MockWriter) RegisterOperator( | ||
ctx context.Context, | ||
keypair *bn254.KeyPair, | ||
socket string, | ||
quorumIds []chainio.QuorumID, | ||
operatorEcdsaPrivateKey *ecdsa.PrivateKey, | ||
operatorToAvsRegistrationSigSalt [32]byte, | ||
operatorToAvsRegistrationSigExpiry *big.Int, | ||
) error { | ||
args := t.Called(ctx, keypair, socket, quorumIds, operatorEcdsaPrivateKey, operatorToAvsRegistrationSigSalt, operatorToAvsRegistrationSigExpiry) | ||
return args.Error(0) | ||
} | ||
|
||
func (t *MockWriter) RegisterOperatorWithChurn( | ||
ctx context.Context, | ||
keypair *bn254.KeyPair, | ||
socket string, | ||
quorumIds []chainio.QuorumID, | ||
operatorEcdsaPrivateKey *ecdsa.PrivateKey, | ||
operatorToAvsRegistrationSigSalt [32]byte, | ||
operatorToAvsRegistrationSigExpiry *big.Int, | ||
churnReply *churner.ChurnReply) error { | ||
args := t.Called(ctx, keypair, socket, quorumIds, operatorEcdsaPrivateKey, operatorToAvsRegistrationSigSalt, operatorToAvsRegistrationSigExpiry, churnReply) | ||
return args.Error(0) | ||
} | ||
|
||
func (t *MockWriter) DeregisterOperator(ctx context.Context, pubkeyG1 *bn254.G1Point, blockNumber uint32, quorumIds []chainio.QuorumID) error { | ||
args := t.Called() | ||
return args.Error(0) | ||
} | ||
|
||
func (t *MockWriter) UpdateOperatorSocket(ctx context.Context, socket string) error { | ||
args := t.Called() | ||
return args.Error(0) | ||
} | ||
|
||
func (t *MockWriter) BuildEjectOperatorsTxn(ctx context.Context, operatorsByQuorum [][]chainio.OperatorID) (*types.Transaction, error) { | ||
args := t.Called(ctx, operatorsByQuorum) | ||
result := args.Get(0) | ||
return result.(*types.Transaction), args.Error(1) | ||
} |