Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade eigen contracts and middleware version up to rewardsv2 #119

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
591753c
Use last version of go sdk
pablodeymo Dec 30, 2024
df8d4f8
Merge branch 'fix_read_config' into use_fixed_version_of_sdk
pablodeymo Dec 30, 2024
79c10e8
Merge branch 'fix_read_config' into use_fixed_version_of_sdk
pablodeymo Dec 30, 2024
6c68035
Merge branch 'fix_read_config' into use_fixed_version_of_sdk
pablodeymo Dec 30, 2024
51d2d83
InitializeNewTaskWithWindow method implemented
pablodeymo Dec 30, 2024
0328540
Merge branch 'fix_read_config' into use_fixed_version_of_sdk
pablodeymo Dec 30, 2024
2c40243
toolchain go1.21.0
pablodeymo Dec 30, 2024
fc3c366
fix: bump go-ethereum to latest version
MegaRedHand Jan 2, 2025
2e18ddb
chore: bump SDK version to v0.2.0-beta
MegaRedHand Jan 6, 2025
772556f
chore: pin fix's fix
MegaRedHand Jan 6, 2025
015814f
chore: update to new version
MegaRedHand Jan 6, 2025
123bfa1
chore: bump SDK version
MegaRedHand Feb 12, 2025
5f8ce93
chore: run `go mod tidy`
MegaRedHand Feb 18, 2025
844f209
fix: use RegisterOperator on plugin/cmd
MegaRedHand Feb 18, 2025
72d7f3f
fix: use RegisterOperator in operator/registration
MegaRedHand Feb 18, 2025
143327c
fix: udpate calls to initialize bindings
MegaRedHand Feb 18, 2025
ee42ba8
chore: pin latest dev branch commit
MegaRedHand Feb 18, 2025
6ae1029
fix: set `DontUseAllocationManager` flag
MegaRedHand Feb 18, 2025
8674c01
fix: use new blsagg structs
MegaRedHand Feb 18, 2025
87285fd
chore: run `make mocks`
MegaRedHand Feb 18, 2025
c7d9b2d
Merge branch 'master' into use_fixed_version_of_sdk
MegaRedHand Feb 19, 2025
e6e1664
fix: update mocks
MegaRedHand Feb 19, 2025
dc35c01
Merge branch 'master' into use_fixed_version_of_sdk
MegaRedHand Feb 19, 2025
b6a048c
chore: bump SDK version
MegaRedHand Feb 19, 2025
fd1f480
chore: update version
MegaRedHand Feb 19, 2025
68e2553
fix: activate DontUseAllocationManager flag
MegaRedHand Feb 19, 2025
8f68181
fix: add new flag in two more places
MegaRedHand Feb 19, 2025
d028367
Add rewardsv2 deploy contracts
maximopalopoli Feb 21, 2025
bc3940a
Update solc version
maximopalopoli Feb 21, 2025
31cfe89
Update bindings
maximopalopoli Feb 21, 2025
dc73500
Fix args order in IncredibleSquaringServiceManager building
maximopalopoli Feb 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ func NewAggregator(c *config.Config) (*Aggregator, error) {
OperatorStateRetrieverAddr: c.OperatorStateRetrieverAddr.String(),
AvsName: avsName,
PromMetricsIpPortAddress: ":9090",

DontUseAllocationManager: true,
}
clients, err := clients.BuildAll(chainioConfig, c.EcdsaPrivateKey, c.Logger)
if err != nil {
Expand Down Expand Up @@ -255,6 +257,7 @@ func (agg *Aggregator) sendNewTask(numToSquare *big.Int) error {
for _, quorumNum := range newTask.QuorumNumbers {
quorumNums = append(quorumNums, sdktypes.QuorumNum(quorumNum))
}
agg.blsAggregationService.InitializeNewTask(taskIndex, newTask.TaskCreatedBlock, quorumNums, quorumThresholdPercentages, taskTimeToExpiry)
metadata := blsagg.NewTaskMetadata(taskIndex, newTask.TaskCreatedBlock, quorumNums, quorumThresholdPercentages, taskTimeToExpiry)
agg.blsAggregationService.InitializeNewTask(metadata)
return nil
}
25 changes: 16 additions & 9 deletions aggregator/aggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,31 @@ func (mr *MockBlsAggregationServiceMockRecorder) GetResponseChannel() *gomock.Ca
}

// InitializeNewTask mocks base method.
func (m *MockBlsAggregationService) InitializeNewTask(arg0, arg1 uint32, arg2 sdktypes.QuorumNums, arg3 sdktypes.QuorumThresholdPercentages, arg4 time.Duration) error {
func (m *MockBlsAggregationService) InitializeNewTask(arg0 blsagg.TaskMetadata) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "InitializeNewTask", arg0, arg1, arg2, arg3, arg4)
ret := m.ctrl.Call(m, "InitializeNewTask", arg0)
ret0, _ := ret[0].(error)
return ret0
}

