Skip to content

Fix code formatting with gofmt #203

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

Merged
merged 3 commits into from
Apr 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ run:

# Go version to use for analysis
# Default: auto-detected
go: "1.24"
go: "1.22"

# Exit code when at least one issue was found.
# Default: 1
Expand Down
2 changes: 1 addition & 1 deletion aggregator/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type OperatorNode struct {

func (o *OperatorNode) LastSeen() string {
now := time.Now()

var last time.Time
if o.LastPingEpoch > 1e12 { // Threshold for milliseconds (timestamps after 2001)
last = time.Unix(o.LastPingEpoch/1000, 0)
Expand Down
4 changes: 2 additions & 2 deletions aggregator/pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

func TestLastSeen(t *testing.T) {
now := time.Now()

testCases := []struct {
name string
lastPingEpoch int64
Expand Down Expand Up @@ -53,7 +53,7 @@ func TestLastSeen(t *testing.T) {
LastPingEpoch: tc.lastPingEpoch,
Version: "1.0.0",
}

result := node.LastSeen()
if result != tc.expectedFormat {
t.Errorf("Expected format %s, got %s", tc.expectedFormat, result)
Expand Down
1 change: 0 additions & 1 deletion aggregator/rpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ func (r *RpcServer) GetExecutionCount(ctx context.Context, req *avsproto.GetExec
return r.engine.GetExecutionCount(user, req)
}


// Operator action
func (r *RpcServer) SyncMessages(payload *avsproto.SyncMessagesReq, srv avsproto.Node_SyncMessagesServer) error {
err := r.engine.StreamCheckToOperator(payload, srv)
Expand Down
2 changes: 0 additions & 2 deletions core/apqueue/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
sdklogging "github.com/Layr-Labs/eigensdk-go/logging"
)

var ()

type Queue struct {
db storage.Storage
dbLock sync.Mutex
Expand Down
6 changes: 3 additions & 3 deletions core/chainio/avs_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ func BuildAvsWriter(txMgr txmgr.TxManager, registryCoordinatorAddr, operatorStat
//avsRegistryWriter, err := avsregistry.BuildAvsRegistryChainWriter(registryCoordinatorAddr, operatorStateRetrieverAddr, logger, ethHttpClient, txMgr)
avsRegistryWriter, err := avsregistry.NewWriterFromConfig(
avsregistry.Config{
RegistryCoordinatorAddress: registryCoordinatorAddr,
RegistryCoordinatorAddress: registryCoordinatorAddr,
OperatorStateRetrieverAddress: operatorStateRetrieverAddr,
},
ethHttpClient, txMgr,logger,
ethHttpClient, txMgr, logger,
)
if err != nil {
return nil, err
Expand All @@ -50,7 +50,7 @@ func BuildAvsWriter(txMgr txmgr.TxManager, registryCoordinatorAddr, operatorStat
}
func NewAvsWriter(avsRegistryWriter *avsregistry.ChainWriter, avsServiceBindings *AvsManagersBindings, logger logging.Logger, txMgr txmgr.TxManager) *AvsWriter {
return &AvsWriter{
ChainWriter: avsRegistryWriter,
ChainWriter: avsRegistryWriter,
AvsContractBindings: avsServiceBindings,
logger: logger,
TxMgr: txMgr,
Expand Down
4 changes: 2 additions & 2 deletions core/taskengine/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ func (n *Engine) ListTasksByUser(user *model.User, payload *avsproto.ListTasksRe
}

func (n *Engine) GetTaskByID(taskID string) (*model.Task, error) {
for status, _ := range avsproto.TaskStatus_name {
for status := range avsproto.TaskStatus_name {
if rawTaskData, err := n.db.GetKey(TaskStorageKey(taskID, avsproto.TaskStatus(status))); err == nil {
task := model.NewTask()
err = task.FromStorageData(rawTaskData)
Expand Down Expand Up @@ -1059,4 +1059,4 @@ func (n *Engine) GetWorkflowCount(user *model.User, payload *avsproto.GetWorkflo
return &avsproto.GetWorkflowCountResp{
Total: total,
}, nil
}
}
48 changes: 24 additions & 24 deletions core/taskengine/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ func TestExecutorRunTaskSucess(t *testing.T) {
defer server.Close()

nodes := []*avsproto.TaskNode{
&avsproto.TaskNode{
{
Id: "branch1",
Name: "branch",
TaskType: &avsproto.TaskNode_Branch{
Branch: &avsproto.BranchNode{
Conditions: []*avsproto.Condition{
&avsproto.Condition{
{
Id: "a1",
Type: "if",
// The test data is of this transaction https://sepolia.etherscan.io/tx/0x53beb2163994510e0984b436ebc828dc57e480ee671cfbe7ed52776c2a4830c8 which is 3.45 token
Expand All @@ -45,7 +45,7 @@ func TestExecutorRunTaskSucess(t *testing.T) {
},
},
},
&avsproto.TaskNode{
{
Id: "notification1",
Name: "httpnode",
TaskType: &avsproto.TaskNode_RestApi{
Expand All @@ -63,12 +63,12 @@ func TestExecutorRunTaskSucess(t *testing.T) {
Name: "triggertest",
}
edges := []*avsproto.TaskEdge{
&avsproto.TaskEdge{
{
Id: "e1",
Source: trigger.Id,
Target: "branch1",
},
&avsproto.TaskEdge{
{
Id: "e1",
Source: "branch1.a1",
Target: "notification1",
Expand Down Expand Up @@ -135,13 +135,13 @@ func TestExecutorRunTaskStopAndReturnErrorWhenANodeFailed(t *testing.T) {
defer storage.Destroy(db.(*storage.BadgerStorage))

nodes := []*avsproto.TaskNode{
&avsproto.TaskNode{
{
Id: "branch1",
Name: "branch",
TaskType: &avsproto.TaskNode_Branch{
Branch: &avsproto.BranchNode{
Conditions: []*avsproto.Condition{
&avsproto.Condition{
{
Id: "a1",
Type: "if",
Expression: "a >= 5",
Expand All @@ -150,7 +150,7 @@ func TestExecutorRunTaskStopAndReturnErrorWhenANodeFailed(t *testing.T) {
},
},
},
&avsproto.TaskNode{
{
Id: "notification1",
Name: "httpnode",
TaskType: &avsproto.TaskNode_RestApi{
Expand All @@ -168,12 +168,12 @@ func TestExecutorRunTaskStopAndReturnErrorWhenANodeFailed(t *testing.T) {
Name: "triggertest",
}
edges := []*avsproto.TaskEdge{
&avsproto.TaskEdge{
{
Id: "e1",
Source: trigger.Id,
Target: "branch1",
},
&avsproto.TaskEdge{
{
Id: "e1",
Source: "branch1.a1",
Target: "notification1",
Expand Down Expand Up @@ -229,13 +229,13 @@ func TestExecutorRunTaskComputeSuccessFalseWhenANodeFailedToRun(t *testing.T) {
defer storage.Destroy(db.(*storage.BadgerStorage))

nodes := []*avsproto.TaskNode{
&avsproto.TaskNode{
{
Id: "branch1",
Name: "branch",
TaskType: &avsproto.TaskNode_Branch{
Branch: &avsproto.BranchNode{
Conditions: []*avsproto.Condition{
&avsproto.Condition{
{
Id: "condition1",
Type: "if",
Expression: "true",
Expand All @@ -244,7 +244,7 @@ func TestExecutorRunTaskComputeSuccessFalseWhenANodeFailedToRun(t *testing.T) {
},
},
},
&avsproto.TaskNode{
{
Id: "rest1",
Name: "httpnode",
TaskType: &avsproto.TaskNode_RestApi{
Expand All @@ -262,12 +262,12 @@ func TestExecutorRunTaskComputeSuccessFalseWhenANodeFailedToRun(t *testing.T) {
Name: "triggertest",
}
edges := []*avsproto.TaskEdge{
&avsproto.TaskEdge{
{
Id: "e1",
Source: trigger.Id,
Target: "branch1",
},
&avsproto.TaskEdge{
{
Id: "e1",
Source: "branch1.condition1",
Target: "rest1",
Expand Down Expand Up @@ -325,7 +325,7 @@ func TestExecutorRunTaskReturnAllExecutionData(t *testing.T) {
defer server.Close()

nodes := []*avsproto.TaskNode{
&avsproto.TaskNode{
{
Id: "spacex",
Name: "spacex",
TaskType: &avsproto.TaskNode_GraphqlQuery{
Expand All @@ -345,13 +345,13 @@ func TestExecutorRunTaskReturnAllExecutionData(t *testing.T) {
},
},
},
&avsproto.TaskNode{
{
Id: "branch1",
Name: "branch",
TaskType: &avsproto.TaskNode_Branch{
Branch: &avsproto.BranchNode{
Conditions: []*avsproto.Condition{
&avsproto.Condition{
{
Id: "condition1",
Type: "if",
Expression: "Number(triggertest.data.value_formatted) >= 3",
Expand All @@ -360,7 +360,7 @@ func TestExecutorRunTaskReturnAllExecutionData(t *testing.T) {
},
},
},
&avsproto.TaskNode{
{
Id: "customcode1",
Name: "dummy",
TaskType: &avsproto.TaskNode_CustomCode{
Expand All @@ -370,7 +370,7 @@ func TestExecutorRunTaskReturnAllExecutionData(t *testing.T) {
},
},
},
&avsproto.TaskNode{
{
Id: "rest1",
Name: "http",
TaskType: &avsproto.TaskNode_RestApi{
Expand All @@ -388,22 +388,22 @@ func TestExecutorRunTaskReturnAllExecutionData(t *testing.T) {
Name: "triggertest",
}
edges := []*avsproto.TaskEdge{
&avsproto.TaskEdge{
{
Id: "e0",
Source: trigger.Id,
Target: "spacex",
},
&avsproto.TaskEdge{
{
Id: "e1",
Source: "spacex",
Target: "branch1",
},
&avsproto.TaskEdge{
{
Id: "e1",
Source: "branch1.condition1",
Target: "customcode1",
},
&avsproto.TaskEdge{
{
Id: "e2",
Source: "customcode1",
Target: "rest1",
Expand Down
2 changes: 1 addition & 1 deletion core/taskengine/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,4 @@ func SecretNameFromKey(key string) *model.Secret {
// ContractWriteCounterKey returns the key for the contract write counter of a given eoa in our kv store
func ContractWriteCounterKey(eoa common.Address) []byte {
return []byte(fmt.Sprintf("ct:cw:%s", strings.ToLower(eoa.Hex())))
}
}
2 changes: 1 addition & 1 deletion core/taskengine/trigger/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (b *BlockTrigger) Run(ctx context.Context) error {
for interval, tasks := range b.schedule {
z := new(big.Int)
if z.Mod(header.Number, big.NewInt(int64(interval))).Cmp(zero) == 0 {
for taskID, _ := range tasks {
for taskID := range tasks {
b.triggerCh <- TriggerMetadata[int64]{
TaskID: taskID,
Marker: header.Number.Int64(),
Expand Down
2 changes: 1 addition & 1 deletion core/taskengine/trigger/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var (
// To reduce api call we listen to these topics only
// a better idea is to only subscribe to what we need and re-load when new trigger is added
whitelistTopics = [][]common.Hash{
[]common.Hash{
{
common.HexToHash("0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"), // erc20 transfer
//common.HexToHash("0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f"), // UserOp
//common.HexToHash("0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925"), // approve
Expand Down
18 changes: 9 additions & 9 deletions core/taskengine/trigger/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func TestTriggerTopicMatch(t *testing.T) {
},

Matcher: []*avsproto.EventCondition_Matcher{
&avsproto.EventCondition_Matcher{
{
Type: "topics",
Value: []string{
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
Expand Down Expand Up @@ -58,7 +58,7 @@ func TestTriggerTopicNotMatch(t *testing.T) {

result, err := eventTrigger.Evaluate(event, &Check{
Matcher: []*avsproto.EventCondition_Matcher{
&avsproto.EventCondition_Matcher{
{
Type: "topics",
Value: []string{
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
Expand Down Expand Up @@ -90,7 +90,7 @@ func TestTriggerTopicMulti(t *testing.T) {
result, err := eventTrigger.Evaluate(event, &Check{

Matcher: []*avsproto.EventCondition_Matcher{
&avsproto.EventCondition_Matcher{
{
Type: "topics",
Value: []string{
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
Expand All @@ -106,14 +106,14 @@ func TestTriggerTopicMulti(t *testing.T) {

result, err = eventTrigger.Evaluate(event, &Check{
Matcher: []*avsproto.EventCondition_Matcher{
&avsproto.EventCondition_Matcher{
{
Type: "topics",
Value: []string{
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
},
},
&avsproto.EventCondition_Matcher{
{
Type: "topics",
Value: []string{
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
Expand Down Expand Up @@ -144,7 +144,7 @@ func TestTriggerAddress(t *testing.T) {

result, err := eventTrigger.Evaluate(event, &Check{
Matcher: []*avsproto.EventCondition_Matcher{
&avsproto.EventCondition_Matcher{
{
Type: "address",
Value: []string{
"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
Expand All @@ -159,7 +159,7 @@ func TestTriggerAddress(t *testing.T) {

result, err = eventTrigger.Evaluate(event, &Check{
Matcher: []*avsproto.EventCondition_Matcher{
&avsproto.EventCondition_Matcher{
{
Type: "address",
Value: []string{
"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7237",
Expand All @@ -184,7 +184,7 @@ func TestTriggerAddressNegativeCase(t *testing.T) {

result, err := eventTrigger.Evaluate(event, &Check{
Matcher: []*avsproto.EventCondition_Matcher{
&avsproto.EventCondition_Matcher{
{
Type: "address",
Value: []string{
"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7237",
Expand All @@ -209,7 +209,7 @@ func TestTriggerNonTransferEvent(t *testing.T) {

result, err := eventTrigger.Evaluate(event, &Check{
Matcher: []*avsproto.EventCondition_Matcher{
&avsproto.EventCondition_Matcher{
{
Type: "topics",
Value: []string{
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
Expand Down
Loading