diff --git a/core/taskengine/engine.go b/core/taskengine/engine.go index bcec9bec..08462af6 100644 --- a/core/taskengine/engine.go +++ b/core/taskengine/engine.go @@ -492,7 +492,7 @@ func (n *Engine) ListTasksByUser(user *model.User, payload *avsproto.ListTasksRe SmartWalletAddress: t.SmartWalletAddress, StartAt: t.StartAt, ExpiredAt: t.ExpiredAt, - Memo: t.Memo, + Name: t.Name, CompletedAt: t.CompletedAt, MaxExecution: t.MaxExecution, TotalExecution: t.TotalExecution, diff --git a/core/taskengine/engine_test.go b/core/taskengine/engine_test.go index 1921ae3b..f0c568e5 100644 --- a/core/taskengine/engine_test.go +++ b/core/taskengine/engine_test.go @@ -26,20 +26,20 @@ func TestListTasks(t *testing.T) { // Now create a test task tr1 := testutil.RestTask() - tr1.Memo = "t1" + tr1.Name = "t1" // salt 0 tr1.SmartWalletAddress = "0x7c3a76086588230c7B3f4839A4c1F5BBafcd57C6" n.CreateTask(testutil.TestUser1(), tr1) tr2 := testutil.RestTask() - tr2.Memo = "t2" + tr2.Name = "t2" // salt 12345 tr2.SmartWalletAddress = "0x961d2DD008960A9777571D78D21Ec9C3E5c6020c" n.CreateTask(testutil.TestUser1(), tr2) tr3 := testutil.RestTask() // salt 6789 - tr3.Memo = "t3" + tr3.Name = "t3" tr3.SmartWalletAddress = "0x5D36dCdB35D0C85D88C5AA31E37cac165B480ba4" n.CreateTask(testutil.TestUser1(), tr3) @@ -54,8 +54,8 @@ func TestListTasks(t *testing.T) { if len(result.Items) != 1 { t.Errorf("list task return wrong. expect 1, got %d", len(result.Items)) } - if result.Items[0].Memo != "t3" { - t.Errorf("list task return wrong. expect memo t1, got %s", result.Items[0].Memo) + if result.Items[0].Name != "t3" { + t.Errorf("list task return wrong. expect memo t1, got %s", result.Items[0].Name) } result, err = n.ListTasksByUser(testutil.TestUser1(), &avsproto.ListTasksReq{ @@ -68,8 +68,8 @@ func TestListTasks(t *testing.T) { if len(result.Items) != 2 { t.Errorf("list task returns wrong. expect 2, got %d", len(result.Items)) } - if result.Items[0].Memo != "t2" && result.Items[1].Memo != "t1" { - t.Errorf("list task returns wrong data. expect t2, t1 got %s, %s", result.Items[0].Memo, result.Items[1].Memo) + if result.Items[0].Name != "t2" && result.Items[1].Name != "t1" { + t.Errorf("list task returns wrong data. expect t2, t1 got %s, %s", result.Items[0].Name, result.Items[1].Name) } } @@ -89,13 +89,13 @@ func TestListTasksPagination(t *testing.T) { // Firs we setup test for a 3 smart walets, with overlap ordering // Now create a test task tr1 := testutil.RestTask() - tr1.Memo = "t1" + tr1.Name = "t1" // salt 0 tr1.SmartWalletAddress = "0x7c3a76086588230c7B3f4839A4c1F5BBafcd57C6" n.CreateTask(testutil.TestUser1(), tr1) tr2 := testutil.RestTask() - tr2.Memo = "t2_1" + tr2.Name = "t2_1" // salt 12345 tr2.SmartWalletAddress = "0x961d2DD008960A9777571D78D21Ec9C3E5c6020c" n.CreateTask(testutil.TestUser1(), tr2) @@ -103,13 +103,13 @@ func TestListTasksPagination(t *testing.T) { for i := range 20 { tr3 := testutil.RestTask() // salt 6789 - tr3.Memo = fmt.Sprintf("t3_%d", i) + tr3.Name = fmt.Sprintf("t3_%d", i) tr3.SmartWalletAddress = "0x5D36dCdB35D0C85D88C5AA31E37cac165B480ba4" n.CreateTask(testutil.TestUser1(), tr3) } tr2 = testutil.RestTask() - tr2.Memo = "t2_2" + tr2.Name = "t2_2" // salt 12345 tr2.SmartWalletAddress = "0x961d2DD008960A9777571D78D21Ec9C3E5c6020c" n.CreateTask(testutil.TestUser1(), tr2) @@ -134,12 +134,12 @@ func TestListTasksPagination(t *testing.T) { if len(result.Items) != 5 { t.Errorf("list task returns wrong. expect 5, got %d", len(result.Items)) } - if result.Items[0].Memo != "t2_2" { - t.Errorf("list task returns first task wrong. expect task t2, got %s", result.Items[0].Memo) + if result.Items[0].Name != "t2_2" { + t.Errorf("list task returns first task wrong. expect task t2, got %s", result.Items[0].Name) } - if result.Items[2].Memo != "t3_18" || result.Items[4].Memo != "t3_16" { - t.Errorf("list task returns wrong task result, expected t3_19 t3_17 got %s %s", result.Items[2].Memo, result.Items[4].Memo) + if result.Items[2].Name != "t3_18" || result.Items[4].Name != "t3_16" { + t.Errorf("list task returns wrong task result, expected t3_19 t3_17 got %s %s", result.Items[2].Name, result.Items[4].Name) } if result.Cursor == "" { @@ -157,8 +157,8 @@ func TestListTasksPagination(t *testing.T) { if len(result.Items) != 15 { t.Errorf("list task returns wrong. expect 15, got %d", len(result.Items)) } - if result.Items[0].Memo != "t3_15" || result.Items[2].Memo != "t3_13" || result.Items[14].Memo != "t3_1" { - t.Errorf("list task returns wrong task result, expected t3_15 t3_13 t3_1 got %s %s %s", result.Items[0].Memo, result.Items[2].Memo, result.Items[14].Memo) + if result.Items[0].Name != "t3_15" || result.Items[2].Name != "t3_13" || result.Items[14].Name != "t3_1" { + t.Errorf("list task returns wrong task result, expected t3_15 t3_13 t3_1 got %s %s %s", result.Items[0].Name, result.Items[2].Name, result.Items[14].Name) } if !result.HasMore { @@ -177,8 +177,8 @@ func TestListTasksPagination(t *testing.T) { if len(result.Items) != 2 { t.Errorf("list task returns wrong. expect 2, got %d", len(result.Items)) } - if result.Items[0].Memo != "t3_0" || result.Items[1].Memo != "t2_1" { - t.Errorf("list task returns wrong task result, expected t3_15 t3_1 got %s %s", result.Items[0].Memo, result.Items[1].Memo) + if result.Items[0].Name != "t3_0" || result.Items[1].Name != "t2_1" { + t.Errorf("list task returns wrong task result, expected t3_15 t3_1 got %s %s", result.Items[0].Name, result.Items[1].Name) } if result.HasMore { t.Errorf("expect hasmore is false, but got true") @@ -195,7 +195,7 @@ func TestGetExecution(t *testing.T) { // Now create a test task tr1 := testutil.RestTask() - tr1.Memo = "t1" + tr1.Name = "t1" // salt 0 tr1.SmartWalletAddress = "0x7c3a76086588230c7B3f4839A4c1F5BBafcd57C6" result, _ := n.CreateTask(testutil.TestUser1(), tr1) @@ -300,7 +300,7 @@ func TestTriggerSync(t *testing.T) { // Now create a test task tr1 := testutil.RestTask() - tr1.Memo = "t1" + tr1.Name = "t1" // salt 0 tr1.SmartWalletAddress = "0x7c3a76086588230c7B3f4839A4c1F5BBafcd57C6" result, _ := n.CreateTask(testutil.TestUser1(), tr1) @@ -351,7 +351,7 @@ func TestTriggerAsync(t *testing.T) { // Now create a test task tr1 := testutil.RestTask() - tr1.Memo = "t1" + tr1.Name = "t1" // salt 0 wallet tr1.SmartWalletAddress = "0x7c3a76086588230c7B3f4839A4c1F5BBafcd57C6" result, _ := n.CreateTask(testutil.TestUser1(), tr1) diff --git a/model/task.go b/model/task.go index cbd46862..b5c08ea4 100644 --- a/model/task.go +++ b/model/task.go @@ -61,7 +61,7 @@ func NewTaskFromProtobuf(user *User, body *avsproto.CreateTaskReq) (*Task, error Trigger: body.Trigger, Nodes: body.Nodes, Edges: body.Edges, - Memo: body.Memo, + Name: body.Name, ExpiredAt: body.ExpiredAt, StartAt: body.StartAt, MaxExecution: body.MaxExecution, diff --git a/protobuf/avs.pb.go b/protobuf/avs.pb.go index b6de161d..b9b9109b 100644 --- a/protobuf/avs.pb.go +++ b/protobuf/avs.pb.go @@ -1786,7 +1786,7 @@ type Task struct { // task won't be run/check after this ExpiredAt int64 `protobuf:"varint,5,opt,name=expired_at,json=expiredAt,proto3" json:"expired_at,omitempty"` // arbitrary data about this task. has a limit of 255 character - Memo string `protobuf:"bytes,6,opt,name=memo,proto3" json:"memo,omitempty"` + Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"` CompletedAt int64 `protobuf:"varint,7,opt,name=completed_at,json=completedAt,proto3" json:"completed_at,omitempty"` // limit on how many time this task can run. Set to 0 will make it run unlimited until cancelling or reaching its expired time MaxExecution int64 `protobuf:"varint,8,opt,name=max_execution,json=maxExecution,proto3" json:"max_execution,omitempty"` @@ -1866,9 +1866,9 @@ func (x *Task) GetExpiredAt() int64 { return 0 } -func (x *Task) GetMemo() string { +func (x *Task) GetName() string { if x != nil { - return x.Memo + return x.Name } return "" } @@ -1941,7 +1941,7 @@ type CreateTaskReq struct { // the smart wallet address that will be used to run this task // When leaving out, we will use the default(salt=0) wallet SmartWalletAddress string `protobuf:"bytes,5,opt,name=smart_wallet_address,json=smartWalletAddress,proto3" json:"smart_wallet_address,omitempty"` - Memo string `protobuf:"bytes,6,opt,name=memo,proto3" json:"memo,omitempty"` + Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"` Nodes []*TaskNode `protobuf:"bytes,7,rep,name=nodes,proto3" json:"nodes,omitempty"` Edges []*TaskEdge `protobuf:"bytes,8,rep,name=edges,proto3" json:"edges,omitempty"` } @@ -2013,9 +2013,9 @@ func (x *CreateTaskReq) GetSmartWalletAddress() string { return "" } -func (x *CreateTaskReq) GetMemo() string { +func (x *CreateTaskReq) GetName() string { if x != nil { - return x.Memo + return x.Name } return "" } @@ -3246,7 +3246,7 @@ type ListTasksResp_Item struct { // task won't be run/check after this ExpiredAt int64 `protobuf:"varint,5,opt,name=expired_at,json=expiredAt,proto3" json:"expired_at,omitempty"` // arbitrary data about this task. has a limit of 255 character - Memo string `protobuf:"bytes,6,opt,name=memo,proto3" json:"memo,omitempty"` + Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"` CompletedAt int64 `protobuf:"varint,7,opt,name=completed_at,json=completedAt,proto3" json:"completed_at,omitempty"` // limit on how many time this task can run. Set to 0 will make it run unlimited until cancelling or reaching its expired time MaxExecution int64 `protobuf:"varint,8,opt,name=max_execution,json=maxExecution,proto3" json:"max_execution,omitempty"` @@ -3324,9 +3324,9 @@ func (x *ListTasksResp_Item) GetExpiredAt() int64 { return 0 } -func (x *ListTasksResp_Item) GetMemo() string { +func (x *ListTasksResp_Item) GetName() string { if x != nil { - return x.Memo + return x.Name } return "" } @@ -3588,8 +3588,8 @@ var file_protobuf_avs_proto_rawDesc = []byte{ 0x73, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x73, 0x74, 0x61, 0x72, 0x74, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x41, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6d, - 0x65, 0x6d, 0x6f, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x12, + 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x41, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x6d, 0x61, 0x78, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, @@ -3624,8 +3624,8 @@ var file_protobuf_avs_proto_rawDesc = []byte{ 0x30, 0x0a, 0x14, 0x73, 0x6d, 0x61, 0x72, 0x74, 0x5f, 0x77, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x73, 0x6d, 0x61, 0x72, 0x74, 0x57, 0x61, 0x6c, 0x6c, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x12, 0x2a, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x07, + 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x2a, 0x0a, 0x05, 0x65, 0x64, 0x67, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, @@ -3677,8 +3677,8 @@ var file_protobuf_avs_proto_rawDesc = []byte{ 0x74, 0x5f, 0x61, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x73, 0x74, 0x61, 0x72, 0x74, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x64, - 0x41, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, + 0x41, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x6d, 0x61, 0x78, 0x5f, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, diff --git a/protobuf/avs.proto b/protobuf/avs.proto index 9846de3e..2606b4f1 100644 --- a/protobuf/avs.proto +++ b/protobuf/avs.proto @@ -252,7 +252,7 @@ message Task { // task won't be run/check after this int64 expired_at = 5; // arbitrary data about this task. has a limit of 255 character - string memo = 6; + string name = 6; int64 completed_at = 7; @@ -281,7 +281,7 @@ message CreateTaskReq { // When leaving out, we will use the default(salt=0) wallet string smart_wallet_address = 5; - string memo = 6; + string name = 6; repeated TaskNode nodes = 7; repeated TaskEdge edges = 8; } @@ -334,7 +334,7 @@ message ListTasksResp { // task won't be run/check after this int64 expired_at = 5; // arbitrary data about this task. has a limit of 255 character - string memo = 6; + string name = 6; int64 completed_at = 7;