diff --git a/core/main.go b/core/main.go index ecdfc2050..97c2ab303 100644 --- a/core/main.go +++ b/core/main.go @@ -36,8 +36,8 @@ import ( db "github.com/tendermint/tm-db" ) -func stopRunningServices(mc *cosmos.ModuleClient, b *builder.Builder, address string) error { - runners, err := mc.ListRunner(&cosmos.FilterRunner{Address: address}) +func stopRunningServices(mc *cosmos.ModuleClient, b *builder.Builder, owner string) error { + runners, err := mc.ListRunner(&cosmos.FilterRunner{Owner: owner}) if err != nil { return err } diff --git a/cosmos/module_client.go b/cosmos/module_client.go index a0b23c788..a027f2192 100644 --- a/cosmos/module_client.go +++ b/cosmos/module_client.go @@ -257,7 +257,7 @@ func (mc *ModuleClient) GetRunner(hash hash.Hash) (*runnerpb.Runner, error) { // FilterRunner to apply while listing runners. type FilterRunner struct { - Address string + Owner string InstanceHash hash.Hash } @@ -277,7 +277,7 @@ func (mc *ModuleClient) ListRunner(f *FilterRunner) ([]*runnerpb.Runner, error) // filter results out := make([]*runnerpb.Runner, 0) for _, r := range rs { - if (f.Address == "" || r.Address == f.Address) && + if (f.Owner == "" || r.Owner == f.Owner) && (f.InstanceHash.IsZero() || r.InstanceHash.Equal(f.InstanceHash)) { out = append(out, r) } diff --git a/e2e/execution_test.go b/e2e/execution_test.go index 5a4a69b66..62185031f 100644 --- a/e2e/execution_test.go +++ b/e2e/execution_test.go @@ -14,7 +14,6 @@ import ( "github.com/mesg-foundation/engine/protobuf/types" "github.com/mesg-foundation/engine/x/ownership" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto" ) func testExecution(t *testing.T) { @@ -23,6 +22,7 @@ func testExecution(t *testing.T) { streamCompleted pb.Execution_StreamClient err error executorHash = testRunnerHash + executorAddress = testRunnerAddress ) t.Run("create stream nil filter", func(t *testing.T) { @@ -214,9 +214,13 @@ func testExecution(t *testing.T) { }) require.NoError(t, err) - execAddress := sdk.AccAddress(crypto.AddressHash(resp.Hash)) - executorAddress := sdk.AccAddress(crypto.AddressHash(executorHash)) - serviceAddress := sdk.AccAddress(crypto.AddressHash(testServiceHash)) + var execAddress sdk.AccAddress + t.Run("get execution address", func(t *testing.T) { + var exec *execution.Execution + lcdGet(t, "execution/get/"+resp.Hash.String(), &exec) + require.Equal(t, exec.Hash, resp.Hash) + execAddress = exec.Address + }) // check balance of execution before completed t.Run("execution balance before completed", func(t *testing.T) { @@ -232,7 +236,7 @@ func testExecution(t *testing.T) { var executorBalance sdk.Coins var serviceBalance sdk.Coins lcdGet(t, "bank/balances/"+executorAddress.String(), &executorBalance) - lcdGet(t, "bank/balances/"+serviceAddress.String(), &serviceBalance) + lcdGet(t, "bank/balances/"+testServiceAddress.String(), &serviceBalance) _, err = streamInProgress.Recv() require.NoError(t, err) @@ -250,13 +254,12 @@ func testExecution(t *testing.T) { // check balance of service t.Run("service balance", func(t *testing.T) { coins := sdk.Coins{} - lcdGet(t, "bank/balances/"+serviceAddress.String(), &coins) + lcdGet(t, "bank/balances/"+testServiceAddress.String(), &coins) require.True(t, coins.AmountOf("atto").Equal(expectedCoinsForService.Add(serviceBalance.AmountOf("atto"))), coins) }) // check balance of execution t.Run("execution balance", func(t *testing.T) { coins := sdk.Coins{} - execAddress := sdk.AccAddress(crypto.AddressHash(resp.Hash)) lcdGet(t, "bank/balances/"+execAddress.String(), &coins) require.True(t, coins.AmountOf("atto").Equal(sdk.NewInt(0)), coins) }) @@ -269,7 +272,7 @@ func testExecution(t *testing.T) { _, err = cclient.BuildAndBroadcastMsg(msg) require.NoError(t, err) - param := bank.NewQueryBalanceParams(sdk.AccAddress(crypto.AddressHash(testServiceHash))) + param := bank.NewQueryBalanceParams(testServiceAddress) require.NoError(t, cclient.QueryJSON("custom/bank/balances", param, &coins)) require.True(t, coins.AmountOf("atto").Equal(serviceBalance.AmountOf("atto")), coins) }) @@ -282,7 +285,7 @@ func testExecution(t *testing.T) { _, err = cclient.BuildAndBroadcastMsg(msg) require.NoError(t, err) - param := bank.NewQueryBalanceParams(sdk.AccAddress(crypto.AddressHash(testRunnerHash))) + param := bank.NewQueryBalanceParams(testRunnerAddress) require.NoError(t, cclient.QueryJSON("custom/bank/balances", param, &coins)) require.True(t, coins.AmountOf("atto").Equal(executorBalance.AmountOf("atto")), coins) }) diff --git a/e2e/orchestrator_balance_withdraw_test.go b/e2e/orchestrator_balance_withdraw_test.go index d1574181b..e134918ec 100644 --- a/e2e/orchestrator_balance_withdraw_test.go +++ b/e2e/orchestrator_balance_withdraw_test.go @@ -13,12 +13,14 @@ import ( pb "github.com/mesg-foundation/engine/protobuf/api" "github.com/mesg-foundation/engine/protobuf/types" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto" ) func testOrchestratorProcessBalanceWithdraw(executionStream pb.Execution_StreamClient, instanceHash hash.Hash) func(t *testing.T) { return func(t *testing.T) { - var processHash hash.Hash + var ( + processHash hash.Hash + procAddress sdk.AccAddress + ) t.Run("create process", func(t *testing.T) { respProc, err := client.ProcessClient.Create(context.Background(), &pb.CreateProcessRequest{ @@ -50,9 +52,15 @@ func testOrchestratorProcessBalanceWithdraw(executionStream pb.Execution_StreamC require.NoError(t, err) processHash = respProc.Hash }) + t.Run("get process address", func(t *testing.T) { + var proc *process.Process + lcdGet(t, "process/get/"+processHash.String(), &proc) + require.Equal(t, proc.Hash, processHash) + procAddress = proc.Address + }) t.Run("check coins on process", func(t *testing.T) { var coins sdk.Coins - param := bank.NewQueryBalanceParams(sdk.AccAddress(crypto.AddressHash(processHash))) + param := bank.NewQueryBalanceParams(procAddress) require.NoError(t, cclient.QueryJSON("custom/bank/balances", param, &coins)) require.True(t, coins.IsEqual(processInitialBalance), coins) }) @@ -91,7 +99,7 @@ func testOrchestratorProcessBalanceWithdraw(executionStream pb.Execution_StreamC }) t.Run("check coins on process after 1 execution", func(t *testing.T) { var coins sdk.Coins - param := bank.NewQueryBalanceParams(sdk.AccAddress(crypto.AddressHash(processHash))) + param := bank.NewQueryBalanceParams(procAddress) require.NoError(t, cclient.QueryJSON("custom/bank/balances", param, &coins)) require.True(t, coins.IsEqual(processInitialBalance.Sub(minExecutionPrice)), coins) }) @@ -101,7 +109,7 @@ func testOrchestratorProcessBalanceWithdraw(executionStream pb.Execution_StreamC }) t.Run("check coins on process after deletion", func(t *testing.T) { var coins sdk.Coins - param := bank.NewQueryBalanceParams(sdk.AccAddress(crypto.AddressHash(processHash))) + param := bank.NewQueryBalanceParams(procAddress) require.NoError(t, cclient.QueryJSON("custom/bank/balances", param, &coins)) require.True(t, coins.IsZero(), coins) }) diff --git a/e2e/process_test.go b/e2e/process_test.go index c50767a13..09cd72219 100644 --- a/e2e/process_test.go +++ b/e2e/process_test.go @@ -11,15 +11,13 @@ import ( "github.com/mesg-foundation/engine/process" pb "github.com/mesg-foundation/engine/protobuf/api" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto" ) -var testProcessHash hash.Hash - func testProcess(t *testing.T) { var ( - processHash hash.Hash - req = &pb.CreateProcessRequest{ + processHash hash.Hash + processAddress sdk.AccAddress + req = &pb.CreateProcessRequest{ Name: "test-process", Nodes: []*process.Process_Node{ { @@ -53,32 +51,32 @@ func testProcess(t *testing.T) { t.Run("create", func(t *testing.T) { resp, err := client.ProcessClient.Create(context.Background(), req) require.NoError(t, err) - testProcessHash = resp.Hash + processHash = resp.Hash }) t.Run("get", func(t *testing.T) { t.Run("grpc", func(t *testing.T) { - p, err := client.ProcessClient.Get(context.Background(), &pb.GetProcessRequest{Hash: testProcessHash}) + p, err := client.ProcessClient.Get(context.Background(), &pb.GetProcessRequest{Hash: processHash}) require.NoError(t, err) require.True(t, p.Equal(&process.Process{ Hash: p.Hash, - Address: sdk.AccAddress(crypto.AddressHash(p.Hash)).String(), + Address: p.Address, Name: req.Name, Nodes: req.Nodes, Edges: req.Edges, })) - processHash = p.Hash }) t.Run("lcd", func(t *testing.T) { var p *process.Process - lcdGet(t, "process/get/"+testProcessHash.String(), &p) + lcdGet(t, "process/get/"+processHash.String(), &p) require.True(t, p.Equal(&process.Process{ Hash: p.Hash, - Address: sdk.AccAddress(crypto.AddressHash(p.Hash)).String(), + Address: p.Address, Name: req.Name, Nodes: req.Nodes, Edges: req.Edges, })) + processAddress = p.Address }) }) @@ -109,7 +107,7 @@ func testProcess(t *testing.T) { t.Run("check coins on process", func(t *testing.T) { var coins sdk.Coins - param := bank.NewQueryBalanceParams(sdk.AccAddress(crypto.AddressHash(processHash))) + param := bank.NewQueryBalanceParams(processAddress) require.NoError(t, cclient.QueryJSON("custom/bank/balances", param, &coins)) require.True(t, coins.IsEqual(processInitialBalance), coins) }) @@ -128,7 +126,7 @@ func testProcess(t *testing.T) { }) t.Run("delete", func(t *testing.T) { - _, err := client.ProcessClient.Delete(context.Background(), &pb.DeleteProcessRequest{Hash: testProcessHash}) + _, err := client.ProcessClient.Delete(context.Background(), &pb.DeleteProcessRequest{Hash: processHash}) require.NoError(t, err) }) @@ -147,7 +145,7 @@ func testProcess(t *testing.T) { t.Run("check coins on process", func(t *testing.T) { var coins sdk.Coins - param := bank.NewQueryBalanceParams(sdk.AccAddress(crypto.AddressHash(processHash))) + param := bank.NewQueryBalanceParams(processAddress) require.NoError(t, cclient.QueryJSON("custom/bank/balances", param, &coins)) require.True(t, coins.IsZero(), coins) }) diff --git a/e2e/runner_test.go b/e2e/runner_test.go index 1c7550841..b5df362d2 100644 --- a/e2e/runner_test.go +++ b/e2e/runner_test.go @@ -11,10 +11,10 @@ import ( pb "github.com/mesg-foundation/engine/protobuf/api" "github.com/mesg-foundation/engine/runner" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto" ) var testRunnerHash hash.Hash +var testRunnerAddress sdk.AccAddress func testRunner(t *testing.T) { t.Run("create", func(t *testing.T) { @@ -60,6 +60,7 @@ func testRunner(t *testing.T) { var r *runner.Runner lcdGet(t, "runner/get/"+testRunnerHash.String(), &r) require.Equal(t, testRunnerHash, r.Hash) + testRunnerAddress = r.Address }) }) @@ -98,7 +99,7 @@ func testDeleteRunner(t *testing.T) { }) t.Run("check coins on runner", func(t *testing.T) { var coins sdk.Coins - param := bank.NewQueryBalanceParams(sdk.AccAddress(crypto.AddressHash(testRunnerHash))) + param := bank.NewQueryBalanceParams(testRunnerAddress) require.NoError(t, cclient.QueryJSON("custom/bank/balances", param, &coins)) require.True(t, coins.IsZero(), coins) }) diff --git a/e2e/service_test.go b/e2e/service_test.go index efb26cac2..26413a5b7 100644 --- a/e2e/service_test.go +++ b/e2e/service_test.go @@ -4,6 +4,7 @@ import ( "context" "testing" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/mesg-foundation/engine/hash" "github.com/mesg-foundation/engine/ownership" pb "github.com/mesg-foundation/engine/protobuf/api" @@ -11,7 +12,10 @@ import ( "github.com/stretchr/testify/require" ) -var testServiceHash hash.Hash +var ( + testServiceHash hash.Hash + testServiceAddress sdk.AccAddress +) func testService(t *testing.T) { req := newTestCreateServiceRequest() @@ -32,6 +36,7 @@ func testService(t *testing.T) { var s *service.Service lcdGet(t, "service/get/"+testServiceHash.String(), &s) require.Equal(t, testServiceHash, s.Hash) + testServiceAddress = s.Address }) }) diff --git a/execution/execution.go b/execution/execution.go index e51b327c1..64f0c6fe6 100644 --- a/execution/execution.go +++ b/execution/execution.go @@ -1,11 +1,13 @@ package execution import ( + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/mesg-foundation/engine/hash" "github.com/mesg-foundation/engine/protobuf/types" + "github.com/tendermint/tendermint/crypto" ) -// New returns a new execution. It returns an error if inputs are invalid. +// New returns a new execution. func New(processHash, instanceHash, parentHash, eventHash hash.Hash, nodeKey, taskKey, price string, inputs *types.Struct, tags []string, executorHash hash.Hash) *Execution { exec := &Execution{ ProcessHash: processHash, @@ -21,6 +23,7 @@ func New(processHash, instanceHash, parentHash, eventHash hash.Hash, nodeKey, ta ExecutorHash: executorHash, } exec.Hash = hash.Dump(exec) + exec.Address = sdk.AccAddress(crypto.AddressHash(exec.Hash)) return exec } diff --git a/execution/execution.pb.go b/execution/execution.pb.go index 70d2e6258..5447c8f54 100644 --- a/execution/execution.pb.go +++ b/execution/execution.pb.go @@ -6,6 +6,7 @@ package execution import ( bytes "bytes" fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_mesg_foundation_engine_hash "github.com/mesg-foundation/engine/hash" @@ -102,10 +103,12 @@ type Execution struct { // blockHeight where the execution was included into blockchain. BlockHeight int64 `protobuf:"varint,15,opt,name=blockHeight,proto3" json:"blockHeight,omitempty" hash:"-"` // list of emitters of this execution. - Emitters []*Execution_Emitter `protobuf:"bytes,16,rep,name=emitters,proto3" json:"emitters,omitempty" hash:"-"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Emitters []*Execution_Emitter `protobuf:"bytes,16,rep,name=emitters,proto3" json:"emitters,omitempty" hash:"-"` + // The address of the execution. + Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,17,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty" hash:"-" validate:"accaddress"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Execution) Reset() { *m = Execution{} } @@ -176,49 +179,52 @@ func init() { func init() { proto.RegisterFile("execution.proto", fileDescriptor_776e2c5022e94aef) } var fileDescriptor_776e2c5022e94aef = []byte{ - // 664 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xdd, 0x6e, 0xd3, 0x30, - 0x18, 0x5d, 0xd6, 0xae, 0x3f, 0x5f, 0xbb, 0xae, 0x58, 0x42, 0x8a, 0x86, 0x58, 0x23, 0x73, 0x13, - 0xd8, 0x96, 0xb2, 0x8e, 0xf1, 0x33, 0x09, 0x01, 0x85, 0xc1, 0x10, 0x12, 0x4c, 0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0x11, - 0x0b, 0x45, 0xc3, 0xb6, 0x85, 0x5a, 0x00, 0x6f, 0xf9, 0x81, 0x14, 0x91, 0xa4, 0x4a, 0xb5, 0x17, - 0xd1, 0x32, 0xd4, 0x5f, 0x8a, 0x71, 0x3c, 0xa2, 0x9a, 0x86, 0xed, 0x12, 0x02, 0xa8, 0xbc, 0x26, - 0x6c, 0x44, 0xc3, 0x76, 0xb9, 0xbf, 0x73, 0xf6, 0x73, 0x6d, 0xe1, 0xeb, 0xaf, 0x35, 0xeb, 0xd3, - 0x7f, 0x8c, 0x37, 0xfd, 0x8b, 0x18, 0x54, 0xcc, 0xc5, 0xdb, 0xfe, 0x1d, 0x00, 0x00, 0xff, 0xff, - 0xab, 0xd4, 0x7b, 0x2c, 0x36, 0x06, 0x00, 0x00, + // 720 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xdd, 0x6e, 0xd3, 0x48, + 0x18, 0xad, 0x9b, 0x34, 0x3f, 0x5f, 0xd2, 0x34, 0x1d, 0x69, 0x25, 0xab, 0xab, 0xad, 0xad, 0xd9, + 0x9b, 0xec, 0xb6, 0x71, 0xb6, 0xe9, 0x76, 0x7f, 0x2a, 0x21, 0x68, 0xa0, 0x50, 0x84, 0x04, 0x95, + 0x23, 0x6e, 0xb8, 0x73, 0xec, 0xa9, 0x33, 0x4a, 0x32, 0x63, 0xcd, 0x8c, 0x0b, 0x7d, 0x23, 0xc4, + 0x3d, 0xef, 0xd0, 0x67, 0xe0, 0x22, 0x12, 0x3c, 0x42, 0x2e, 0xb9, 0x42, 0x1e, 0xc7, 0xa9, 0x13, + 0x10, 0xa0, 0xaa, 0x57, 0xc9, 0xf8, 0x3b, 0xe7, 0x7c, 0x67, 0xce, 0x78, 0x3e, 0xc3, 0x16, 0x79, + 0x43, 0xfc, 0x58, 0x51, 0xce, 0x9c, 0x48, 0x70, 0xc5, 0x11, 0x4c,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 0x7d, 0x62, 0x36, 0xb4, 0xad, 0xdf, 0x67, + 0x53, 0xcb, 0xca, 0x13, 0xfe, 0xce, 0xa7, 0xe8, 0x73, 0xca, 0x24, 0x76, 0x53, 0x06, 0x72, 0xa0, + 0x36, 0x18, 0x73, 0x7f, 0x74, 0x46, 0x68, 0x38, 0x54, 0xe6, 0x96, 0x6d, 0xb4, 0x0a, 0x2b, 0x27, + 0x95, 0x07, 0xa0, 0x27, 0x50, 0x21, 0x13, 0xaa, 0x14, 0x11, 0xd2, 0x6c, 0xda, 0x85, 0x56, 0xad, + 0xfb, 0x5b, 0xfe, 0x9e, 0x2c, 0xa6, 0x8d, 0x73, 0x9a, 0xa2, 0x56, 0xb4, 0x16, 0x64, 0x34, 0x81, + 0xb2, 0x17, 0x04, 0x82, 0x48, 0x69, 0x6e, 0xeb, 0x64, 0xfa, 0xb3, 0xa9, 0xb5, 0x9b, 0x01, 0x73, + 0x7e, 0x3d, 0xdf, 0x9f, 0x03, 0xf1, 0xe7, 0xa9, 0xd5, 0xce, 0xe5, 0xe6, 0x73, 0x39, 0xe1, 0x72, + 0xfe, 0xd3, 0x96, 0xc1, 0x28, 0x9d, 0x81, 0xce, 0x89, 0xef, 0x9f, 0xa4, 0x0c, 0x37, 0xeb, 0xb1, + 0xf3, 0xce, 0x80, 0xf2, 0xdc, 0x12, 0xe2, 0x00, 0x22, 0x66, 0x8c, 0xa4, 0xe7, 0x92, 0x8e, 0xc3, + 0x17, 0xb7, 0x3b, 0x17, 0xf3, 0x1b, 0x86, 0x93, 0x47, 0xd8, 0xcd, 0xb5, 0x58, 0x0d, 0x79, 0xfd, + 0x07, 0x21, 0xff, 0xf9, 0x1c, 0x4a, 0xe9, 0xc0, 0x41, 0x35, 0x28, 0xbf, 0x64, 0x23, 0xc6, 0x5f, + 0xb3, 0xe6, 0x1a, 0xaa, 0x43, 0xe5, 0x5c, 0xf0, 0x88, 0x4b, 0x12, 0x34, 0x0d, 0xd4, 0x00, 0x78, + 0xca, 0xce, 0x05, 0x0f, 0x93, 0xfd, 0x35, 0xd7, 0xd1, 0x26, 0x54, 0x1f, 0xf2, 0x49, 0x34, 0x26, + 0x8a, 0x04, 0xcd, 0x02, 0x02, 0x28, 0x3d, 0xf6, 0xe8, 0x98, 0x04, 0xcd, 0x62, 0xef, 0xe8, 0xfa, + 0xe3, 0xee, 0xda, 0xdb, 0x4f, 0xbb, 0xc6, 0xab, 0x9f, 0xd8, 0xde, 0xe2, 0x8b, 0x34, 0x28, 0xe9, + 0x7b, 0x7e, 0xf8, 0x25, 0x00, 0x00, 0xff, 0xff, 0x5e, 0x15, 0xca, 0x14, 0xa5, 0x06, 0x00, 0x00, } func (this *Execution) Equal(that interface{}) bool { @@ -298,6 +304,9 @@ func (this *Execution) Equal(that interface{}) bool { return false } } + if !bytes.Equal(this.Address, that1.Address) { + return false + } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } diff --git a/ownership/ownership.pb.go b/ownership/ownership.pb.go index b35c324db..295f8e8f8 100644 --- a/ownership/ownership.pb.go +++ b/ownership/ownership.pb.go @@ -6,6 +6,7 @@ package ownership import ( bytes "bytes" fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_mesg_foundation_engine_hash "github.com/mesg-foundation/engine/hash" @@ -63,10 +64,12 @@ type Ownership struct { // Resource's hash. ResourceHash github_com_mesg_foundation_engine_hash.Hash `protobuf:"bytes,3,opt,name=resourceHash,proto3,customtype=github.com/mesg-foundation/engine/hash.Hash" json:"resourceHash" hash:"name:3"` // Resource's type. - Resource Ownership_Resource `protobuf:"varint,4,opt,name=resource,proto3,enum=mesg.types.Ownership_Resource" json:"resource,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Resource Ownership_Resource `protobuf:"varint,4,opt,name=resource,proto3,enum=mesg.types.Ownership_Resource" json:"resource,omitempty"` + // The address of the resource. + ResourceAddress github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,5,opt,name=resourceAddress,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"resourceAddress,omitempty" hash:"-" validate:"accaddress"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Ownership) Reset() { *m = Ownership{} } @@ -101,28 +104,32 @@ func init() { func init() { proto.RegisterFile("ownership.proto", fileDescriptor_21ae26e0dccf9d04) } var fileDescriptor_21ae26e0dccf9d04 = []byte{ - // 334 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0xcf, 0x4e, 0xc2, 0x30, - 0x18, 0x67, 0x80, 0x08, 0x9f, 0xa8, 0x4b, 0x4f, 0x8b, 0x31, 0x6c, 0x36, 0x31, 0x21, 0x31, 0x74, - 0x09, 0xc4, 0xcb, 0xbc, 0x11, 0x0f, 0x9e, 0xd4, 0x8c, 0x9b, 0xb7, 0x31, 0x3e, 0xb6, 0x26, 0xd2, - 0x62, 0xbb, 0x61, 0x7c, 0x0e, 0x5f, 0xc2, 0x47, 0xe1, 0x19, 0x3c, 0x2c, 0xd1, 0x47, 0xe0, 0x09, - 0xcc, 0x8a, 0xa0, 0x26, 0x1e, 0x8c, 0xb7, 0xfe, 0xbe, 0xfc, 0xfe, 0xf5, 0x6b, 0xe1, 0x50, 0x3e, - 0x0a, 0x54, 0x3a, 0xe5, 0x73, 0x36, 0x57, 0x32, 0x93, 0x04, 0x66, 0xa8, 0x13, 0x96, 0x3d, 0xcd, - 0x51, 0x1f, 0xd1, 0x44, 0x26, 0xd2, 0x37, 0xf3, 0x71, 0x3e, 0xf5, 0x4b, 0x64, 0x80, 0x39, 0xad, - 0xf9, 0xf4, 0xb9, 0x06, 0xad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xf0, 0x7c, 0xf9, 0xd6, - 0xa9, 0xbc, 0xbc, 0x77, 0xac, 0xbb, 0x3f, 0xdc, 0x66, 0xfb, 0x05, 0xc6, 0x0d, 0xf3, 0xa6, 0x83, - 0x8f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfb, 0xb7, 0x4e, 0x6e, 0x16, 0x02, 0x00, 0x00, + // 390 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0xcf, 0x8e, 0x93, 0x40, + 0x1c, 0x2e, 0x2d, 0xad, 0xed, 0x58, 0x2d, 0x99, 0x13, 0x31, 0x06, 0x70, 0x12, 0x93, 0x26, 0x06, + 0x48, 0xda, 0x78, 0xc1, 0x53, 0x1b, 0x0f, 0x9e, 0xd4, 0xd0, 0x9b, 0xb7, 0xe9, 0xf0, 0x2b, 0x10, + 0x65, 0xa6, 0xce, 0x40, 0x8d, 0x07, 0x5f, 0xc2, 0xa7, 0xf0, 0x51, 0xfa, 0x0c, 0x1e, 0x48, 0x76, + 0x1f, 0xa1, 0xc7, 0x3d, 0x6d, 0x80, 0xd2, 0xed, 0x6e, 0x7a, 0xd8, 0xec, 0x89, 0xf9, 0xc8, 0xf7, + 0x6f, 0xbe, 0x0c, 0x9a, 0x88, 0x5f, 0x1c, 0xa4, 0x4a, 0xd2, 0xad, 0xb7, 0x95, 0x22, 0x17, 0x18, + 0x65, 0xa0, 0x62, 0x2f, 0xff, 0xbd, 0x05, 0xf5, 0x8a, 0xc4, 0x22, 0x16, 0x7e, 0xfd, 0x7f, 0x5d, + 0x6c, 0xfc, 0x0a, 0xd5, 0xa0, 0x3e, 0x35, 0x7c, 0xf2, 0x57, 0x47, 0xa3, 0x2f, 0xad, 0x07, 0x8e, + 0x91, 0x9e, 0x50, 0x95, 0x98, 0x9a, 0xa3, 0x4d, 0xc7, 0xcb, 0xd5, 0xbe, 0xb4, 0x3b, 0xff, 0x4b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b, 0x0e, 0x46, 0x07, 0x3f, 0x47, 0xcf, 0x56, 0x20, 0x77, + 0x29, 0x03, 0x43, 0xab, 0xc0, 0x57, 0x29, 0x18, 0x28, 0x65, 0x74, 0x31, 0x42, 0x83, 0xb0, 0xe0, + 0x1c, 0xa4, 0xd1, 0x5b, 0xbe, 0xdf, 0x5f, 0x59, 0x9d, 0x7f, 0xd7, 0x96, 0xf6, 0xed, 0x11, 0x63, + 0x9e, 0x5e, 0xe0, 0x7a, 0x50, 0x3f, 0xa9, 0xf9, 0x6d, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf0, 0x62, + 0x80, 0xe0, 0x95, 0x02, 0x00, 0x00, } func (this *Ownership) Equal(that interface{}) bool { @@ -156,6 +163,9 @@ func (this *Ownership) Equal(that interface{}) bool { if this.Resource != that1.Resource { return false } + if !bytes.Equal(this.ResourceAddress, that1.ResourceAddress) { + return false + } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } diff --git a/process/process.go b/process/process.go index 6120323a0..db7b15b4e 100644 --- a/process/process.go +++ b/process/process.go @@ -3,9 +3,24 @@ package process import ( "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/mesg-foundation/engine/hash" + "github.com/tendermint/tendermint/crypto" validator "gopkg.in/go-playground/validator.v9" ) +// New returns a new process and validate it. +func New(name string, nodes []*Process_Node, edges []*Process_Edge) *Process { + p := &Process{ + Name: name, + Nodes: nodes, + Edges: edges, + } + p.Hash = hash.Dump(p) + p.Address = sdk.AccAddress(crypto.AddressHash(p.Hash)) + return p +} + // Validate returns an error if the process is invalid for whatever reason func (w *Process) Validate() error { if err := validator.New().Struct(w); err != nil { diff --git a/process/process.pb.go b/process/process.pb.go index 383ce24bb..60238201d 100644 --- a/process/process.pb.go +++ b/process/process.pb.go @@ -6,6 +6,7 @@ package process import ( bytes "bytes" fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_mesg_foundation_engine_hash "github.com/mesg-foundation/engine/hash" @@ -82,11 +83,12 @@ type Process struct { // Nodes with information related to the execution to trigger. Nodes []*Process_Node `protobuf:"bytes,4,rep,name=nodes,proto3" json:"nodes,omitempty" hash:"name:4" validate:"dive,required"` // Edges to create the link between the nodes. - Edges []*Process_Edge `protobuf:"bytes,5,rep,name=edges,proto3" json:"edges,omitempty" hash:"name:5" validate:"dive,required"` - Address string `protobuf:"bytes,6,opt,name=address,proto3" json:"address,omitempty" hash:"-"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Edges []*Process_Edge `protobuf:"bytes,5,rep,name=edges,proto3" json:"edges,omitempty" hash:"name:5" validate:"dive,required"` + // The address of the process. + Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,6,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty" hash:"-"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Process) Reset() { *m = Process{} } @@ -816,77 +818,78 @@ func init() { func init() { proto.RegisterFile("process.proto", fileDescriptor_54c4d0e8c0aaf5c3) } var fileDescriptor_54c4d0e8c0aaf5c3 = []byte{ - // 1109 bytes of a gzipped FileDescriptorProto + // 1135 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x97, 0xdd, 0x6e, 0x1b, 0x45, - 0x14, 0xc7, 0xb3, 0xf6, 0xda, 0x8e, 0x4f, 0xdc, 0x28, 0x8c, 0x04, 0xac, 0x96, 0x12, 0x1b, 0x57, - 0x34, 0x09, 0x24, 0x1b, 0x62, 0xa7, 0x2d, 0x0d, 0x17, 0x88, 0x8d, 0x5c, 0x15, 0xea, 0x86, 0xd4, -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, 0xfa, 0x02, 0xc0, 0xa6, 0xc4, 0x71, 0xc5, 0x18, 0x62, 0xf9, 0xc4, 0x53, 0x9a, 0xbc, + 0x72, 0x32, 0xb6, 0x87, 0x1e, 0xe6, 0x8b, 0x62, 0xb8, 0x8d, 0x27, 0x30, 0xc2, 0x2c, 0x7c, 0x97, + 0x80, 0xec, 0xc8, 0x01, 0x99, 0xd1, 0x5c, 0x9e, 0x9f, 0x50, 0x13, 0x8b, 0x6d, 0x35, 0x92, 0x54, + 0x15, 0xfd, 0x31, 0x64, 0x7b, 0x3e, 0x76, 0x5c, 0xdb, 0xe2, 0x4a, 0x81, 0xf9, 0x6a, 0x2d, 0xf6, + 0x96, 0x8d, 0xdd, 0xa1, 0x6b, 0xdc, 0xef, 0x8a, 0xd3, 0xc5, 0xd0, 0xd2, 0x50, 0xf7, 0xe4, 0xc4, + 0xc9, 0x51, 0x2b, 0x87, 0x2a, 0x97, 0x4b, 0x90, 0x1d, 0xad, 0x83, 0xe6, 0x20, 0xb3, 0x47, 0x0e, + 0x09, 0xfd, 0x92, 0x2c, 0xcc, 0xa0, 0x34, 0x24, 0xea, 0xf7, 0x17, 0x34, 0x33, 0x0d, 0xba, 0xd8, + 0x6d, 0xe1, 0x18, 0x74, 0xf1, 0xc9, 0x20, 0x6e, 0xe7, 0xcc, 0xb7, 0x2f, 0x79, 0x3b, 0x67, 0xbe, + 0x2d, 0x1c, 0x9d, 0xd1, 0x2c, 0x8b, 0x19, 0x92, 0xf0, 0x30, 0x6b, 0x8f, 0xff, 0x58, 0x9c, 0xf9, + 0xe1, 0xc9, 0xa2, 0xf6, 0x70, 0xe5, 0xe9, 0x57, 0x93, 0xf0, 0x23, 0xf2, 0x20, 0x2d, 0xbf, 0x0a, + 0x6b, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0xa1, 0xf1, 0x1e, 0xf6, 0x56, 0x0e, 0x00, 0x00, } func (this *Process) Equal(that interface{}) bool { @@ -930,7 +933,7 @@ func (this *Process) Equal(that interface{}) bool { return false } } - if this.Address != that1.Address { + if !bytes.Equal(this.Address, that1.Address) { return false } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { diff --git a/protobuf/api/runner.pb.go b/protobuf/api/runner.pb.go index 93f98ed79..0bc604cd3 100644 --- a/protobuf/api/runner.pb.go +++ b/protobuf/api/runner.pb.go @@ -103,8 +103,8 @@ func (m *ListRunnerRequest) GetFilter() *ListRunnerRequest_Filter { type ListRunnerRequest_Filter struct { // Filter by instance hash. InstanceHash github_com_mesg_foundation_engine_hash.Hash `protobuf:"bytes,1,opt,name=instanceHash,proto3,customtype=github.com/mesg-foundation/engine/hash.Hash" json:"instanceHash" validate:"hash"` - // Filter by address - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty" validate:"accaddress"` + // Filter by owner + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty" validate:"accaddress"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -134,9 +134,9 @@ func (m *ListRunnerRequest_Filter) XXX_DiscardUnknown() { var xxx_messageInfo_ListRunnerRequest_Filter proto.InternalMessageInfo -func (m *ListRunnerRequest_Filter) GetAddress() string { +func (m *ListRunnerRequest_Filter) GetOwner() string { if m != nil { - return m.Address + return m.Owner } return "" } @@ -343,40 +343,40 @@ func init() { func init() { proto.RegisterFile("protobuf/api/runner.proto", fileDescriptor_66b76d1ada2874b2) } var fileDescriptor_66b76d1ada2874b2 = []byte{ - // 524 bytes of a gzipped FileDescriptorProto + // 526 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x54, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x8d, 0x93, 0x92, 0xb6, 0x93, 0x4a, 0xc0, 0xb6, 0xa0, 0xd4, 0x85, 0x24, 0xda, 0x53, 0x24, - 0x82, 0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ac, 0xfa, 0xfe, 0x97, 0x2a, 0xd4, 0x6d, 0x88, 0xbc, 0x86, 0xda, 0x10, 0x35, 0x71, 0x33, 0xcf, + 0x6f, 0x3f, 0x4d, 0xb7, 0xc4, 0x14, 0xb4, 0x42, 0xce, 0x61, 0x27, 0x75, 0x14, 0x39, 0xf9, 0xcb, + 0x6b, 0x71, 0x9f, 0x95, 0x27, 0x6d, 0x1b, 0xb4, 0x42, 0xde, 0x40, 0xdd, 0xae, 0x87, 0x3c, 0xcf, + 0x90, 0x25, 0x1e, 0x73, 0x5b, 0x7f, 0x4a, 0xe7, 0xa9, 0xac, 0xd6, 0x3c, 0x55, 0xc9, 0x66, 0xf2, + 0x54, 0x65, 0xc3, 0xa1, 0x95, 0xc1, 0xee, 0xfb, 0x1a, 0x8b, 0xf9, 0xa8, 0x6e, 0xfe, 0x56, 0xa7, + 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x50, 0x80, 0x3a, 0x6f, 0x15, 0x05, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/protobuf/api/runner.proto b/protobuf/api/runner.proto index e3295d7c8..9a1f533ea 100644 --- a/protobuf/api/runner.proto +++ b/protobuf/api/runner.proto @@ -47,8 +47,8 @@ message ListRunnerRequest { (gogoproto.nullable) = false ]; - // Filter by address - string address = 2 [ + // Filter by owner + string owner = 2 [ (gogoproto.moretags) = 'validate:"accaddress"' ]; } diff --git a/protobuf/types/execution.proto b/protobuf/types/execution.proto index 26707c7f3..ac5352a88 100644 --- a/protobuf/types/execution.proto +++ b/protobuf/types/execution.proto @@ -140,4 +140,10 @@ message Execution { repeated Emitter emitters = 16 [ (gogoproto.moretags) = 'hash:"-"' ]; + + // The address of the execution. + bytes address = 17 [ + (gogoproto.moretags) = 'hash:"-" validate:"accaddress"', + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; } diff --git a/protobuf/types/ownership.proto b/protobuf/types/ownership.proto index 9cfce7ecb..f9039c50a 100644 --- a/protobuf/types/ownership.proto +++ b/protobuf/types/ownership.proto @@ -40,4 +40,10 @@ message Ownership { // Resource's type. Resource resource = 4; + + // The address of the resource. + bytes resourceAddress = 5 [ + (gogoproto.moretags) = 'hash:"-" validate:"accaddress"', + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; } diff --git a/protobuf/types/process.proto b/protobuf/types/process.proto index 0237e2c64..b7a8de1df 100644 --- a/protobuf/types/process.proto +++ b/protobuf/types/process.proto @@ -236,8 +236,10 @@ message Process { repeated Edge edges = 5 [ (gogoproto.moretags) = 'hash:"name:5" validate:"dive,required"' ]; - - string address = 6 [ - (gogoproto.moretags) = 'hash:"-"' + + // The address of the process. + bytes address = 6 [ + (gogoproto.moretags) = 'hash:"-"', + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" ]; } diff --git a/protobuf/types/runner.proto b/protobuf/types/runner.proto index a97561e3a..4e83bf559 100644 --- a/protobuf/types/runner.proto +++ b/protobuf/types/runner.proto @@ -17,8 +17,8 @@ message Runner { (gogoproto.nullable) = false ]; - // address of the engine of this runner - string address = 2 [ + // owner of the engine of this runner + string owner = 2 [ (gogoproto.moretags) = 'hash:"name:2"' ]; @@ -28,4 +28,10 @@ message Runner { (gogoproto.customtype) = "github.com/mesg-foundation/engine/hash.Hash", (gogoproto.nullable) = false ]; + + // The address of the runner. + bytes address = 4 [ + (gogoproto.moretags) = 'hash:"-" validate:"accaddress"', + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; } diff --git a/protobuf/types/service.proto b/protobuf/types/service.proto index 92e4959b1..a11495520 100644 --- a/protobuf/types/service.proto +++ b/protobuf/types/service.proto @@ -229,4 +229,10 @@ message Service { string source = 13 [ (gogoproto.moretags) = 'hash:"name:13" validate:"required,printascii"' ]; + + // The address of the service. + bytes address = 14 [ + (gogoproto.moretags) = 'hash:"-" validate:"accaddress"', + (gogoproto.casttype) = "github.com/cosmos/cosmos-sdk/types.AccAddress" + ]; } diff --git a/runner/builder/builder.go b/runner/builder/builder.go index b5022f147..ffa62479e 100644 --- a/runner/builder/builder.go +++ b/runner/builder/builder.go @@ -54,10 +54,8 @@ func (b *Builder) Create(req *api.CreateRunnerRequest) (*runnerpb.Runner, error) if err != nil { return nil, err } - expRunnerHash := hash.Dump(&runnerpb.Runner{ - Address: acc.GetAddress().String(), - InstanceHash: instanceHash, - }) + expRunner := runnerpb.New(acc.GetAddress().String(), instanceHash) + expRunnerHash := expRunner.Hash if runExisting, _ := b.mc.GetRunner(expRunnerHash); runExisting != nil { return nil, fmt.Errorf("runner %q already exists", runExisting.Hash) diff --git a/runner/runner.go b/runner/runner.go new file mode 100644 index 000000000..9a1483b71 --- /dev/null +++ b/runner/runner.go @@ -0,0 +1,18 @@ +package runner + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/mesg-foundation/engine/hash" + "github.com/tendermint/tendermint/crypto" +) + +// New returns a new execution. +func New(owner string, instanceHash hash.Hash) *Runner { + run := &Runner{ + Owner: owner, + InstanceHash: instanceHash, + } + run.Hash = hash.Dump(run) + run.Address = sdk.AccAddress(crypto.AddressHash(run.Hash)) + return run +} diff --git a/runner/runner.pb.go b/runner/runner.pb.go index a81085103..09517fc9d 100644 --- a/runner/runner.pb.go +++ b/runner/runner.pb.go @@ -6,6 +6,7 @@ package runner import ( bytes "bytes" fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_mesg_foundation_engine_hash "github.com/mesg-foundation/engine/hash" @@ -27,13 +28,15 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type Runner struct { // Runner's hash Hash github_com_mesg_foundation_engine_hash.Hash `protobuf:"bytes,1,opt,name=hash,proto3,customtype=github.com/mesg-foundation/engine/hash.Hash" json:"hash" hash:"-"` - // address of the engine of this runner - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty" hash:"name:2"` + // owner of the engine of this runner + Owner string `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty" hash:"name:2"` // instanceHash is hash of the instance that runner will handle - InstanceHash github_com_mesg_foundation_engine_hash.Hash `protobuf:"bytes,3,opt,name=instanceHash,proto3,customtype=github.com/mesg-foundation/engine/hash.Hash" json:"instanceHash" hash:"name:3"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + InstanceHash github_com_mesg_foundation_engine_hash.Hash `protobuf:"bytes,3,opt,name=instanceHash,proto3,customtype=github.com/mesg-foundation/engine/hash.Hash" json:"instanceHash" hash:"name:3"` + // The address of the runner. + Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,4,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty" hash:"-" validate:"accaddress"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Runner) Reset() { *m = Runner{} } @@ -67,22 +70,26 @@ func init() { func init() { proto.RegisterFile("runner.proto", fileDescriptor_48eceea7e2abc593) } var fileDescriptor_48eceea7e2abc593 = []byte{ - // 243 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x29, 0x2a, 0xcd, 0xcb, - 0x4b, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xca, 0x4d, 0x2d, 0x4e, 0xd7, 0x2b, - 0xa9, 0x2c, 0x48, 0x2d, 0x96, 0x52, 0x4a, 0xcf, 0x4f, 0xcf, 0xd7, 0x07, 0x8b, 0x27, 0x95, 0xa6, - 0xe9, 0x83, 0x78, 0x60, 0x0e, 0x98, 0x05, 0x51, 0xaf, 0xf4, 0x85, 0x91, 0x8b, 0x2d, 0x08, 0x6c, - 0x80, 0x50, 0x30, 0x17, 0x4b, 0x46, 0x62, 0x71, 0x86, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x8f, 0x93, - 0xfd, 0x89, 0x7b, 0xf2, 0x0c, 0xb7, 0xee, 0xc9, 0x6b, 0xa7, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, - 0x25, 0xe7, 0xe7, 0xea, 0x83, 0xcc, 0xd6, 0x4d, 0xcb, 0x2f, 0xcd, 0x4b, 0x49, 0x2c, 0xc9, 0xcc, - 0xcf, 0xd3, 0x4f, 0xcd, 0x4b, 0xcf, 0xcc, 0x4b, 0xd5, 0x07, 0xe9, 0xd2, 0xf3, 0x48, 0x2c, 0xce, - 0xf8, 0x74, 0x4f, 0x9e, 0x03, 0xc4, 0xb1, 0x52, 0xd2, 0x55, 0x0a, 0x02, 0x1b, 0x26, 0xa4, 0xcd, - 0xc5, 0x9e, 0x98, 0x92, 0x52, 0x94, 0x5a, 0x5c, 0x2c, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0xe9, 0x24, - 0xf8, 0xe9, 0x9e, 0x3c, 0x2f, 0x44, 0x51, 0x5e, 0x62, 0x6e, 0xaa, 0x95, 0x91, 0x52, 0x10, 0x4c, - 0x85, 0x50, 0x06, 0x17, 0x4f, 0x66, 0x5e, 0x71, 0x49, 0x62, 0x5e, 0x72, 0x2a, 0xc8, 0x38, 0x09, - 0x66, 0xb0, 0x4b, 0x5c, 0xc8, 0x73, 0x09, 0xb2, 0x25, 0xc6, 0x4a, 0x41, 0x28, 0x26, 0x3b, 0x19, - 0x9d, 0x78, 0x28, 0xc7, 0xb0, 0xe2, 0x91, 0x1c, 0x63, 0x94, 0x06, 0x61, 0x53, 0x21, 0x01, 0x9c, - 0xc4, 0x06, 0x0e, 0x31, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x39, 0x31, 0x5a, 0x71, + // 307 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x91, 0xb1, 0x4e, 0xf3, 0x30, + 0x14, 0x85, 0x9b, 0xfe, 0xfd, 0x0b, 0x58, 0x61, 0x20, 0x53, 0xc4, 0x10, 0x47, 0x5e, 0x88, 0x84, + 0x12, 0x4b, 0xed, 0x96, 0x05, 0x35, 0x62, 0x60, 0x4e, 0x37, 0x36, 0xc7, 0x71, 0x93, 0x08, 0x62, + 0x57, 0xb1, 0x03, 0xe2, 0x8d, 0x78, 0x94, 0x3e, 0x03, 0x83, 0x11, 0x3c, 0x42, 0x46, 0x26, 0x14, + 0xbb, 0x95, 0xca, 0x84, 0xc4, 0x64, 0x5f, 0xfb, 0xdc, 0xef, 0x1c, 0xfb, 0x02, 0xb7, 0xeb, 0x39, + 0x67, 0x5d, 0xb2, 0xed, 0x84, 0x12, 0x1e, 0x68, 0x99, 0xac, 0x12, 0xf5, 0xb2, 0x65, 0xf2, 0x12, + 0x55, 0xa2, 0x12, 0xd8, 0x9c, 0x17, 0xfd, 0x06, 0x8f, 0x95, 0x29, 0xcc, 0xce, 0xea, 0xd1, 0xfb, + 0x14, 0xcc, 0x73, 0x03, 0xf0, 0xd6, 0x60, 0x56, 0x13, 0x59, 0xfb, 0x4e, 0xe8, 0x44, 0x6e, 0x76, + 0xb3, 0xd3, 0x70, 0xf2, 0xa6, 0xe1, 0x75, 0xd5, 0xa8, 0xba, 0x2f, 0x12, 0x2a, 0x5a, 0x3c, 0xb2, + 0xe3, 0x8d, 0xe8, 0x79, 0x49, 0x54, 0x23, 0x38, 0x66, 0xbc, 0x6a, 0x38, 0xc3, 0x63, 0x57, 0x72, + 0x47, 0x64, 0x3d, 0x68, 0x78, 0x3a, 0x16, 0x29, 0x8a, 0x51, 0x6e, 0x60, 0xde, 0x15, 0xf8, 0x2f, + 0x9e, 0x39, 0xeb, 0xfc, 0x69, 0xe8, 0x44, 0x67, 0xd9, 0xc5, 0xa0, 0xe1, 0xb9, 0x95, 0x70, 0xd2, + 0xb2, 0x74, 0x81, 0x72, 0x7b, 0xef, 0xd5, 0xc0, 0x6d, 0xb8, 0x54, 0x84, 0x53, 0x36, 0xa2, 0xfc, + 0x7f, 0x26, 0xc5, 0xed, 0xdf, 0x52, 0x1c, 0x5b, 0x2c, 0x51, 0xfe, 0x83, 0xec, 0xb5, 0xe0, 0x84, + 0x94, 0x65, 0xc7, 0xa4, 0xf4, 0x67, 0xc6, 0x64, 0x3d, 0x68, 0x18, 0x1c, 0x72, 0x87, 0x4f, 0xe4, + 0xb1, 0x29, 0x89, 0x62, 0x29, 0x22, 0x94, 0xee, 0x85, 0xe8, 0x4b, 0xc3, 0xf8, 0x28, 0x02, 0x15, + 0xb2, 0x15, 0x72, 0xbf, 0xc4, 0xb2, 0x7c, 0xc0, 0xe6, 0xc7, 0x93, 0x15, 0xa5, 0x2b, 0xdb, 0x91, + 0x1f, 0x3c, 0xb2, 0xc5, 0xee, 0x23, 0x98, 0xbc, 0x7e, 0x06, 0xce, 0x7d, 0xf4, 0xfb, 0x23, 0xec, + 0x2c, 0x8b, 0xb9, 0x19, 0xce, 0xf2, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x91, 0x27, 0xd4, 0xaf, 0xdc, 0x01, 0x00, 0x00, } @@ -108,12 +115,15 @@ func (this *Runner) Equal(that interface{}) bool { if !this.Hash.Equal(that1.Hash) { return false } - if this.Address != that1.Address { + if this.Owner != that1.Owner { return false } if !this.InstanceHash.Equal(that1.InstanceHash) { return false } + if !bytes.Equal(this.Address, that1.Address) { + return false + } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } diff --git a/server/grpc/api/runner.go b/server/grpc/api/runner.go index ebd48f545..e7a1325da 100644 --- a/server/grpc/api/runner.go +++ b/server/grpc/api/runner.go @@ -50,7 +50,7 @@ func (s *RunnerServer) List(ctx context.Context, req *api.ListRunnerRequest) (*a var f *cosmos.FilterRunner if req.Filter != nil { f = &cosmos.FilterRunner{ - Address: req.Filter.Address, + Owner: req.Filter.Owner, InstanceHash: req.Filter.InstanceHash, } } diff --git a/service/service.pb.go b/service/service.pb.go index 7436853bf..679d5ab49 100644 --- a/service/service.pb.go +++ b/service/service.pb.go @@ -6,6 +6,7 @@ package service import ( bytes "bytes" fmt "fmt" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/gogo/protobuf/gogoproto" proto "github.com/gogo/protobuf/proto" github_com_mesg_foundation_engine_hash "github.com/mesg-foundation/engine/hash" @@ -44,10 +45,12 @@ type Service struct { // Service's repository url. Repository string `protobuf:"bytes,9,opt,name=repository,proto3" json:"repository,omitempty" hash:"name:9" validate:"omitempty,uri"` // The hash id of service's source code on IPFS. - Source string `protobuf:"bytes,13,opt,name=source,proto3" json:"source,omitempty" hash:"name:13" validate:"required,printascii"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + Source string `protobuf:"bytes,13,opt,name=source,proto3" json:"source,omitempty" hash:"name:13" validate:"required,printascii"` + // The address of the service. + Address github_com_cosmos_cosmos_sdk_types.AccAddress `protobuf:"bytes,14,opt,name=address,proto3,casttype=github.com/cosmos/cosmos-sdk/types.AccAddress" json:"address,omitempty" hash:"-" validate:"accaddress"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Service) Reset() { *m = Service{} } @@ -301,67 +304,70 @@ func init() { func init() { proto.RegisterFile("service.proto", fileDescriptor_a0b84a42fa06f626) } var fileDescriptor_a0b84a42fa06f626 = []byte{ - // 945 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x97, 0xdf, 0x72, 0xdb, 0x44, - 0x14, 0xc6, 0xeb, 0x48, 0xb6, 0xe3, 0x93, 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 0x00, 0x00, 0xff, 0xff, 0x41, 0xba, 0xa3, 0x55, 0xd3, 0x0c, 0x00, - 0x00, + // 995 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x97, 0x4d, 0x73, 0xdb, 0x44, + 0x18, 0xc7, 0xeb, 0x48, 0xb6, 0x93, 0x4d, 0xc2, 0x0c, 0x7b, 0xda, 0x7a, 0x20, 0x52, 0xc5, 0x0c, + 0xb8, 0xe0, 0x97, 0x26, 0x6e, 0x43, 0x93, 0x4e, 0x80, 0x98, 0xd2, 0xa1, 0xcc, 0xf0, 0xa6, 0xc0, + 0x30, 0xd3, 0x99, 0x1e, 0xd6, 0xd2, 0x46, 0x59, 0x1c, 0xed, 0xaa, 0xbb, 0x2b, 0x0f, 0xbe, 0xf3, + 0x05, 0xf8, 0x16, 0xf0, 0x11, 0xb8, 0xc2, 0xa5, 0x9f, 0x81, 0x83, 0x66, 0xe0, 0x23, 0xe8, 0xc8, + 0x89, 0xd1, 0xca, 0x4e, 0xe4, 0x58, 0x76, 0x5e, 0xca, 0x05, 0x4e, 0xb5, 0x3a, 0xcf, 0xff, 0xf7, + 0x97, 0x9e, 0xe7, 0xff, 0x68, 0x23, 0xb0, 0x29, 0x89, 0x18, 0x51, 0x8f, 0x74, 0x22, 0xc1, 0x15, + 0x87, 0x20, 0x24, 0x32, 0xe8, 0xa8, 0x71, 0x44, 0x64, 0xc3, 0x09, 0x78, 0xc0, 0xbb, 0xfa, 0xff, + 0x07, 0xf1, 0x71, 0x37, 0xbb, 0xd2, 0x17, 0xfa, 0x57, 0x5e, 0xef, 0xfc, 0x7e, 0x1b, 0xd4, 0x8f, + 0x72, 0x02, 0x0c, 0x80, 0x79, 0x82, 0xe5, 0x09, 0x02, 0x76, 0xa5, 0xb9, 0xd1, 0x3f, 0x7a, 0x99, + 0x58, 0xb7, 0xfe, 0x48, 0xac, 0xf7, 0x02, 0xaa,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 0x0f, 0xbb, 0x79, 0xfb, 0x0e, 0x3d, 0xef, 0x30, 0x57, 0xb8, 0x53, 0x8f, + 0xc6, 0x2f, 0x2b, 0xa0, 0xaa, 0x67, 0x06, 0xf7, 0x80, 0x31, 0x24, 0x63, 0x64, 0x96, 0x26, 0xfe, + 0xfe, 0xa2, 0xc4, 0x67, 0x1a, 0xf8, 0x68, 0x66, 0xf5, 0x2e, 0x6a, 0xb7, 0x17, 0x69, 0xff, 0xf5, + 0x8d, 0x7b, 0x0e, 0x4c, 0x1f, 0x2b, 0x8c, 0x0c, 0x1d, 0x9d, 0x37, 0xcb, 0xa2, 0xf3, 0x15, 0x16, + 0x38, 0x24, 0x8a, 0x88, 0xb9, 0x59, 0xf7, 0x96, 0x24, 0x47, 0x63, 0x1b, 0x3f, 0x19, 0xc0, 0xcc, + 0x96, 0x67, 0xda, 0xaa, 0xd5, 0xd2, 0x5b, 0x7d, 0xf8, 0x9f, 0x68, 0x15, 0x06, 0x35, 0xca, 0xa2, + 0xf8, 0x6c, 0x99, 0xaf, 0xd9, 0xac, 0xa5, 0x0b, 0x9d, 0x83, 0xa1, 0x07, 0xea, 0x3c, 0x56, 0xda, + 0xa3, 0x7e, 0x13, 0x8f, 0x65, 0xab, 0x3c, 0x25, 0x37, 0x7e, 0x34, 0xc1, 0xda, 0x19, 0xe2, 0xff, + 0x30, 0x98, 0x21, 0x30, 0xb3, 0x06, 0x21, 0x43, 0x33, 0xbe, 0x4b, 0x13, 0xeb, 0x68, 0x51, 0x48, + 0xcb, 0x4e, 0x46, 0xce, 0x08, 0x3f, 0x3e, 0x38, 0x52, 0x82, 0xb2, 0xc0, 0xfe, 0x22, 0x0e, 0x07, + 0x44, 0xd8, 0x7d, 0xce, 0x4f, 0x09, 0x66, 0xf6, 0x97, 0x83, 0xef, 0x89, 0xa7, 0xec, 0x43, 0x36, + 0x76, 0x5c, 0x6d, 0x02, 0xdb, 0x60, 0x95, 0x6b, 0x5b, 0x7c, 0xaa, 0x17, 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 0x36, 0x7e, 0x35, 0x01, 0x38, 0x3f, 0xda, 0x5f, 0x65, 0x99, 0x0f, 0x40, 0x95, + 0x86, 0x38, 0xb8, 0xf6, 0x36, 0xe7, 0xaa, 0x62, 0x76, 0x5e, 0x61, 0xd0, 0x8b, 0xb2, 0x63, 0x94, + 0x22, 0x7b, 0x37, 0xcf, 0x8e, 0x59, 0x9a, 0x9d, 0xfb, 0xd7, 0xcd, 0xce, 0x15, 0xe6, 0x76, 0xd3, + 0xec, 0x3c, 0xb8, 0x6a, 0x76, 0xd6, 0x4a, 0xef, 0x61, 0xef, 0xd2, 0xec, 0xf4, 0x7b, 0x2f, 0xff, + 0xdc, 0xba, 0xf5, 0xf3, 0x5f, 0x5b, 0x95, 0x67, 0x77, 0x2f, 0xff, 0x5a, 0x99, 0x7c, 0x30, 0x0d, + 0x6a, 0xfa, 0x0b, 0xa8, 0xf7, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdb, 0x41, 0x89, 0x13, 0x42, + 0x0d, 0x00, 0x00, } func (this *Service) Equal(that interface{}) bool { @@ -428,6 +434,9 @@ func (this *Service) Equal(that interface{}) bool { if this.Source != that1.Source { return false } + if !bytes.Equal(this.Address, that1.Address) { + return false + } if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) { return false } diff --git a/x/execution/internal/keeper/keeper.go b/x/execution/internal/keeper/keeper.go index ae2b94c43..319c2c24a 100644 --- a/x/execution/internal/keeper/keeper.go +++ b/x/execution/internal/keeper/keeper.go @@ -18,7 +18,6 @@ import ( typespb "github.com/mesg-foundation/engine/protobuf/types" "github.com/mesg-foundation/engine/runner" "github.com/mesg-foundation/engine/x/execution/internal/types" - "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/libs/log" ) @@ -66,6 +65,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { // TODO: we should split the message and keeper function of execution create from user and for process. //nolint:gocyclo func (k *Keeper) Create(ctx sdk.Context, msg types.MsgCreateExecution) (*executionpb.Execution, error) { + // TODO: all the following verification should be moved to a runner.Validate function price, err := sdk.ParseCoins(msg.Request.Price) if err != nil { return nil, err @@ -102,7 +102,7 @@ func (k *Keeper) Create(ctx sdk.Context, msg types.MsgCreateExecution) (*executi } } - if proc == nil && run.Address != msg.Signer.String() { + if proc == nil && run.Owner != msg.Signer.String() { return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "signer is not the execution's executor") } @@ -162,7 +162,7 @@ func (k *Keeper) Create(ctx sdk.Context, msg types.MsgCreateExecution) (*executi if err != nil { return nil, err } - if runEmitter.Address == msg.Signer.String() { + if runEmitter.Owner == msg.Signer.String() { emitterIsPresent = true emitter.BlockHeight = ctx.BlockHeight() break @@ -198,11 +198,10 @@ func (k *Keeper) Create(ctx sdk.Context, msg types.MsgCreateExecution) (*executi // transfer the coin either from the process or from the signer from := msg.Signer - if !msg.Request.ProcessHash.IsZero() { - from = sdk.AccAddress(crypto.AddressHash(msg.Request.ProcessHash)) + if proc != nil { + from = proc.Address } - execAddress := sdk.AccAddress(crypto.AddressHash(exec.Hash)) - if err := k.bankKeeper.SendCoins(ctx, from, execAddress, price); err != nil { + if err := k.bankKeeper.SendCoins(ctx, from, exec.Address, price); err != nil { return nil, err } } @@ -232,7 +231,7 @@ func (k *Keeper) Update(ctx sdk.Context, msg types.MsgUpdateExecution) (*executi if err != nil { return nil, err } - if runExecutor.Address != msg.Executor.String() { + if runExecutor.Owner != msg.Executor.String() { return nil, sdkerrors.Wrap(sdkerrors.ErrUnauthorized, "signer is not the execution's executor") } @@ -266,8 +265,12 @@ func (k *Keeper) Update(ctx sdk.Context, msg types.MsgUpdateExecution) (*executi if err != nil { return nil, err } + srv, err := k.serviceKeeper.Get(ctx, inst.ServiceHash) + if err != nil { + return nil, err + } - if err := k.distributePriceShares(ctx, exec.Hash, exec.Emitters, exec.ExecutorHash, inst.ServiceHash, exec.Price); err != nil { + if err := k.distributePriceShares(ctx, exec.Address, runExecutor.Address, srv.Address, exec.Emitters, exec.Price); err != nil { return nil, err } @@ -304,7 +307,7 @@ func (k *Keeper) List(ctx sdk.Context) ([]*executionpb.Execution, error) { return execs, nil } -func (k *Keeper) distributePriceShares(ctx sdk.Context, execHash hash.Hash, emitters []*executionpb.Execution_Emitter, runnerHash, serviceHash hash.Hash, price string) error { +func (k *Keeper) distributePriceShares(ctx sdk.Context, execAddress, runnerAddress, serviceAddress sdk.AccAddress, emitters []*executionpb.Execution_Emitter, price string) error { coins, err := sdk.ParseCoins(price) if err != nil { return fmt.Errorf("cannot parse coins: %w", err) @@ -313,11 +316,6 @@ func (k *Keeper) distributePriceShares(ctx sdk.Context, execHash hash.Hash, emit return nil } - // addresses - execAddress := sdk.AccAddress(crypto.AddressHash(execHash)) - runnerAddress := sdk.AccAddress(crypto.AddressHash(runnerHash)) - serviceAddress := sdk.AccAddress(crypto.AddressHash(serviceHash)) - // inputs inputs := []bank.Input{bank.NewInput(execAddress, coins)} @@ -335,7 +333,10 @@ func (k *Keeper) distributePriceShares(ctx sdk.Context, execHash hash.Hash, emit distributedEmittersCoins := sdk.NewCoins() for i, emitter := range emitters { - emitterAddress := sdk.AccAddress(crypto.AddressHash(emitter.RunnerHash)) + runEmitter, err := k.runnerKeeper.Get(ctx, emitter.RunnerHash) + if err != nil { + return err + } if err != nil { return err } @@ -349,7 +350,7 @@ func (k *Keeper) distributePriceShares(ctx sdk.Context, execHash hash.Hash, emit emitterCoins = emitterCoins.Add(emittersCoins.Sub(distributedEmittersCoins)...) } - outputs = append(outputs, bank.NewOutput(emitterAddress, emitterCoins)) + outputs = append(outputs, bank.NewOutput(runEmitter.Address, emitterCoins)) } if err := k.bankKeeper.InputOutputCoins(ctx, inputs, outputs); err != nil { diff --git a/x/ownership/internal/keeper/keeper.go b/x/ownership/internal/keeper/keeper.go index 53e3c7c29..843b9003c 100644 --- a/x/ownership/internal/keeper/keeper.go +++ b/x/ownership/internal/keeper/keeper.go @@ -5,11 +5,9 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/mesg-foundation/engine/hash" "github.com/mesg-foundation/engine/ownership" "github.com/mesg-foundation/engine/x/ownership/internal/types" - "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/libs/log" ) @@ -56,73 +54,76 @@ func (k *Keeper) List(ctx sdk.Context) ([]*ownership.Ownership, error) { } // Set creates a new ownership. -func (k Keeper) Set(ctx sdk.Context, owner sdk.AccAddress, resourceHash hash.Hash, resource ownership.Ownership_Resource) (*ownership.Ownership, error) { +func (k Keeper) Set(ctx sdk.Context, owner sdk.AccAddress, resourceHash hash.Hash, resource ownership.Ownership_Resource, resourceAddress sdk.AccAddress) (*ownership.Ownership, error) { store := ctx.KVStore(k.storeKey) - hashes := k.findOwnerships(store, "", resourceHash) - if len(hashes) > 0 { + own := k.getOwnership(store, resourceHash) + if own != nil { return nil, fmt.Errorf("resource %s:%q already has an owner", resource, resourceHash) } - ownership := &ownership.Ownership{ - Owner: owner.String(), - Resource: resource, - ResourceHash: resourceHash, + // TODO: should be moved to a new function + own = &ownership.Ownership{ + Owner: owner.String(), + Resource: resource, + ResourceHash: resourceHash, + ResourceAddress: resourceAddress, } - ownership.Hash = hash.Dump(ownership) + own.Hash = hash.Dump(own) - store.Set(ownership.Hash, k.cdc.MustMarshalBinaryLengthPrefixed(ownership)) - return ownership, nil + store.Set(own.Hash, k.cdc.MustMarshalBinaryLengthPrefixed(own)) + return own, nil } // Delete deletes an ownership. func (k Keeper) Delete(ctx sdk.Context, owner sdk.AccAddress, resourceHash hash.Hash) error { store := ctx.KVStore(k.storeKey) - hashes := k.findOwnerships(store, owner.String(), resourceHash) - if len(hashes) == 0 { - return fmt.Errorf("resource %q do not have any ownership", resourceHash) + own := k.getOwnership(store, resourceHash) + if own == nil { + return fmt.Errorf("resource %q does not have any ownership", resourceHash) + } + if own.Owner != owner.String() { + return fmt.Errorf("resource %q is not owned by you", resourceHash) } // transfer all spendable coins from resource address to owner - addr := sdk.AccAddress(crypto.AddressHash(resourceHash)) - coins := k.bankKeeper.GetCoins(ctx, addr) + coins := k.bankKeeper.GetCoins(ctx, own.ResourceAddress) if !coins.IsZero() { - if err := k.bankKeeper.SendCoins(ctx, addr, owner, coins); err != nil { + if err := k.bankKeeper.SendCoins(ctx, own.ResourceAddress, owner, coins); err != nil { return err } } - // remove all ownerships - for _, hash := range hashes { - store.Delete(hash) - } + // remove ownership + store.Delete(own.Hash) return nil } // WithdrawCoins try to withdraw coins to owner rom specific resource. func (k Keeper) WithdrawCoins(ctx sdk.Context, msg types.MsgWithdrawCoins) error { - if len(k.findOwnerships(ctx.KVStore(k.storeKey), msg.Owner.String(), msg.Hash)) == 0 { - return sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "address %s is not owner of resource %s", msg.Owner, msg.Hash) + store := ctx.KVStore(k.storeKey) + own := k.getOwnership(store, msg.Hash) + if own == nil { + return fmt.Errorf("resource %q does not have any ownership", msg.Hash) + } + if own.Owner != msg.Owner.String() { + return fmt.Errorf("resource %q is not owned by you", msg.Hash) } - addr := sdk.AccAddress(crypto.AddressHash(msg.Hash)) - return k.bankKeeper.SendCoins(ctx, addr, msg.Owner, msg.Amount) + return k.bankKeeper.SendCoins(ctx, own.ResourceAddress, msg.Owner, msg.Amount) } -// hasOwner checks if given resource has owner. Returns all ownership hash and true if has one -// nil and false otherwise. -func (k Keeper) findOwnerships(store sdk.KVStore, owner string, resourceHash hash.Hash) []hash.Hash { - var ownerships []hash.Hash +// getOwnership returns the ownership of a given resource. +func (k Keeper) getOwnership(store sdk.KVStore, resourceHash hash.Hash) *ownership.Ownership { iter := store.Iterator(nil, nil) - + var own *ownership.Ownership for iter.Valid() { - var o *ownership.Ownership - if err := k.cdc.UnmarshalBinaryLengthPrefixed(iter.Value(), &o); err == nil { - if (owner == "" || o.Owner == owner) && o.ResourceHash.Equal(resourceHash) { - ownerships = append(ownerships, o.Hash) + if err := k.cdc.UnmarshalBinaryLengthPrefixed(iter.Value(), &own); err == nil { + if own.ResourceHash.Equal(resourceHash) { + iter.Close() + return own } } iter.Next() } - iter.Close() - return ownerships + return nil } diff --git a/x/process/internal/keeper/keeper.go b/x/process/internal/keeper/keeper.go index aa393eb06..885ca55ec 100644 --- a/x/process/internal/keeper/keeper.go +++ b/x/process/internal/keeper/keeper.go @@ -10,7 +10,6 @@ import ( "github.com/mesg-foundation/engine/process" processpb "github.com/mesg-foundation/engine/process" "github.com/mesg-foundation/engine/x/process/internal/types" - "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/libs/log" ) @@ -45,13 +44,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { // Create creates a new process. func (k Keeper) Create(ctx sdk.Context, msg *types.MsgCreateProcess) (*processpb.Process, error) { store := ctx.KVStore(k.storeKey) - p := &process.Process{ - Name: msg.Request.Name, - Nodes: msg.Request.Nodes, - Edges: msg.Request.Edges, - } - p.Hash = hash.Dump(p) - p.Address = sdk.AccAddress(crypto.AddressHash(p.Hash)).String() + p := process.New(msg.Request.Name, msg.Request.Nodes, msg.Request.Edges) if store.Has(p.Hash) { return nil, fmt.Errorf("process %q already exists", p.Hash) } @@ -73,12 +66,11 @@ func (k Keeper) Create(ctx sdk.Context, msg *types.MsgCreateProcess) (*processpb } } - procAddress := sdk.AccAddress(crypto.AddressHash(p.Hash)) procInitBal, err := sdk.ParseCoins(processCreateInitialBalance) if err != nil { return nil, err } - if err := k.bankKeeper.SendCoins(ctx, msg.Owner, procAddress, procInitBal); err != nil { + if err := k.bankKeeper.SendCoins(ctx, msg.Owner, p.Address, procInitBal); err != nil { return nil, err } @@ -87,7 +79,7 @@ func (k Keeper) Create(ctx sdk.Context, msg *types.MsgCreateProcess) (*processpb return nil, err } - if _, err := k.ownershipKeeper.Set(ctx, msg.Owner, p.Hash, ownershippb.Ownership_Process); err != nil { + if _, err := k.ownershipKeeper.Set(ctx, msg.Owner, p.Hash, ownershippb.Ownership_Process, p.Address); err != nil { return nil, err } diff --git a/x/process/internal/types/expected_keepers.go b/x/process/internal/types/expected_keepers.go index 88ae91310..cd3235b82 100644 --- a/x/process/internal/types/expected_keepers.go +++ b/x/process/internal/types/expected_keepers.go @@ -24,7 +24,7 @@ type InstanceKeeper interface { // OwnershipKeeper module interface. type OwnershipKeeper interface { Delete(ctx sdk.Context, owner sdk.AccAddress, resourceHash hash.Hash) error - Set(ctx sdk.Context, owner sdk.AccAddress, resourceHash hash.Hash, resource ownershippb.Ownership_Resource) (*ownershippb.Ownership, error) + Set(ctx sdk.Context, owner sdk.AccAddress, resourceHash hash.Hash, resource ownershippb.Ownership_Resource, resourceAddress sdk.AccAddress) (*ownershippb.Ownership, error) } // BankKeeper module interface. diff --git a/x/process/internal/types/msg.go b/x/process/internal/types/msg.go index 13ec6859f..9056cdd9a 100644 --- a/x/process/internal/types/msg.go +++ b/x/process/internal/types/msg.go @@ -4,7 +4,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/mesg-foundation/engine/ext/xvalidator" - "github.com/mesg-foundation/engine/hash" processpb "github.com/mesg-foundation/engine/process" "github.com/mesg-foundation/engine/protobuf/api" ) @@ -41,12 +40,7 @@ func (msg MsgCreateProcess) ValidateBasic() error { if err := xvalidator.Validate.Struct(msg); err != nil { return err } - p := &processpb.Process{ - Name: msg.Request.Name, - Nodes: msg.Request.Nodes, - Edges: msg.Request.Edges, - } - p.Hash = hash.Dump(p) + p := processpb.New(msg.Request.Name, msg.Request.Nodes, msg.Request.Edges) if err := p.Validate(); err != nil { return err } diff --git a/x/runner/internal/keeper/keeper.go b/x/runner/internal/keeper/keeper.go index 4d0187b4c..0b70302ee 100644 --- a/x/runner/internal/keeper/keeper.go +++ b/x/runner/internal/keeper/keeper.go @@ -46,11 +46,7 @@ func (k Keeper) Create(ctx sdk.Context, msg *types.MsgCreateRunner) (*runner.Run return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) } - r := &runner.Runner{ - Address: msg.Address.String(), - InstanceHash: inst.Hash, - } - r.Hash = hash.Dump(r) + r := runner.New(msg.Address.String(), inst.Hash) if store.Has(r.Hash) { return nil, sdkerrors.Wrapf(sdkerrors.ErrInvalidRequest, "runner %q already exists", r.Hash) } @@ -60,7 +56,7 @@ func (k Keeper) Create(ctx sdk.Context, msg *types.MsgCreateRunner) (*runner.Run return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) } - if _, err := k.ownershipKeeper.Set(ctx, msg.Address, r.Hash, ownershippb.Ownership_Runner); err != nil { + if _, err := k.ownershipKeeper.Set(ctx, msg.Address, r.Hash, ownershippb.Ownership_Runner, r.Address); err != nil { return nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, err.Error()) } @@ -80,7 +76,7 @@ func (k Keeper) Delete(ctx sdk.Context, msg *types.MsgDeleteRunner) error { if err := k.cdc.UnmarshalBinaryLengthPrefixed(value, &r); err != nil { return fmt.Errorf("unmarshal error: %w", err) } - if r.Address != msg.Address.String() { + if r.Owner != msg.Address.String() { return errors.New("only the runner owner can remove itself") } if err := k.ownershipKeeper.Delete(ctx, msg.Address, r.Hash); err != nil { diff --git a/x/runner/internal/types/expected_keepers.go b/x/runner/internal/types/expected_keepers.go index 8814d2286..b97b8896f 100644 --- a/x/runner/internal/types/expected_keepers.go +++ b/x/runner/internal/types/expected_keepers.go @@ -23,6 +23,6 @@ type InstanceKeeper interface { // OwnershipKeeper module interface. type OwnershipKeeper interface { - Set(ctx sdk.Context, owner sdk.AccAddress, resourceHash hash.Hash, resource ownershippb.Ownership_Resource) (*ownershippb.Ownership, error) + Set(ctx sdk.Context, owner sdk.AccAddress, resourceHash hash.Hash, resource ownershippb.Ownership_Resource, resourceAddress sdk.AccAddress) (*ownershippb.Ownership, error) Delete(ctx sdk.Context, owner sdk.AccAddress, resourceHash hash.Hash) error } diff --git a/x/runner/internal/types/msg.go b/x/runner/internal/types/msg.go index b4e64a664..523f2b45f 100644 --- a/x/runner/internal/types/msg.go +++ b/x/runner/internal/types/msg.go @@ -10,6 +10,7 @@ import ( // MsgCreateRunner defines a state transition to create a runner. type MsgCreateRunner struct { + // TODO: address should be renamed to owner Address sdk.AccAddress `json:"address" validate:"required,accaddress"` ServiceHash hash.Hash `json:"serviceHash" validate:"required,hash"` EnvHash hash.Hash `json:"envHash" validate:"omitempty,hash"` diff --git a/x/service/internal/keeper/keeper.go b/x/service/internal/keeper/keeper.go index 679689db5..0e8624bea 100644 --- a/x/service/internal/keeper/keeper.go +++ b/x/service/internal/keeper/keeper.go @@ -11,6 +11,7 @@ import ( servicepb "github.com/mesg-foundation/engine/service" "github.com/mesg-foundation/engine/service/validator" "github.com/mesg-foundation/engine/x/service/internal/types" + "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/libs/log" ) @@ -57,7 +58,7 @@ func (k Keeper) Create(ctx sdk.Context, msg *types.MsgCreateService) (*servicepb return nil, err } - if _, err := k.ownershipKeeper.Set(ctx, msg.Owner, srv.Hash, ownershippb.Ownership_Service); err != nil { + if _, err := k.ownershipKeeper.Set(ctx, msg.Owner, srv.Hash, ownershippb.Ownership_Service, srv.Address); err != nil { return nil, err } @@ -123,5 +124,6 @@ func initializeService(req *api.CreateServiceRequest) *servicepb.Service { // calculate and apply hash to service. srv.Hash = hash.Dump(srv) + srv.Address = sdk.AccAddress(crypto.AddressHash(srv.Hash)) return srv } diff --git a/x/service/internal/types/expected_keepers.go b/x/service/internal/types/expected_keepers.go index d3e4e4729..b8b8beb89 100644 --- a/x/service/internal/types/expected_keepers.go +++ b/x/service/internal/types/expected_keepers.go @@ -17,5 +17,5 @@ type ParamSubspace interface { // OwnershipKeeper module interface. type OwnershipKeeper interface { - Set(ctx sdk.Context, owner sdk.AccAddress, resourceHash hash.Hash, resource ownershippb.Ownership_Resource) (*ownershippb.Ownership, error) + Set(ctx sdk.Context, owner sdk.AccAddress, resourceHash hash.Hash, resource ownershippb.Ownership_Resource, resourceAddress sdk.AccAddress) (*ownershippb.Ownership, error) }