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

Refactor Aggregator to remove taskResponses #99

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ba0af4c
Upgrading sdk version i go.mod and go.sum
pablodeymo Oct 8, 2024
1c1041f
upgrade go-ethereum in go.sum
pablodeymo Oct 8, 2024
63e3f2c
fixing some compilation errors
pablodeymo Oct 8, 2024
dca8411
fixing challenger.go
pablodeymo Oct 8, 2024
cc9a42e
config.go upgraded
pablodeymo Oct 8, 2024
c2b5236
BuildAvsSubscriber fixed
pablodeymo Oct 8, 2024
18fb982
adding missing parameter to Send
pablodeymo Oct 8, 2024
4f47565
changing to logger := testutils.GetTestLogger()
pablodeymo Oct 8, 2024
e65fbde
challenger fixed
pablodeymo Oct 8, 2024
e1d4e35
hashFunction in aggregator.go
pablodeymo Oct 8, 2024
ab045cf
MockBlsAggregationService in aggregator_test.go
pablodeymo Oct 8, 2024
bb10b73
fixing config.go
pablodeymo Oct 9, 2024
588a6a5
fixing avs_reader avs_writer y bindings
pablodeymo Oct 9, 2024
8a16a93
fixing avs writer and reader
pablodeymo Oct 9, 2024
74e13e9
AvsWriterer and AvsReaderer fixed
pablodeymo Oct 9, 2024
253ea2b
operator.go fixed
pablodeymo Oct 9, 2024
5fdb7d7
registration.go fixed
pablodeymo Oct 9, 2024
da50d14
aggregator.go fixed
pablodeymo Oct 9, 2024
4880aaf
RegisterOperatorInQuorumWithAVSRegistryCoordinator in main.go fixed
pablodeymo Oct 9, 2024
db0e8c7
main.go fixed
pablodeymo Oct 9, 2024
1210835
integration_test.go fixed
pablodeymo Oct 9, 2024
fef94ea
challenger fixed
pablodeymo Oct 10, 2024
4e03208
Adding interface EthClientInterface
pablodeymo Oct 14, 2024
d862586
Merge branch 'master' into upgrade_to_eigen_sdk_0.1.12
pablodeymo Oct 14, 2024
e607aba
fix errors with pointers
pablodeymo Oct 14, 2024
cb9225b
aggregator hash function fixed to match the one used by the operator
pablodeymo Oct 15, 2024
fdb9942
removing extra if err != nil
pablodeymo Oct 15, 2024
aae8ccd
try 3 times to get responses from task manager
pablodeymo Oct 15, 2024
0bcc22b
pin foundry version for tests
TomasArrachea Oct 16, 2024
a7824da
fix aggregator task response processing
TomasArrachea Oct 18, 2024
fae8ffd
fix aggregator test
TomasArrachea Oct 18, 2024
8a36b73
Merge branch 'master' into upgrade_to_eigen_sdk_0.1.12
TomasArrachea Oct 18, 2024
db657e7
refactor aggregator to remove taskResponses map
TomasArrachea Nov 15, 2024
9336147
Merge branch 'master' into remove_task_responses_from_aggregator
TomasArrachea Nov 15, 2024
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
7 changes: 1 addition & 6 deletions aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ type Aggregator struct {
blsAggregationService blsagg.BlsAggregationService
tasks map[types.TaskIndex]cstaskmanager.IIncredibleSquaringTaskManagerTask
tasksMu sync.RWMutex
taskResponses map[types.TaskIndex]map[sdktypes.TaskResponseDigest]cstaskmanager.IIncredibleSquaringTaskManagerTaskResponse
taskResponsesMu sync.RWMutex
}

// NewAggregator creates a new Aggregator with the provided config.
Expand Down Expand Up @@ -156,7 +154,6 @@ func NewAggregator(c *config.Config) (*Aggregator, error) {
avsWriter: avsWriter,
blsAggregationService: blsAggregationService,
tasks: make(map[types.TaskIndex]cstaskmanager.IIncredibleSquaringTaskManagerTask),
taskResponses: make(map[types.TaskIndex]map[sdktypes.TaskResponseDigest]cstaskmanager.IIncredibleSquaringTaskManagerTaskResponse),
}, nil
}

Expand Down Expand Up @@ -225,9 +222,7 @@ func (agg *Aggregator) sendAggregatedResponseToContract(blsAggServiceResp blsagg
agg.tasksMu.RLock()
task := agg.tasks[blsAggServiceResp.TaskIndex]
agg.tasksMu.RUnlock()
agg.taskResponsesMu.RLock()
taskResponse := agg.taskResponses[blsAggServiceResp.TaskIndex][blsAggServiceResp.TaskResponseDigest]
agg.taskResponsesMu.RUnlock()
taskResponse, _ := blsAggServiceResp.TaskResponse.(cstaskmanager.IIncredibleSquaringTaskManagerTaskResponse)
_, err := agg.avsWriter.SendAggregatedResponse(context.Background(), task, taskResponse, nonSignerStakesAndSignature)
if err != nil {
agg.logger.Error("Aggregator failed to respond to task", "err", err)
Expand Down
1 change: 0 additions & 1 deletion aggregator/aggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ func createMockAggregator(
avsWriter: mockAvsWriter,
blsAggregationService: mockBlsAggregationService,
tasks: make(map[types.TaskIndex]cstaskmanager.IIncredibleSquaringTaskManagerTask),
taskResponses: make(map[types.TaskIndex]map[sdktypes.TaskResponseDigest]cstaskmanager.IIncredibleSquaringTaskManagerTaskResponse),
}
return aggregator, mockAvsWriter, mockBlsAggregationService, nil
}
Expand Down
17 changes: 1 addition & 16 deletions aggregator/rpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import (
"net/rpc"

cstaskmanager "github.com/Layr-Labs/incredible-squaring-avs/contracts/bindings/IncredibleSquaringTaskManager"
"github.com/Layr-Labs/incredible-squaring-avs/core"

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

var (
Expand Down Expand Up @@ -50,21 +48,8 @@ type SignedTaskResponse struct {
func (agg *Aggregator) ProcessSignedTaskResponse(signedTaskResponse *SignedTaskResponse, reply *bool) error {
agg.logger.Infof("Received signed task response: %#v", signedTaskResponse)
taskIndex := signedTaskResponse.TaskResponse.ReferenceTaskIndex
taskResponseDigest, err := core.GetTaskResponseDigest(&signedTaskResponse.TaskResponse)
if err != nil {
agg.logger.Error("Failed to get task response digest", "err", err)
return TaskResponseDigestNotFoundError500
}
agg.taskResponsesMu.Lock()
if _, ok := agg.taskResponses[taskIndex]; !ok {
agg.taskResponses[taskIndex] = make(map[sdktypes.TaskResponseDigest]cstaskmanager.IIncredibleSquaringTaskManagerTaskResponse)
}
if _, ok := agg.taskResponses[taskIndex][taskResponseDigest]; !ok {
agg.taskResponses[taskIndex][taskResponseDigest] = signedTaskResponse.TaskResponse
}
agg.taskResponsesMu.Unlock()

err = agg.blsAggregationService.ProcessNewSignature(
err := agg.blsAggregationService.ProcessNewSignature(
context.Background(), taskIndex, signedTaskResponse.TaskResponse,
&signedTaskResponse.BlsSignature, signedTaskResponse.OperatorId,
)
Expand Down
Loading