// InitializeNewTask indicates an expected call of InitializeNewTask.
func (mr *MockBlsAggregationServiceMockRecorder) InitializeNewTask(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call {
func (mr *MockBlsAggregationServiceMockRecorder) InitializeNewTask(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitializeNewTask", reflect.TypeOf((*MockBlsAggregationService)(nil).InitializeNewTask), arg0, arg1, arg2, arg3, arg4)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitializeNewTask", reflect.TypeOf((*MockBlsAggregationService)(nil).InitializeNewTask), arg0)
}

// ProcessNewSignature mocks base method.
func (m *MockBlsAggregationService) ProcessNewSignature(arg0 context.Context, arg1 uint32, arg2 interface{}, arg3 *bls.Signature, arg4 sdktypes.Bytes32) error {
func (m *MockBlsAggregationService) ProcessNewSignature(arg0 context.Context, arg1 blsagg.TaskSignature) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ProcessNewSignature", arg0, arg1, arg2, arg3, arg4)
ret := m.ctrl.Call(m, "ProcessNewSignature", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
}

// ProcessNewSignature indicates an expected call of ProcessNewSignature.
func (mr *MockBlsAggregationServiceMockRecorder) ProcessNewSignature(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call {
func (mr *MockBlsAggregationServiceMockRecorder) ProcessNewSignature(arg0, arg1 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessNewSignature", reflect.TypeOf((*MockBlsAggregationService)(nil).ProcessNewSignature), arg0, arg1, arg2, arg3, arg4)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ProcessNewSignature", reflect.TypeOf((*MockBlsAggregationService)(nil).ProcessNewSignature), arg0, arg1)
}

type MockTask struct {
Expand Down Expand Up @@ -137,7 +137,14 @@ func TestSendNewTask(t *testing.T) {
// make sure that initializeNewTask was called on the blsAggService
// maybe there's a better way to do this? There's a saying "don't mock 3rd party code"
// see https://hynek.me/articles/what-to-mock-in-5-mins/
mockBlsAggService.EXPECT().InitializeNewTask(TASK_INDEX, BLOCK_NUMBER, types.QUORUM_NUMBERS, sdktypes.QuorumThresholdPercentages{types.QUORUM_THRESHOLD_NUMERATOR}, taskTimeToExpiry)
taskMetadata := blsagg.NewTaskMetadata(
TASK_INDEX,
BLOCK_NUMBER,
types.QUORUM_NUMBERS,
sdktypes.QuorumThresholdPercentages{types.QUORUM_THRESHOLD_NUMERATOR},
taskTimeToExpiry,
)
mockBlsAggService.EXPECT().InitializeNewTask(taskMetadata)

err = aggregator.sendNewTask(NUMBER_TO_SQUARE_BIG_INT)
assert.Nil(t, err)
Expand Down
13 changes: 7 additions & 6 deletions aggregator/rpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (
cstaskmanager "github.com/Layr-Labs/incredible-squaring-avs/contracts/bindings/IncredibleSquaringTaskManager"

"github.com/Layr-Labs/eigensdk-go/crypto/bls"
"github.com/Layr-Labs/eigensdk-go/types"
blsagg "github.com/Layr-Labs/eigensdk-go/services/bls_aggregation"
sdktypes "github.com/Layr-Labs/eigensdk-go/types"
)

var (
Expand Down Expand Up @@ -39,7 +40,7 @@ func (agg *Aggregator) startServer(ctx context.Context) error {
type SignedTaskResponse struct {
TaskResponse cstaskmanager.IIncredibleSquaringTaskManagerTaskResponse
BlsSignature bls.Signature
OperatorId types.OperatorId
OperatorId sdktypes.OperatorId
}

// rpc endpoint which is called by operator
Expand All @@ -49,9 +50,9 @@ func (agg *Aggregator) ProcessSignedTaskResponse(signedTaskResponse *SignedTaskR
agg.logger.Infof("Received signed task response: %#v", signedTaskResponse)
taskIndex := signedTaskResponse.TaskResponse.ReferenceTaskIndex

err := agg.blsAggregationService.ProcessNewSignature(
context.Background(), taskIndex, signedTaskResponse.TaskResponse,
&signedTaskResponse.BlsSignature, signedTaskResponse.OperatorId,
)
taskSignature := blsagg.NewTaskSignature(taskIndex, signedTaskResponse.TaskResponse, &signedTaskResponse.BlsSignature, signedTaskResponse.OperatorId)

err := agg.blsAggregationService.ProcessNewSignature(context.Background(), taskSignature)

return err
}
4 changes: 3 additions & 1 deletion aggregator/rpc_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"go.uber.org/mock/gomock"

"github.com/Layr-Labs/eigensdk-go/crypto/bls"
blsagg "github.com/Layr-Labs/eigensdk-go/services/bls_aggregation"
sdktypes "github.com/Layr-Labs/eigensdk-go/types"
"github.com/Layr-Labs/incredible-squaring-avs/aggregator/types"
cstaskmanager "github.com/Layr-Labs/incredible-squaring-avs/contracts/bindings/IncredibleSquaringTaskManager"
Expand Down Expand Up @@ -52,8 +53,9 @@ func TestProcessSignedTaskResponse(t *testing.T) {
// TODO(samlaf): is this the right way to test writing to external service?
// or is there some wisdom to "don't mock 3rd party code"?
// see https://hynek.me/articles/what-to-mock-in-5-mins/
mockBlsAggServ.EXPECT().ProcessNewSignature(context.Background(), TASK_INDEX, signedTaskResponse.TaskResponse,
taskSignature := blsagg.NewTaskSignature(TASK_INDEX, signedTaskResponse.TaskResponse,
&signedTaskResponse.BlsSignature, signedTaskResponse.OperatorId)
mockBlsAggServ.EXPECT().ProcessNewSignature(context.Background(), taskSignature)
err = aggregator.ProcessSignedTaskResponse(signedTaskResponse, nil)
assert.Nil(t, err)
}
Expand Down
Loading