From f2f671ce34a5e2e940c34ac6ec03639f713c9453 Mon Sep 17 00:00:00 2001 From: Bruno Gomes Date: Thu, 27 Jun 2024 12:14:50 -0300 Subject: [PATCH] refactor: MsgPolicyCmd -> MsgSignedPolicyCmd --- Makefile | 8 + cmd/test_env_generator/main.go | 86 +++ go.mod | 34 +- go.sum | 99 +-- proto/sourcehub/acp/policy_cmd.proto | 21 +- proto/sourcehub/acp/tx.proto | 15 +- scripts/run-test-matrix | 9 + tests/integration/acp/actors.go | 1 - tests/integration/acp/ctx.go | 106 +-- tests/integration/acp/dispatchers.go | 77 ++- tests/integration/acp/executor.go | 93 ++- tests/integration/acp/init.go | 28 + ...uery_owner_test.go => query_owner_test.go} | 0 ...ject_register_test.go => register_test.go} | 0 ..._unregister_test.go => unregister_test.go} | 4 - ...tionship_delete_test.go => delete_test.go} | 0 ...tionship_filter_test.go => filter_test.go} | 0 .../{relationship_set_test.go => set_test.go} | 23 + tests/integration/acp/types.go | 142 ++++ x/acp/bearer_token/parser.go | 37 +- x/acp/did/key_test.go | 29 +- x/acp/did/types.go | 8 +- ...ver_policy_cmd_delete_relationship_test.go | 147 ---- ..._server_policy_cmd_register_object_test.go | 280 -------- ...server_policy_cmd_set_relationship_test.go | 195 ------ ...erver_policy_cmd_unregister_object_test.go | 149 ----- ...cmd.go => msg_server_signed_policy_cmd.go} | 26 +- x/acp/policy_cmd/builder.go | 44 +- x/acp/policy_cmd/jws.go | 41 +- x/acp/policy_cmd/spec.go | 8 +- x/acp/simulation/policy_cmd.go | 2 +- x/acp/types/codec.go | 2 +- x/acp/types/message_policy_cmd.go | 14 +- x/acp/types/message_policy_cmd_test.go | 6 +- x/acp/types/policy_cmd.pb.go | 520 +++------------ x/acp/types/tx.pb.go | 625 +++++------------- 36 files changed, 902 insertions(+), 1977 deletions(-) create mode 100644 cmd/test_env_generator/main.go create mode 100755 scripts/run-test-matrix create mode 100644 tests/integration/acp/init.go rename tests/integration/acp/suite/object/{object_query_owner_test.go => query_owner_test.go} (100%) rename tests/integration/acp/suite/object/{object_register_test.go => register_test.go} (100%) rename tests/integration/acp/suite/object/{object_unregister_test.go => unregister_test.go} (96%) rename tests/integration/acp/suite/relationship/{relationship_delete_test.go => delete_test.go} (100%) rename tests/integration/acp/suite/relationship/{relationship_filter_test.go => filter_test.go} (100%) rename tests/integration/acp/suite/relationship/{relationship_set_test.go => set_test.go} (85%) create mode 100644 tests/integration/acp/types.go delete mode 100644 x/acp/keeper/msg_server_policy_cmd_delete_relationship_test.go delete mode 100644 x/acp/keeper/msg_server_policy_cmd_register_object_test.go delete mode 100644 x/acp/keeper/msg_server_policy_cmd_set_relationship_test.go delete mode 100644 x/acp/keeper/msg_server_policy_cmd_unregister_object_test.go rename x/acp/keeper/{msg_server_policy_cmd.go => msg_server_signed_policy_cmd.go} (82%) diff --git a/Makefile b/Makefile index 06a02cc..e1c78df 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,10 @@ proto: test: go test ./... +.PHONY: test\:all +test\:all: test_env_generator + scripts/run-test-matrix + .PHONY: simulate simulate: ignite chain simulate @@ -42,3 +46,7 @@ docs: # the ID of the current git HEAD image: scripts/build-docker-image.sh + +.PHONY: test_env_generator +test_env_generator: + go build -o build/test_env_generator cmd/test_env_generator/main.go diff --git a/cmd/test_env_generator/main.go b/cmd/test_env_generator/main.go new file mode 100644 index 0000000..7deed7a --- /dev/null +++ b/cmd/test_env_generator/main.go @@ -0,0 +1,86 @@ +package main + +import ( + "fmt" + "log" + "strconv" + "strings" + + test "github.com/sourcenetwork/sourcehub/tests/integration/acp" + "github.com/sourcenetwork/sourcehub/utils" + "github.com/spf13/cobra" +) + +var rootCmd = &cobra.Command{ + Use: "test_env_generator {permutation}", + Short: "test_env_generator permutates through SourceHub's test suite environment variables", + Long: ` + test_env_generator outputs the set of environment variables which should be set for each test permutation. + + With no input, prints the amount of permutations available. + Permutation numbering is 0 based (eg if there are permutations the allowed options arguments are 0, 1, 2) + `, + Args: cobra.MaximumNArgs(1), + Run: func(cmd *cobra.Command, args []string) { + environs := genEnvirons() + + if len(args) == 0 { + fmt.Printf("%v\n", len(environs)) + return + } + + if args[0] == "all" { + for _, env := range environs { + fmt.Println(env) + } + return + } + + index, err := strconv.Atoi(args[0]) + if err != nil { + log.Fatalf("%v is an invalid index", args[0]) + } + if index < 0 || index > len(environs) { + log.Fatalf("index must be within [0, %v]", len(environs)-1) + } + + println(environs[index]) + }, +} + +func main() { + rootCmd.Execute() +} + +func writeKV(builder *strings.Builder, key, value string) { + builder.WriteString("export ") + builder.WriteString(key) + builder.WriteRune('=') + builder.WriteRune('"') + builder.WriteString(value) + builder.WriteRune('"') + builder.WriteRune(' ') + builder.WriteRune(';') +} + +func genEnvirons() []string { + combinations := len(test.ActorKeyMap) * len(test.ExecutorStrategyMap) * len(test.AuthenticationStrategyMap) + environs := make([]string, 0, combinations) + + for actorKeyVar := range test.ActorKeyMap { + for executorVar := range test.ExecutorStrategyMap { + for authStratVar := range test.AuthenticationStrategyMap { + builder := strings.Builder{} + writeKV(&builder, test.SourceHubActorEnvVar, actorKeyVar) + writeKV(&builder, test.SourceHubExecutorEnvVar, executorVar) + writeKV(&builder, test.SourceHubAuthStratEnvVar, authStratVar) + environ := builder.String() + environs = append(environs, environ) + } + } + } + + utils.SortSlice(environs) + + return environs +} diff --git a/go.mod b/go.mod index 11d0d40..9bc1391 100644 --- a/go.mod +++ b/go.mod @@ -31,6 +31,7 @@ require ( github.com/cosmos/ibc-go/modules/capability v1.0.0 github.com/cosmos/ibc-go/v8 v8.0.0 github.com/cyware/ssi-sdk v0.0.0-20231229164914-f93f3006379f + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 github.com/go-jose/go-jose/v3 v3.0.1-0.20221117193127-916db76e8214 github.com/golang/protobuf v1.5.3 github.com/google/go-cmp v0.6.0 @@ -38,14 +39,13 @@ require ( github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 - github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230501135648-a9a7ad029347 github.com/sourcenetwork/raccoondb v0.2.0 github.com/sourcenetwork/zanzi v0.3.0 github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.18.2 - github.com/stretchr/testify v1.8.4 - golang.org/x/tools v0.18.0 + github.com/stretchr/testify v1.9.0 + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d google.golang.org/genproto/googleapis/api v0.0.0-20231120223509-83a465c0220f google.golang.org/grpc v1.60.1 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 @@ -81,9 +81,7 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/bits-and-blooms/bitset v1.11.0 // indirect - github.com/btcsuite/btcd v0.22.1 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect - github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect github.com/bufbuild/protocompile v0.6.0 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect @@ -110,7 +108,6 @@ require ( github.com/creachadair/tomledit v0.0.24 // indirect github.com/danieljoos/wincred v1.2.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect @@ -141,7 +138,7 @@ require ( github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.15.1 // indirect - github.com/goccy/go-json v0.10.2 // indirect + github.com/goccy/go-json v0.10.3 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gofrs/uuid/v5 v5.0.0 // indirect github.com/gogo/googleapis v1.4.1 // indirect @@ -177,6 +174,7 @@ require ( github.com/hyperledger/aries-framework-go v0.3.2 // indirect github.com/hyperledger/aries-framework-go/component/kmscrypto v0.0.0-20230427134832-0c9969493bd3 // indirect github.com/hyperledger/aries-framework-go/component/log v0.0.0-20230427134832-0c9969493bd3 // indirect + github.com/hyperledger/aries-framework-go/component/models v0.0.0-20230501135648-a9a7ad029347 // indirect github.com/hyperledger/aries-framework-go/spi v0.0.0-20230427134832-0c9969493bd3 // indirect github.com/iancoleman/strcase v0.3.0 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect @@ -195,9 +193,9 @@ require ( github.com/leodido/go-urn v1.2.4 // indirect github.com/lestrrat-go/blackmagic v1.0.2 // indirect github.com/lestrrat-go/httpcc v1.0.1 // indirect - github.com/lestrrat-go/httprc v1.0.4 // indirect + github.com/lestrrat-go/httprc v1.0.5 // indirect github.com/lestrrat-go/iter v1.0.2 // indirect - github.com/lestrrat-go/jwx/v2 v2.0.18 // indirect + github.com/lestrrat-go/jwx/v2 v2.1.0 // indirect github.com/lestrrat-go/option v1.0.1 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect @@ -253,14 +251,10 @@ require ( github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tendermint/tm-db v0.6.7 // indirect - github.com/teserakt-io/golang-ed25519 v0.0.0-20210104091850-3888c087a4c8 // indirect github.com/tetratelabs/wazero v1.5.0 // indirect github.com/tidwall/btree v1.7.0 // indirect github.com/ulikunitz/xz v0.5.11 // indirect github.com/vbatts/tar-split v0.11.5 // indirect - github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect - github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect - github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect go.etcd.io/bbolt v1.3.8 // indirect @@ -272,15 +266,15 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.26.0 // indirect - golang.org/x/crypto v0.19.0 // indirect + golang.org/x/crypto v0.24.0 // indirect golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect - golang.org/x/mod v0.15.0 // indirect - golang.org/x/net v0.21.0 // indirect + golang.org/x/mod v0.17.0 // indirect + golang.org/x/net v0.25.0 // indirect golang.org/x/oauth2 v0.16.0 // indirect - golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.17.0 // indirect - golang.org/x/term v0.17.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/term v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/api v0.153.0 // indirect diff --git a/go.sum b/go.sum index f2f55ac..74bb570 100644 --- a/go.sum +++ b/go.sum @@ -250,7 +250,6 @@ github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrd github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -285,24 +284,15 @@ github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2 github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bits-and-blooms/bitset v1.11.0 h1:RMyy2mBBShArUAhfVRZJ2xyBO58KCBCtZFShw3umo6k= github.com/bits-and-blooms/bitset v1.11.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= -github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.1 h1:CnwP9LM/M9xuRrGSCGeMVs9iv09uMqwsVX7EeIpgV2c= -github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 h1:KdUfX2zKommPRa+PD0sWZUyXe9w277ABlgELO7H04IM= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ= github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/bufbuild/buf v1.27.2 h1:uX2kvZfPfRoOsrxUW4LwpykSyH+wI5dUnIG0QWHDCCU= github.com/bufbuild/buf v1.27.2/go.mod h1:7RImDhFDqhEsdK5wbuMhoVSlnrMggGGcd3s9WozvHtM= github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= @@ -417,15 +407,14 @@ github.com/cyware/ssi-sdk v0.0.0-20231229164914-f93f3006379f h1:72bD8UUtmnis7LAC github.com/cyware/ssi-sdk v0.0.0-20231229164914-f93f3006379f/go.mod h1:fXZNsGp0JHlOW4XyY3SQk1dy6D2I0HD+aiHY3Ku0el8= github.com/danieljoos/wincred v1.2.0 h1:ozqKHaLK0W/ii4KVbbvluM91W2H3Sh0BncbUNPS7jLE= github.com/danieljoos/wincred v1.2.0/go.mod h1:FzQLLMKBFdvu+osBrnFODiv32YGwCfx0SkRa/eYHgec= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 h1:rpfIENRNNilwHwZeG5+P150SMrnNEcHYvcCuK6dPZSg= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= @@ -558,8 +547,8 @@ github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6Wezm github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/gobwas/ws v1.2.1 h1:F2aeBZrm2NDsc7vbovKrWSogd4wvfAxg0FQ89/iqOTk= github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY= -github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= -github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= +github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -676,8 +665,6 @@ github.com/google/pprof v0.0.0-20230926050212-f7f687d19a98/go.mod h1:czg5+yv1E0Z github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= -github.com/google/tink/go v1.7.0 h1:6Eox8zONGebBFcCBqkVmt60LaWZa6xg1cl/DwAh/J1w= -github.com/google/tink/go v1.7.0/go.mod h1:GAUOd+QE3pgj9q8VKIGTCP33c/B7eb4NhxLcgTJZStM= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -790,8 +777,6 @@ github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-202304271 github.com/hyperledger/aries-framework-go/component/storageutil v0.0.0-20230427134832-0c9969493bd3/go.mod h1:aSG2dWjYVzu2PVBtOqsYghaChA5+UUXnBbL+MfVceYQ= github.com/hyperledger/aries-framework-go/spi v0.0.0-20230427134832-0c9969493bd3 h1:ytWmOQZIYQfVJ4msFvrqlp6d+ZLhT43wS8rgE2m+J1A= github.com/hyperledger/aries-framework-go/spi v0.0.0-20230427134832-0c9969493bd3/go.mod h1:oryUyWb23l/a3tAP9KW+GBbfcfqp9tZD4y5hSkFrkqI= -github.com/hyperledger/ursa-wrapper-go v0.3.1 h1:Do+QrVNniY77YK2jTIcyWqj9rm/Yb5SScN0bqCjiibA= -github.com/hyperledger/ursa-wrapper-go v0.3.1/go.mod h1:nPSAuMasIzSVciQo22PedBk4Opph6bJ6ia3ms7BH/mk= github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= @@ -805,7 +790,6 @@ github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLf github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/jdx/go-netrc v1.0.0 h1:QbLMLyCZGj0NA8glAhxUpf1zDg6cxnWgMBbjq40W0gQ= github.com/jdx/go-netrc v1.0.0/go.mod h1:Gh9eFQJnoTNIRHXl2j5bJXA1u84hQWJWgGh569zF3v8= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= @@ -823,7 +807,6 @@ github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22 github.com/jorrizza/ed2curve25519 v0.1.0 h1:P58ZEiVKW4vknYuGyOXuskMm82rTJyGhgRGrMRcCE8E= github.com/jorrizza/ed2curve25519 v0.1.0/go.mod h1:27VPNk2FnNqLQNvvVymiX41VE/nokPyn5HHP7gtfYlo= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -842,7 +825,6 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= @@ -868,13 +850,12 @@ github.com/lestrrat-go/blackmagic v1.0.2 h1:Cg2gVSc9h7sz9NOByczrbUvLopQmXrfFx//N github.com/lestrrat-go/blackmagic v1.0.2/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= github.com/lestrrat-go/httpcc v1.0.1 h1:ydWCStUeJLkpYyjLDHihupbn2tYmZ7m22BGkcvZZrIE= github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E= -github.com/lestrrat-go/httprc v1.0.4 h1:bAZymwoZQb+Oq8MEbyipag7iSq6YIga8Wj6GOiJGdI8= -github.com/lestrrat-go/httprc v1.0.4/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= +github.com/lestrrat-go/httprc v1.0.5 h1:bsTfiH8xaKOJPrg1R+E3iE/AWZr/x0Phj9PBTG/OLUk= +github.com/lestrrat-go/httprc v1.0.5/go.mod h1:mwwz3JMTPBjHUkkDv/IGJ39aALInZLrhBp0X7KGUZlo= github.com/lestrrat-go/iter v1.0.2 h1:gMXo1q4c2pHmC3dn8LzRhJfP1ceCbgSiT9lUydIzltI= github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= -github.com/lestrrat-go/jwx/v2 v2.0.18 h1:HHZkYS5wWDDyAiNBwztEtDoX07WDhGEdixm8G06R50o= -github.com/lestrrat-go/jwx/v2 v2.0.18/go.mod h1:fAJ+k5eTgKdDqanzCuK6DAt3W7n3cs2/FX7JhQdk83U= -github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= +github.com/lestrrat-go/jwx/v2 v2.1.0 h1:0zs7Ya6+39qoit7gwAf+cYm1zzgS3fceIdo7RmQ5lkw= +github.com/lestrrat-go/jwx/v2 v2.1.0/go.mod h1:Xpw9QIaUGiIUD1Wx0NcY1sIHwFf8lDuZn/cmxtXYRys= github.com/lestrrat-go/option v1.0.1 h1:oAzP2fvZGQKWkvHa1/SAcFolBEca1oN+mQ7eooNBEYU= github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= @@ -1140,8 +1121,9 @@ github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5J github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -1153,8 +1135,9 @@ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1F github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= @@ -1163,8 +1146,6 @@ github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2l github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= github.com/tendermint/tm-db v0.6.7 h1:fE00Cbl0jayAoqlExN6oyQJ7fR/ZtoVOmvPJ//+shu8= github.com/tendermint/tm-db v0.6.7/go.mod h1:byQDzFkZV1syXr/ReXS808NxA2xvyuuVgXOJ/088L6I= -github.com/teserakt-io/golang-ed25519 v0.0.0-20210104091850-3888c087a4c8 h1:RBkacARv7qY5laaXGlF4wFB/tk5rnthhPb8oIBGoagY= -github.com/teserakt-io/golang-ed25519 v0.0.0-20210104091850-3888c087a4c8/go.mod h1:9PdLyPiZIiW3UopXyRnPYyjUXSpiQNHRLu8fOsR3o8M= github.com/tetratelabs/wazero v1.5.0 h1:Yz3fZHivfDiZFUXnWMPUoiW7s8tC1sjdBtlJn08qYa0= github.com/tetratelabs/wazero v1.5.0/go.mod h1:0U0G41+ochRKoPKCJlh0jMg1CHkyfK8kDqiirMmKY8A= github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= @@ -1184,13 +1165,6 @@ github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijb github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/vbatts/tar-split v0.11.5 h1:3bHCTIheBm1qFTcgh9oPu+nNBtX+XJIupG/vacinCts= github.com/vbatts/tar-split v0.11.5/go.mod h1:yZbwRsSeGjusneWgA781EKej9HF8vme8okylkAeNKLk= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= -github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= -github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -1249,7 +1223,6 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1259,15 +1232,12 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= +golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1307,9 +1277,8 @@ golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.15.0 h1:SernR4v+D55NyBH2QiEQrlBAnj1ECL6AGrA5+dPaMY8= -golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1369,10 +1338,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1414,9 +1381,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1515,21 +1481,15 @@ golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0= -golang.org/x/term v0.17.0 h1:mkTF7LCd6WGJNL3K1Ad7kwxNfYAW6a8a8QqtMblp/4U= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= +golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= +golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1541,10 +1501,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -1613,9 +1571,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= -golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= +golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/proto/sourcehub/acp/policy_cmd.proto b/proto/sourcehub/acp/policy_cmd.proto index 42705c3..2a5cabe 100644 --- a/proto/sourcehub/acp/policy_cmd.proto +++ b/proto/sourcehub/acp/policy_cmd.proto @@ -12,7 +12,7 @@ option go_package = "github.com/sourcenetwork/sourcehub/x/acp/types"; // The message type contains a signature which is used to authenticate the Command's Actor message SignedPolicyCmd { // payload contains the command context - PolicyCmdPayload payload = 1; + SignedPolicyCmdPayload payload = 1; // signature is a signature of the payload. // The signature is generated using the VerificationMethod / Authorization fields @@ -20,8 +20,8 @@ message SignedPolicyCmd { bytes signature = 2; } -// PolicyCmdPayload represents the payload containing the context of the issued command -message PolicyCmdPayload { +// SignedPolicyCmdPayload represents the payload containing the context of the issued command +message SignedPolicyCmdPayload { // actor is a did string representing the actor which issued the command string actor = 1; @@ -39,20 +39,15 @@ message PolicyCmdPayload { // policy_id is the ID of the policy under which the Command will be executed string policy_id = 5; - oneof cmd { - SetRelationshipCmd set_relationship_cmd = 6; - DeleteRelationshipCmd delete_relationship_cmd = 7; - RegisterObjectCmd register_object_cmd = 8; - UnregisterObjectCmd unregister_object_cmd = 9; - } + PolicyCmd cmd = 6; } message PolicyCmd { oneof cmd { - SetRelationshipCmd set_relationship_cmd = 2; - DeleteRelationshipCmd delete_relationship_cmd = 3; - RegisterObjectCmd register_object_cmd = 4; - UnregisterObjectCmd unregister_object_cmd = 5; + SetRelationshipCmd set_relationship_cmd = 1; + DeleteRelationshipCmd delete_relationship_cmd = 2; + RegisterObjectCmd register_object_cmd = 3; + UnregisterObjectCmd unregister_object_cmd = 4; } } diff --git a/proto/sourcehub/acp/tx.proto b/proto/sourcehub/acp/tx.proto index 8fca5bf..5714b28 100644 --- a/proto/sourcehub/acp/tx.proto +++ b/proto/sourcehub/acp/tx.proto @@ -66,9 +66,9 @@ service Msg { // was valid at a particular block height. rpc CheckAccess(MsgCheckAccess) returns (MsgCheckAccessResponse); - // PolicyCmd is a wrapper for a Command which is executed within the Context of a Policy. + // SignedPolicyCmd is a wrapper for a Command which is executed within the Context of a Policy. // The Command is signed by the Actor issuing it. - rpc PolicyCmd(MsgPolicyCmd) returns (MsgPolicyCmdResponse); + rpc SignedPolicyCmd(MsgSignedPolicyCmd) returns (MsgSignedPolicyCmdResponse); // BearerPolicyCmd is a Msg containing an instruction which changes the authorization // rules in a Policy. @@ -175,7 +175,7 @@ message MsgCheckAccessResponse { AccessDecision decision = 1; } -message MsgPolicyCmd { +message MsgSignedPolicyCmd { enum ContentType { UNKNOWN = 0; JWS = 1; @@ -186,13 +186,8 @@ message MsgPolicyCmd { ContentType type = 3; } -message MsgPolicyCmdResponse { - oneof result { - SetRelationshipCmdResult set_relationship_result = 1; - DeleteRelationshipCmdResult delete_relationship_result = 2; - RegisterObjectCmdResult register_object_result = 3; - UnregisterObjectCmdResult unregister_object_result = 4; - } +message MsgSignedPolicyCmdResponse { + PolicyCmdResult result = 1; } message MsgBearerPolicyCmd { diff --git a/scripts/run-test-matrix b/scripts/run-test-matrix new file mode 100755 index 0000000..f5b4399 --- /dev/null +++ b/scripts/run-test-matrix @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -e; + +IFS=$'\n' +for env in $(build/test_env_generator all); do + echo "Executing with $env" + eval $env + go test ./tests/integration/... -count=1 -v +done diff --git a/tests/integration/acp/actors.go b/tests/integration/acp/actors.go index 8484283..6705eaa 100644 --- a/tests/integration/acp/actors.go +++ b/tests/integration/acp/actors.go @@ -49,7 +49,6 @@ func MustNewED25519ActorFromName(name string) *TestActor { // MustNewSourceHubActorFromName deterministically generates a Test Actor from a string name as seed // The Actor carries a secp256k1 key pair and a SourceHub addr func MustNewSourceHubActorFromName(name string) *TestActor { - key := sdksecp256k1.GenPrivKeyFromSecret([]byte(name)) addr, err := bech32.ConvertAndEncode(app.AccountAddressPrefix, key.PubKey().Address()) if err != nil { diff --git a/tests/integration/acp/ctx.go b/tests/integration/acp/ctx.go index bd7b178..31c3219 100644 --- a/tests/integration/acp/ctx.go +++ b/tests/integration/acp/ctx.go @@ -6,21 +6,9 @@ import ( "testing" "time" - "cosmossdk.io/log" - "cosmossdk.io/store" - "cosmossdk.io/store/metrics" - storetypes "cosmossdk.io/store/types" - cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" - dbm "github.com/cosmos/cosmos-db" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/runtime" - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/stretchr/testify/require" - "github.com/sourcenetwork/sourcehub/x/acp/keeper" + "github.com/sourcenetwork/sourcehub/x/acp/policy_cmd" "github.com/sourcenetwork/sourcehub/x/acp/testutil" "github.com/sourcenetwork/sourcehub/x/acp/types" ) @@ -29,18 +17,37 @@ var DefaultTs = MustDateTimeToProto("2024-01-01 00:00:00") var _ context.Context = (*TestCtx)(nil) -type ActorType int - -const ( - Actor_ED25519 ActorType = iota - Actor_SECP256K1 ActorType = iota -) - type TestState struct { PolicyId string PolicyCreator string } +func NewTestCtxFromConfig(t *testing.T, config TestConfig) (*TestCtx, error) { + baseCtx, executor, err := NewExecutor(config.ExecutorStrategy) + if err != nil { + return nil, err + } + + root := MustNewSourceHubActorFromName("root") + _, err = executor.GetOrCreateAccountFromActor(baseCtx, root) + if err != nil { + return nil, err + } + + ctx := &TestCtx{ + Ctx: baseCtx, + T: t, + TxSigner: root, + Timestamp: time.Date(2024, 6, 21, 12, 10, 00, 0, time.UTC), + TokenIssueTs: time.Date(2024, 6, 21, 12, 00, 00, 0, time.UTC), + Executor: executor, + Strategy: config.AuthStrategy, + ActorType: config.ActorType, + LogicalClock: &logicalClockImpl{}, + } + return ctx, nil +} + type TestCtx struct { Ctx context.Context T *testing.T @@ -53,25 +60,15 @@ type TestCtx struct { Executor MsgExecutor Strategy AuthenticationStrategy AccountKeeper *testutil.AccountKeeperStub - ActorType ActorType + ActorType ActorKeyType + LogicalClock policy_cmd.LogicalClock } func NewTestCtx(t *testing.T) *TestCtx { - baseCtx, srv, accKeeper := setupMsgServer(t) - root := MustNewSourceHubActorFromName("root") - accKeeper.NewAccount(root.PubKey) - ctx := &TestCtx{ - Ctx: baseCtx, - T: t, - TxSigner: root, - Timestamp: time.Date(2024, 6, 21, 12, 10, 00, 0, time.UTC), - TokenIssueTs: time.Date(2024, 6, 21, 12, 00, 00, 0, time.UTC), - Executor: &KeeperExecutor{k: srv}, - Strategy: BearerToken, - AccountKeeper: accKeeper, - ActorType: Actor_ED25519, //TODO parametrize - } - ctx.GetSourceHubAccount("root") + initTest() + config := MustNewTestConfigFromEnv() + ctx, err := NewTestCtxFromConfig(t, config) + require.NoError(t, err) return ctx } @@ -98,39 +95,6 @@ func (c *TestCtx) GetSourceHubAccount(alias string) *TestActor { return acc } -func setupMsgServer(t *testing.T) (sdk.Context, types.MsgServer, *testutil.AccountKeeperStub) { - ctx, k, accK := setupKeeper(t) - return ctx, keeper.NewMsgServerImpl(k), accK -} - -func setupKeeper(t *testing.T) (sdk.Context, keeper.Keeper, *testutil.AccountKeeperStub) { - storeKey := storetypes.NewKVStoreKey(types.StoreKey) - - db := dbm.NewMemDB() - stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) - stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) - require.NoError(t, stateStore.LoadLatestVersion()) - - registry := codectypes.NewInterfaceRegistry() - cdc := codec.NewProtoCodec(registry) - authority := authtypes.NewModuleAddress(govtypes.ModuleName) - - accKeeper := &testutil.AccountKeeperStub{} - accKeeper.GenAccount() - - k := keeper.NewKeeper( - cdc, - runtime.NewKVStoreService(storeKey), - log.NewNopLogger(), - authority.String(), - accKeeper, - ) - - ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) - ctx = ctx.WithEventManager(sdk.NewEventManager()) - - // Initialize params - k.SetParams(ctx, types.DefaultParams()) - - return ctx, k, accKeeper +func (c *TestCtx) GetParams() types.Params { + return types.NewParams() } diff --git a/tests/integration/acp/dispatchers.go b/tests/integration/acp/dispatchers.go index e8c5dc0..f8d0c66 100644 --- a/tests/integration/acp/dispatchers.go +++ b/tests/integration/acp/dispatchers.go @@ -8,14 +8,6 @@ import ( "github.com/sourcenetwork/sourcehub/x/acp/types" ) -type AuthenticationStrategy int - -const ( - Direct AuthenticationStrategy = iota - BearerToken - SignedPayload -) - func setRelationshipDispatcher(ctx *TestCtx, action *SetRelationshipAction) (result *types.SetRelationshipCmdResult, err error) { switch ctx.Strategy { case BearerToken: @@ -33,22 +25,26 @@ func setRelationshipDispatcher(ctx *TestCtx, action *SetRelationshipAction) (res } err = respErr case SignedPayload: - builder := policy_cmd.CmdBuilder{} + var jws string + builder := policy_cmd.NewCmdBuilder(ctx.LogicalClock, ctx.GetParams()) builder.SetRelationship(action.Relationship) builder.Actor(action.Actor.DID) - builder.CreationTimestamp(TimeToProto(ctx.TokenIssueTs)) + builder.CreationTimestamp(TimeToProto(ctx.Timestamp)) builder.PolicyID(action.PolicyId) builder.SetSigner(action.Actor.Signer) - jws, err := builder.BuildJWS(ctx) + jws, err = builder.BuildJWS(ctx) require.NoError(ctx.T, err) - msg := &types.MsgPolicyCmd{ + msg := &types.MsgSignedPolicyCmd{ Creator: ctx.TxSigner.SourceHubAddr, Payload: jws, - Type: types.MsgPolicyCmd_JWS, + Type: types.MsgSignedPolicyCmd_JWS, } - //container, err = ctx.Executor.PolicyCmd(ctx, msg) - _ = msg + resp, respErr := ctx.Executor.SignedPolicyCmd(ctx, msg) + if resp != nil { + result = resp.Result.GetSetRelationshipResult() + } + err = respErr } return } @@ -72,22 +68,25 @@ func deleteRelationshipDispatcher(ctx *TestCtx, action *DeleteRelationshipAction } resultErr = err case SignedPayload: - builder := policy_cmd.CmdBuilder{} + builder := policy_cmd.NewCmdBuilder(ctx.LogicalClock, ctx.GetParams()) builder.DeleteRelationship(action.Relationship) builder.Actor(action.Actor.DID) - builder.CreationTimestamp(TimeToProto(ctx.TokenIssueTs)) + builder.CreationTimestamp(TimeToProto(ctx.Timestamp)) builder.PolicyID(action.PolicyId) builder.SetSigner(action.Actor.Signer) jws, err := builder.BuildJWS(ctx) require.NoError(ctx.T, err) - msg := &types.MsgPolicyCmd{ + msg := &types.MsgSignedPolicyCmd{ Creator: ctx.TxSigner.SourceHubAddr, Payload: jws, - Type: types.MsgPolicyCmd_JWS, + Type: types.MsgSignedPolicyCmd_JWS, + } + resp, respErr := ctx.Executor.SignedPolicyCmd(ctx, msg) + if resp != nil { + result = resp.Result.GetDeleteRelationshipResult() } - //container, err = ctx.Executor.PolicyCmd(ctx, msg) - _ = msg + resultErr = respErr } return result, resultErr } @@ -109,22 +108,26 @@ func registerObjectDispatcher(ctx *TestCtx, action *RegisterObjectAction) (resul } err = respErr case SignedPayload: - builder := policy_cmd.CmdBuilder{} + var jws string + builder := policy_cmd.NewCmdBuilder(ctx.LogicalClock, ctx.GetParams()) builder.RegisterObject(action.Object) builder.Actor(action.Actor.DID) - builder.CreationTimestamp(TimeToProto(ctx.TokenIssueTs)) + builder.CreationTimestamp(TimeToProto(ctx.Timestamp)) builder.PolicyID(action.PolicyId) builder.SetSigner(action.Actor.Signer) - jws, err := builder.BuildJWS(ctx) + jws, err = builder.BuildJWS(ctx) require.NoError(ctx.T, err) - msg := &types.MsgPolicyCmd{ + msg := &types.MsgSignedPolicyCmd{ Creator: ctx.TxSigner.SourceHubAddr, Payload: jws, - Type: types.MsgPolicyCmd_JWS, + Type: types.MsgSignedPolicyCmd_JWS, } - //container, err = ctx.Executor.PolicyCmd(ctx, msg) - _ = msg + resp, respErr := ctx.Executor.SignedPolicyCmd(ctx, msg) + if resp != nil { + result = resp.Result.GetRegisterObjectResult() + } + err = respErr } return result, err } @@ -146,22 +149,26 @@ func unregisterObjectDispatcher(ctx *TestCtx, action *UnregisterObjectAction) (r } err = respErr case SignedPayload: - builder := policy_cmd.CmdBuilder{} + var jws string + builder := policy_cmd.NewCmdBuilder(ctx.LogicalClock, ctx.GetParams()) builder.UnregisterObject(action.Object) builder.Actor(action.Actor.DID) - builder.CreationTimestamp(TimeToProto(ctx.TokenIssueTs)) + builder.CreationTimestamp(TimeToProto(ctx.Timestamp)) builder.PolicyID(action.PolicyId) builder.SetSigner(action.Actor.Signer) - jws, err := builder.BuildJWS(ctx) + jws, err = builder.BuildJWS(ctx) require.NoError(ctx.T, err) - msg := &types.MsgPolicyCmd{ + msg := &types.MsgSignedPolicyCmd{ Creator: ctx.TxSigner.SourceHubAddr, Payload: jws, - Type: types.MsgPolicyCmd_JWS, + Type: types.MsgSignedPolicyCmd_JWS, } - //container, err = ctx.Executor.PolicyCmd(ctx, msg) - _ = msg + resp, respErr := ctx.Executor.SignedPolicyCmd(ctx, msg) + if resp != nil { + result = resp.Result.GetUnregisterObjectResult() + } + err = respErr } return result, err } diff --git a/tests/integration/acp/executor.go b/tests/integration/acp/executor.go index 18335be..99ecf0c 100644 --- a/tests/integration/acp/executor.go +++ b/tests/integration/acp/executor.go @@ -1,29 +1,98 @@ package test -import "github.com/sourcenetwork/sourcehub/x/acp/types" +import ( + "context" + "fmt" -func ExecMsg(executor MsgExecutor, msg any) (any, error) { - return nil, nil -} + "cosmossdk.io/log" + "cosmossdk.io/store" + "cosmossdk.io/store/metrics" + storetypes "cosmossdk.io/store/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/runtime" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/sourcenetwork/sourcehub/x/acp/types" -type MsgExecutor interface { - CreatePolicy(ctx *TestCtx, msg *types.MsgCreatePolicy) (*types.MsgCreatePolicyResponse, error) - BearerPolicyCmd(ctx *TestCtx, msg *types.MsgBearerPolicyCmd) (*types.MsgBearerPolicyCmdResponse, error) - PolicyCmd(ctx *TestCtx, msg *types.MsgPolicyCmd) (*types.MsgPolicyCmdResponse, error) -} + "github.com/sourcenetwork/sourcehub/x/acp/keeper" + "github.com/sourcenetwork/sourcehub/x/acp/testutil" +) type KeeperExecutor struct { - k types.MsgServer + k types.MsgServer + accountCreator *testutil.AccountKeeperStub } func (e *KeeperExecutor) BearerPolicyCmd(ctx *TestCtx, msg *types.MsgBearerPolicyCmd) (*types.MsgBearerPolicyCmdResponse, error) { return e.k.BearerPolicyCmd(ctx, msg) } -func (e *KeeperExecutor) PolicyCmd(ctx *TestCtx, msg *types.MsgPolicyCmd) (*types.MsgPolicyCmdResponse, error) { - return e.k.PolicyCmd(ctx, msg) +func (e *KeeperExecutor) SignedPolicyCmd(ctx *TestCtx, msg *types.MsgSignedPolicyCmd) (*types.MsgSignedPolicyCmdResponse, error) { + return e.k.SignedPolicyCmd(ctx, msg) } func (e *KeeperExecutor) CreatePolicy(ctx *TestCtx, msg *types.MsgCreatePolicy) (*types.MsgCreatePolicyResponse, error) { return e.k.CreatePolicy(ctx, msg) } + +func (e *KeeperExecutor) GetOrCreateAccountFromActor(_ context.Context, actor *TestActor) (sdk.AccountI, error) { + return e.accountCreator.NewAccount(actor.PubKey), nil +} + +func NewExecutor(strategy ExecutorStrategy) (context.Context, MsgExecutor, error) { + switch strategy { + case Keeper: + ctx, exec, err := newKeeperExecutor() + return ctx, exec, err + case SDK: + panic("sdk executor not implemented") + case CLI: + panic("sdk executor not implemented") + default: + return nil, nil, fmt.Errorf("invalid executor strategy: %v", strategy) + } +} + +func newKeeperExecutor() (context.Context, MsgExecutor, error) { + storeKey := storetypes.NewKVStoreKey(types.StoreKey) + + db := dbm.NewMemDB() + stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) + stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) + err := stateStore.LoadLatestVersion() + if err != nil { + return nil, nil, fmt.Errorf("failed to create keeper executor: %v", err) + } + + registry := codectypes.NewInterfaceRegistry() + cdc := codec.NewProtoCodec(registry) + authority := authtypes.NewModuleAddress(govtypes.ModuleName) + + accKeeper := &testutil.AccountKeeperStub{} + accKeeper.GenAccount() + + k := keeper.NewKeeper( + cdc, + runtime.NewKVStoreService(storeKey), + log.NewNopLogger(), + authority.String(), + accKeeper, + ) + + ctx := sdk.NewContext(stateStore, cmtproto.Header{}, false, log.NewNopLogger()) + ctx = ctx.WithEventManager(sdk.NewEventManager()) + + // Initialize params + k.SetParams(ctx, types.DefaultParams()) + + msgServer := keeper.NewMsgServerImpl(k) + executor := &KeeperExecutor{ + k: msgServer, + accountCreator: accKeeper, + } + return ctx, executor, nil +} diff --git a/tests/integration/acp/init.go b/tests/integration/acp/init.go new file mode 100644 index 0000000..2640b3f --- /dev/null +++ b/tests/integration/acp/init.go @@ -0,0 +1,28 @@ +package test + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/sourcenetwork/sourcehub/app" +) + +var initialized bool = false + +func initTest() { + if !initialized { + setPrefix() + initialized = true + } +} + +func setPrefix() { + accountPubKeyPrefix := app.AccountAddressPrefix + "pub" + validatorAddressPrefix := app.AccountAddressPrefix + "valoper" + validatorPubKeyPrefix := app.AccountAddressPrefix + "valoperpub" + consNodeAddressPrefix := app.AccountAddressPrefix + "valcons" + consNodePubKeyPrefix := app.AccountAddressPrefix + "valconspub" + + config := sdk.GetConfig() + config.SetBech32PrefixForAccount(app.AccountAddressPrefix, accountPubKeyPrefix) + config.SetBech32PrefixForValidator(validatorAddressPrefix, validatorPubKeyPrefix) + config.SetBech32PrefixForConsensusNode(consNodeAddressPrefix, consNodePubKeyPrefix) +} diff --git a/tests/integration/acp/suite/object/object_query_owner_test.go b/tests/integration/acp/suite/object/query_owner_test.go similarity index 100% rename from tests/integration/acp/suite/object/object_query_owner_test.go rename to tests/integration/acp/suite/object/query_owner_test.go diff --git a/tests/integration/acp/suite/object/object_register_test.go b/tests/integration/acp/suite/object/register_test.go similarity index 100% rename from tests/integration/acp/suite/object/object_register_test.go rename to tests/integration/acp/suite/object/register_test.go diff --git a/tests/integration/acp/suite/object/object_unregister_test.go b/tests/integration/acp/suite/object/unregister_test.go similarity index 96% rename from tests/integration/acp/suite/object/object_unregister_test.go rename to tests/integration/acp/suite/object/unregister_test.go index b92572c..c8fcf12 100644 --- a/tests/integration/acp/suite/object/object_unregister_test.go +++ b/tests/integration/acp/suite/object/unregister_test.go @@ -113,7 +113,3 @@ func TestUnregisterObject_SendingInvalidPolicyIdErrors(t *testing.T) { } action.Run(ctx) } - -func TestUnregisterObject_UnregisteringObjectRemovesRelationshipsLeavingTheObject(t *testing.T) { - // TODO -} diff --git a/tests/integration/acp/suite/relationship/relationship_delete_test.go b/tests/integration/acp/suite/relationship/delete_test.go similarity index 100% rename from tests/integration/acp/suite/relationship/relationship_delete_test.go rename to tests/integration/acp/suite/relationship/delete_test.go diff --git a/tests/integration/acp/suite/relationship/relationship_filter_test.go b/tests/integration/acp/suite/relationship/filter_test.go similarity index 100% rename from tests/integration/acp/suite/relationship/relationship_filter_test.go rename to tests/integration/acp/suite/relationship/filter_test.go diff --git a/tests/integration/acp/suite/relationship/relationship_set_test.go b/tests/integration/acp/suite/relationship/set_test.go similarity index 85% rename from tests/integration/acp/suite/relationship/relationship_set_test.go rename to tests/integration/acp/suite/relationship/set_test.go index f31a6a7..791ca94 100644 --- a/tests/integration/acp/suite/relationship/relationship_set_test.go +++ b/tests/integration/acp/suite/relationship/set_test.go @@ -147,3 +147,26 @@ func TestSetRelationship_ManagerActorCannotSetRelationshipToRelationshipsTheyDoN } action.Run(ctx) } + +func TestSetRelationship_AdminIsNotAllowedToSetAnOwnerRelationship(t *testing.T) { + ctx := setupSetRel(t) + + // Given object foo and Bob as a admin + bob := ctx.GetActor("bob").DID + a1 := test.SetRelationshipAction{ + PolicyId: ctx.State.PolicyId, + Relationship: types.NewActorRelationship("file", "foo", "admin", bob), + Actor: ctx.GetActor("alice"), + } + a1.Run(ctx) + + // when bob attemps to make himself an owner + // then operation is not authorized + action := test.SetRelationshipAction{ + PolicyId: ctx.State.PolicyId, + Relationship: types.NewActorRelationship("file", "foo", "owner", bob), + Actor: ctx.GetActor("bob"), + ExpectedErr: types.ErrNotAuthorized, + } + action.Run(ctx) +} diff --git a/tests/integration/acp/types.go b/tests/integration/acp/types.go new file mode 100644 index 0000000..896dce4 --- /dev/null +++ b/tests/integration/acp/types.go @@ -0,0 +1,142 @@ +package test + +import ( + "context" + "fmt" + "os" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/sourcenetwork/sourcehub/x/acp/policy_cmd" + "github.com/sourcenetwork/sourcehub/x/acp/types" +) + +const ( + SourceHubAuthStratEnvVar string = "SOURCEHUB_ACP_TEST_AUTH" + SourceHubExecutorEnvVar string = "SOURCEHUB_ACP_TEST_EXECUTOR" + SourceHubActorEnvVar string = "SOURCEHUB_ACP_TEST_ACTOR" +) + +var _ policy_cmd.LogicalClock = (*logicalClockImpl)(nil) + +type logicalClockImpl struct{} + +func (c *logicalClockImpl) GetTimestampNow(context.Context) (uint64, error) { + return 1, nil +} + +type AccountCreator interface { + // GetOrCreateActor retrieves an account from a TestActor's address + // if the account does not exist in the chain, it must be created + // and given credits (if required) + GetOrCreateAccountFromActor(context.Context, *TestActor) (sdk.AccountI, error) +} + +// MsgExecutor represents a component which can execute an ACP Msg and produce a result +type MsgExecutor interface { + AccountCreator + + CreatePolicy(ctx *TestCtx, msg *types.MsgCreatePolicy) (*types.MsgCreatePolicyResponse, error) + BearerPolicyCmd(ctx *TestCtx, msg *types.MsgBearerPolicyCmd) (*types.MsgBearerPolicyCmdResponse, error) + SignedPolicyCmd(ctx *TestCtx, msg *types.MsgSignedPolicyCmd) (*types.MsgSignedPolicyCmdResponse, error) +} + +// AuthenticationStrategy is an enum representing the Authentication format +// which should be used in the tests +type AuthenticationStrategy int + +const ( + // Direct represents authentication done directly thought a Tx/Msg Signer + Direct AuthenticationStrategy = iota + // BearerToken auth uses a Bearer Token to authenticate the actor + BearerToken + // SignedPayload auth uses a SignedPolicyCmd as source of authentication + SignedPayload +) + +var AuthenticationStrategyMap map[string]AuthenticationStrategy = map[string]AuthenticationStrategy{ + //"DIRECT": Direct, + "BEARER": BearerToken, + "SIGNED": SignedPayload, +} + +// ActorKeyType represents the key pair to be used by the system Actors during the test +type ActorKeyType int + +const ( + Actor_ED25519 ActorKeyType = iota + Actor_SECP256K1 +) + +var ActorKeyMap map[string]ActorKeyType = map[string]ActorKeyType{ + "ED25519": Actor_ED25519, + "SECP256K1": Actor_SECP256K1, +} + +// ExecutorStrategy represents the available executors for the test suite +type ExecutorStrategy int + +const ( + // Keeper calls the ACP Keeper directly without going through a consensus engine + Keeper ExecutorStrategy = iota + // CLI invokes SourceHub through the CLI client and broadcasts the Msgs + // to a running instance of SourceHub + CLI + // SDK broadcasts Msgs to a running instance of SourceHub through the SourceHub SDK Client + SDK +) + +var ExecutorStrategyMap map[string]ExecutorStrategy = map[string]ExecutorStrategy{ + "KEEPER": Keeper, + //"CLI": CLI, + //"SDK": SDK, +} + +// TestConfig models how the tests suite will be run +type TestConfig struct { + AuthStrategy AuthenticationStrategy + ExecutorStrategy ExecutorStrategy + ActorType ActorKeyType + //TODO InitialState +} + +func NewDefaultTestConfig() TestConfig { + return TestConfig{ + AuthStrategy: BearerToken, + ExecutorStrategy: Keeper, + ActorType: Actor_ED25519, + } +} + +func MustNewTestConfigFromEnv() TestConfig { + config := NewDefaultTestConfig() + + actor, wasSet := os.LookupEnv(SourceHubActorEnvVar) + if wasSet { + key, found := ActorKeyMap[actor] + if !found { + panic(fmt.Errorf("ActorKey string value not defined: %v", actor)) + } + config.ActorType = key + } + + authStratStr, wasSet := os.LookupEnv(SourceHubAuthStratEnvVar) + if wasSet { + authStrat, found := AuthenticationStrategyMap[authStratStr] + if !found { + panic(fmt.Errorf("AuthenticationStrategy string value not defined: %v", authStratStr)) + } + config.AuthStrategy = authStrat + } + + executorStr, wasSet := os.LookupEnv(SourceHubExecutorEnvVar) + if wasSet { + executor, found := ExecutorStrategyMap[executorStr] + if !found { + panic(fmt.Errorf("ExecutorStrategy string value not defined: %v", executorStr)) + } + config.ExecutorStrategy = executor + } + + return config +} diff --git a/x/acp/bearer_token/parser.go b/x/acp/bearer_token/parser.go index e27d3c3..9caf0f2 100644 --- a/x/acp/bearer_token/parser.go +++ b/x/acp/bearer_token/parser.go @@ -6,7 +6,12 @@ import ( "fmt" "strings" + "github.com/cyware/ssi-sdk/crypto" + "github.com/cyware/ssi-sdk/did/key" + secp "github.com/decred/dcrd/dcrec/secp256k1/v4" "github.com/go-jose/go-jose/v3" + "github.com/lestrrat-go/jwx/v2/jwa" + jwxjws "github.com/lestrrat-go/jwx/v2/jws" "github.com/sourcenetwork/sourcehub/x/acp/did" ) @@ -45,29 +50,33 @@ func parseValidateJWS(ctx context.Context, resolver did.Resolver, bearerJWS stri return BearerToken{}, err } + // currently the ssi-sdk key resolver does not support secp256k1 + // therefore we skip using the did pkg resolver and decode it directly, + // as that does not error. did := bearer.IssuerID - doc, err := resolver.Resolve(ctx, did) + didKey := key.DIDKey(did) + pubBytes, keytype, err := didKey.Decode() if err != nil { return BearerToken{}, fmt.Errorf("failed to resolve actor did: %v: %w", err, ErrInvalidBearerToken) } - // TODO this should technically be Authentication - if len(doc.VerificationMethod) == 0 { - return BearerToken{}, fmt.Errorf("resolved actor did does not contain any verification methods: %w", ErrInvalidBearerToken) - } - method := doc.VerificationMethod[0] - jwkRaw, err := json.Marshal(method.PublicKeyJWK) + pubKey, err := crypto.BytesToPubKey(pubBytes, keytype) if err != nil { - return BearerToken{}, fmt.Errorf("error verifying signature: jwk marshal: %v: %w", err, ErrInvalidBearerToken) + return BearerToken{}, fmt.Errorf("failed to retrieve pub key: %v: %w", err, ErrInvalidBearerToken) } - - jwk := jose.JSONWebKey{} - err = jwk.UnmarshalJSON(jwkRaw) - if err != nil { - return BearerToken{}, fmt.Errorf("error verifying signature: jwk unmarshal: %v: %w", err, ErrInvalidBearerToken) + var algs []jwa.SignatureAlgorithm + if secpKey, ok := pubKey.(secp.PublicKey); ok { + // https://www.rfc-editor.org/rfc/rfc8812 + algs = []jwa.SignatureAlgorithm{jwa.ES256K} + pubKey = secpKey.ToECDSA() + } else { + algs, err = jwxjws.AlgorithmsForKey(pubKey) + if err != nil { + return BearerToken{}, fmt.Errorf("failed to retrieve algs for pub key: %v: %w", err, ErrInvalidBearerToken) + } } - _, err = jws.Verify(jwk) + _, err = jwxjws.Verify([]byte(bearerJWS), jwxjws.WithKey(algs[0], pubKey)) if err != nil { return BearerToken{}, fmt.Errorf("could not verify actor signature for jwk: %v: %w", err, ErrInvalidBearerToken) } diff --git a/x/acp/did/key_test.go b/x/acp/did/key_test.go index 0f06204..f37c3ff 100644 --- a/x/acp/did/key_test.go +++ b/x/acp/did/key_test.go @@ -1,8 +1,35 @@ package did import ( + "context" "testing" + + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" + "github.com/stretchr/testify/require" ) -func TestKeysecp256k1ToDID(t *testing.T) { +func TestSECP256K1ToDIDThenResolve(t *testing.T) { + t.Skip("secp256k1 resolver is currently not supported by the ssi-sdk lib") + priv := secp256k1.GenPrivKey() + pub := priv.PubKey() + + did, err := DIDFromPubKey(pub) + require.NoError(t, err) + + resolver := KeyResolver{} + _, err = resolver.Resolve(context.Background(), did) + require.NoError(t, err) +} + +func TestED25519ToDIDThenResolve(t *testing.T) { + priv := ed25519.GenPrivKey() + pub := priv.PubKey() + + did, err := DIDFromPubKey(pub) + require.NoError(t, err) + + resolver := KeyResolver{} + _, err = resolver.Resolve(context.Background(), did) + require.NoError(t, err) } diff --git a/x/acp/did/types.go b/x/acp/did/types.go index 95ae85a..d05585e 100644 --- a/x/acp/did/types.go +++ b/x/acp/did/types.go @@ -12,7 +12,7 @@ import ( "github.com/cyware/ssi-sdk/crypto" "github.com/cyware/ssi-sdk/did" "github.com/cyware/ssi-sdk/did/key" - didmodel "github.com/hyperledger/aries-framework-go/component/models/did" + "github.com/cyware/ssi-sdk/did/resolution" ) func ExtractVerificationKey(doc DIDDocument) (cryptotypes.PubKey, error) { @@ -27,10 +27,10 @@ type Resolver interface { Resolve(ctx context.Context, did string) (DIDDocument, error) } -func IsValidDID(did string) error { - _, err := didmodel.Parse(did) +func IsValidDID(didStr string) error { + _, err := resolution.GetMethodForDID(didStr) if err != nil { - return fmt.Errorf("did %v: %v", did, err) + return err } return nil } diff --git a/x/acp/keeper/msg_server_policy_cmd_delete_relationship_test.go b/x/acp/keeper/msg_server_policy_cmd_delete_relationship_test.go deleted file mode 100644 index c5e62d8..0000000 --- a/x/acp/keeper/msg_server_policy_cmd_delete_relationship_test.go +++ /dev/null @@ -1,147 +0,0 @@ -package keeper - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/sourcenetwork/sourcehub/x/acp/policy_cmd" - "github.com/sourcenetwork/sourcehub/x/acp/types" -) - -func setupTestPolicyCmdDeleteRelationship(t *testing.T) (ctx sdk.Context, srv types.MsgServer, pol *types.Policy, creator string, alice string, builder policy_cmd.CmdBuilder) { - policy := ` - name: policy - resources: - file: - relations: - owner: - types: - - actor - reader: - types: - - actor - writer: - types: - - actor - admin: - types: - - actor - manages: - - reader - ` - ctx, srv, accKeep := setupMsgServer(t) - creator = accKeep.FirstAcc().GetAddress().String() - - resp, err := srv.CreatePolicy(ctx, &types.MsgCreatePolicy{ - Creator: creator, - CreationTime: timestamp, - Policy: policy, - MarshalType: types.PolicyMarshalingType_SHORT_YAML, - }) - require.Nil(t, err) - pol = resp.Policy - - alice, signer := mustGenerateActor() - - builder = policy_cmd.NewCmdBuilder(&logicalClock, params) - builder.Actor(alice) - builder.PolicyID(pol.Id) - builder.CreationTimestamp(timestamp) - builder.SetSigner(signer) - builder.RegisterObject(types.NewObject("file", "foo")) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - _, err = srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - require.Nil(t, err) - - builder.SetRelationship(types.NewActorRelationship("file", "foo", "reader", alice)) - jws, err = builder.BuildJWS(ctx) - require.Nil(t, err) - _, err = srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - require.Nil(t, err) - - builder.SetRelationship(types.NewActorRelationship("file", "foo", "writer", alice)) - jws, err = builder.BuildJWS(ctx) - require.Nil(t, err) - _, err = srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - require.Nil(t, err) - - builder = policy_cmd.NewCmdBuilder(&logicalClock, params) - builder.Actor(alice) - builder.PolicyID(pol.Id) - builder.CreationTimestamp(timestamp) - builder.SetSigner(signer) - return -} - -func TestPolicyCmd_DeleteRelationship_ObjectOwnerCanRemoveRelationship(t *testing.T) { - ctx, srv, _, creator, alice, builder := setupTestPolicyCmdDeleteRelationship(t) - - builder.DeleteRelationship(types.NewActorRelationship("file", "foo", "reader", alice)) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - resp, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - want := &types.MsgPolicyCmdResponse{ - Result: &types.MsgPolicyCmdResponse_DeleteRelationshipResult{ - DeleteRelationshipResult: &types.DeleteRelationshipCmdResult{ - RecordFound: true, - }, - }, - } - require.Equal(t, want, resp) - require.Nil(t, err) -} - -func TestPolicyCmd_DeleteRelationship_ObjectManagerCanRemoveRelationshipsForRelationTheyManage(t *testing.T) { - ctx, srv, _, creator, alice, builder := setupTestPolicyCmdDeleteRelationship(t) - - // Given Bob as Manager - bob, bobSigner := mustGenerateActor() - builder.SetRelationship(types.NewActorRelationship("file", "foo", "admin", bob)) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - _, err = srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - require.Nil(t, err) - - builder.SetSigner(bobSigner) - builder.Actor(bob) - builder.DeleteRelationship(types.NewActorRelationship("file", "foo", "reader", alice)) - jws, err = builder.BuildJWS(ctx) - require.Nil(t, err) - resp, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - want := &types.MsgPolicyCmdResponse{ - Result: &types.MsgPolicyCmdResponse_DeleteRelationshipResult{ - DeleteRelationshipResult: &types.DeleteRelationshipCmdResult{ - RecordFound: true, - }, - }, - } - require.Equal(t, want, resp) - require.Nil(t, err) -} - -func TestPolicyCmd_DeleteRelationship_ObjectManagerCannotRemoveRelationshipForRelationTheyDontManage(t *testing.T) { - ctx, srv, _, creator, _, builder := setupTestPolicyCmdDeleteRelationship(t) - - // Given Bob as Manager - bob, bobSigner := mustGenerateActor() - builder.SetRelationship(types.NewActorRelationship("file", "foo", "admin", bob)) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - _, err = srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - require.Nil(t, err) - - builder.SetSigner(bobSigner) - builder.Actor(bob) - builder.DeleteRelationship(types.NewActorRelationship("file", "foo", "writer", bob)) - jws, err = builder.BuildJWS(ctx) - require.Nil(t, err) - resp, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - require.Nil(t, resp) - require.ErrorIs(t, err, types.ErrNotAuthorized) -} diff --git a/x/acp/keeper/msg_server_policy_cmd_register_object_test.go b/x/acp/keeper/msg_server_policy_cmd_register_object_test.go deleted file mode 100644 index 486569b..0000000 --- a/x/acp/keeper/msg_server_policy_cmd_register_object_test.go +++ /dev/null @@ -1,280 +0,0 @@ -package keeper - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/sourcenetwork/sourcehub/x/acp/did" - "github.com/sourcenetwork/sourcehub/x/acp/policy_cmd" - "github.com/sourcenetwork/sourcehub/x/acp/testutil" - "github.com/sourcenetwork/sourcehub/x/acp/types" -) - -func setupTestPolicyCmdRegisterObject(t *testing.T) (ctx sdk.Context, srv types.MsgServer, pol *types.Policy, creator string, alice string, builder policy_cmd.CmdBuilder) { - policy := ` - name: policy - resources: - resource: - relations: - owner: - types: - - actor - ` - ctx, srv, accKeep := setupMsgServer(t) - creator = accKeep.FirstAcc().GetAddress().String() - - resp, err := srv.CreatePolicy(ctx, &types.MsgCreatePolicy{ - Creator: creator, - CreationTime: timestamp, - Policy: policy, - MarshalType: types.PolicyMarshalingType_SHORT_YAML, - }) - require.Nil(t, err) - pol = resp.Policy - - alice, signer, err := did.ProduceDID() - require.Nil(t, err) - - builder = policy_cmd.NewCmdBuilder(&logicalClock, params) - builder.Actor(alice) - builder.PolicyID(pol.Id) - builder.CreationTimestamp(timestamp) - builder.SetSigner(signer) - - return -} - -func TestPolicyCmd_RegisterObject_RegisteringNewObjectIsSucessful(t *testing.T) { - ctx, srv, pol, creator, alice, builder := setupTestPolicyCmdRegisterObject(t) - - builder.RegisterObject(types.NewObject("resource", "foo")) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - msg := types.NewMsgPolicyCmdFromJWS(creator, jws) - got, err := srv.PolicyCmd(ctx, msg) - - require.Nil(t, err) - want := &types.MsgPolicyCmdResponse{ - Result: &types.MsgPolicyCmdResponse_RegisterObjectResult{ - RegisterObjectResult: &types.RegisterObjectCmdResult{ - Result: types.RegistrationResult_Registered, - Record: &types.RelationshipRecord{ - CreationTime: timestamp, - Creator: creator, - PolicyId: pol.Id, - Relationship: types.NewActorRelationship("resource", "foo", "owner", alice), - Archived: false, - Actor: alice, - }, - }, - }, - } - require.Equal(t, want, got) - - event := &types.EventObjectRegistered{ - Actor: alice, - PolicyId: pol.Id, - ObjectId: "foo", - ObjectResource: "resource", - } - testutil.AssertEventEmmited(t, ctx, event) -} - -func TestPolicyCmd_RegisterObject_RegisteringObjectRegisteredToAnotherUserErrors(t *testing.T) { - ctx, srv, pol, creator, _, builder := setupTestPolicyCmdRegisterObject(t) - - // Given creator as Owner of foo - msgReg := types.NewMsgRegisterObject(creator, pol.Id, types.NewObject("resource", "foo"), timestamp) - _, err := srv.RegisterObject(ctx, msgReg) - require.Nil(t, err) - - // When alice tries to Register Foo - builder.RegisterObject(types.NewObject("resource", "foo")) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - msg := types.NewMsgPolicyCmdFromJWS(creator, jws) - result, err := srv.PolicyCmd(ctx, msg) - - require.Nil(t, result) - require.ErrorIs(t, err, types.ErrNotAuthorized) -} - -func TestPolicyCmd_RegisterObject_ReregisteringObjectOwnedByUserIsNoop(t *testing.T) { - ctx, srv, pol, creator, alice, builder := setupTestPolicyCmdRegisterObject(t) - - // Given alice as Owner of foo - builder.RegisterObject(types.NewObject("resource", "foo")) - jws, _ := builder.BuildJWS(ctx) - _, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - require.Nil(t, err) - - // When alice tries to reregister Foo - jws, _ = builder.BuildJWS(ctx) - result, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - want := &types.MsgPolicyCmdResponse{ - Result: &types.MsgPolicyCmdResponse_RegisterObjectResult{ - RegisterObjectResult: &types.RegisterObjectCmdResult{ - Result: types.RegistrationResult_NoOp, - Record: &types.RelationshipRecord{ - CreationTime: timestamp, - Creator: creator, - PolicyId: pol.Id, - Relationship: types.NewActorRelationship("resource", "foo", "owner", alice), - Archived: false, - Actor: alice, - }, - }, - }, - } - require.Equal(t, want, result) - require.Nil(t, err) -} - -func TestPolicyCmd_RegisterObject_RegisteringAnotherUsersArchivedObjectErrors(t *testing.T) { - ctx, srv, _, creator, _, builder := setupTestPolicyCmdRegisterObject(t) - - // Given Alice as owner of archived obj foo - builder.RegisterObject(types.NewObject("resource", "foo")) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - _, err = srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - require.Nil(t, err) - builder.UnregisterObject(types.NewObject("resource", "foo")) - jws, _ = builder.BuildJWS(ctx) - _, err = srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - require.Nil(t, err) - - // When Bob attempt to register Foo - bob, bobSigner, err := did.ProduceDID() - require.Nil(t, err) - builder.SetSigner(bobSigner) - builder.Actor(bob) - jws, err = builder.BuildJWS(ctx) - require.Nil(t, err) - resp, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - require.Nil(t, resp) - require.ErrorIs(t, err, types.ErrNotAuthorized) -} - -func TestPolicyCmd_RegisterObject_RegisteringArchivedUserObjectUnarchivesObject(t *testing.T) { - ctx, srv, pol, creator, alice, builder := setupTestPolicyCmdRegisterObject(t) - - // Given Alice as owner of archived obj foo - builder.RegisterObject(types.NewObject("resource", "foo")) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - _, err = srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - require.Nil(t, err) - builder.UnregisterObject(types.NewObject("resource", "foo")) - jws, _ = builder.BuildJWS(ctx) - _, err = srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - require.Nil(t, err) - - // When Alice attempt to reregister Foo - builder.RegisterObject(types.NewObject("resource", "foo")) - jws, err = builder.BuildJWS(ctx) - require.Nil(t, err) - resp, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - want := &types.MsgPolicyCmdResponse{ - Result: &types.MsgPolicyCmdResponse_RegisterObjectResult{ - RegisterObjectResult: &types.RegisterObjectCmdResult{ - Result: types.RegistrationResult_Unarchived, - Record: &types.RelationshipRecord{ - CreationTime: timestamp, - Creator: creator, - PolicyId: pol.Id, - Relationship: types.NewActorRelationship("resource", "foo", "owner", alice), - Archived: false, - Actor: alice, - }, - }, - }, - } - require.Equal(t, want, resp) - require.Nil(t, err) - - event := &types.EventObjectRegistered{ - Actor: alice, - PolicyId: pol.Id, - ObjectId: "foo", - ObjectResource: "resource", - } - testutil.AssertEventEmmited(t, ctx, event) -} - -func TestPolicyCmd_RegisterObject_RegisteringObjectInAnUndefinedResourceErrors(t *testing.T) { - ctx, srv, _, creator, _, builder := setupTestPolicyCmdRegisterObject(t) - - builder.RegisterObject(types.NewObject("some-undefined-resource", "foo")) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - got, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - require.Nil(t, got) - require.NotNil(t, err) // Error should be issue by Zanzi, the internal error codes aren't stable yet -} - -func TestPolicyCmd_RegisterObject_CreatorWithInvalidDID(t *testing.T) { - ctx, srv, pol, creator, _, builder := setupTestPolicyCmdRegisterObject(t) - - payload := types.PolicyCmdPayload{ - Actor: "some invalid did", - CreationTime: timestamp, - IssuedHeight: 100, - ExpirationDelta: 10, - PolicyId: pol.Id, - Cmd: &types.PolicyCmdPayload_RegisterObjectCmd{ - RegisterObjectCmd: &types.RegisterObjectCmd{ - Object: types.NewObject("resource", "foo"), - }, - }, - } - jws, err := policy_cmd.SignPayload(payload, builder.GetSigner()) - require.Nil(t, err) - got, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - require.Nil(t, got) - require.NotNil(t, err) -} - -func TestPolicyCmd_RegisterObject_RegisteringToUnknownPolicyReturnsError(t *testing.T) { - ctx, srv, _, creator, _, builder := setupTestPolicyCmdRegisterObject(t) - - builder.PolicyID("bae123456") - builder.RegisterObject(types.NewObject("resource", "foo")) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - got, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - require.Nil(t, got) - require.ErrorIs(t, err, types.ErrPolicyNotFound) -} - -func TestPolicyCmd_RegisterObject_BlankResourceErrors(t *testing.T) { - ctx, srv, _, creator, _, builder := setupTestPolicyCmdRegisterObject(t) - - builder.RegisterObject(types.NewObject("", "obj")) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - got, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - require.Nil(t, got) - require.NotNil(t, err) -} - -func TestPolicyCmd_RegisterObject_BlankObjectIdErrors(t *testing.T) { - ctx, srv, _, creator, _, builder := setupTestPolicyCmdRegisterObject(t) - - builder.RegisterObject(types.NewObject("resource", "")) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - got, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - require.Nil(t, got) - require.NotNil(t, err) -} diff --git a/x/acp/keeper/msg_server_policy_cmd_set_relationship_test.go b/x/acp/keeper/msg_server_policy_cmd_set_relationship_test.go deleted file mode 100644 index 341c4c4..0000000 --- a/x/acp/keeper/msg_server_policy_cmd_set_relationship_test.go +++ /dev/null @@ -1,195 +0,0 @@ -package keeper - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/sourcenetwork/sourcehub/x/acp/policy_cmd" - "github.com/sourcenetwork/sourcehub/x/acp/types" -) - -func setupTestPolicyCmdSetRelationship(t *testing.T) (ctx sdk.Context, srv types.MsgServer, pol *types.Policy, creator string, alice string, builder policy_cmd.CmdBuilder) { - policy := ` - name: policy - resources: - file: - relations: - owner: - types: - - actor - admin: - manages: - - reader - types: - - actor - reader: - types: - - actor - ` - ctx, srv, accKeep := setupMsgServer(t) - creator = accKeep.FirstAcc().GetAddress().String() - - resp, err := srv.CreatePolicy(ctx, &types.MsgCreatePolicy{ - Creator: creator, - CreationTime: timestamp, - Policy: policy, - MarshalType: types.PolicyMarshalingType_SHORT_YAML, - }) - require.Nil(t, err) - pol = resp.Policy - - alice, signer := mustGenerateActor() - - builder = policy_cmd.NewCmdBuilder(&logicalClock, params) - builder.Actor(alice) - builder.PolicyID(pol.Id) - builder.CreationTimestamp(timestamp) - builder.SetSigner(signer) - builder.RegisterObject(types.NewObject("file", "foo")) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - _, err = srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - require.Nil(t, err) - - builder = policy_cmd.NewCmdBuilder(&logicalClock, params) - builder.Actor(alice) - builder.PolicyID(pol.Id) - builder.CreationTimestamp(timestamp) - builder.SetSigner(signer) - return -} - -func TestPolicyCmd_SetRelationship_OwnerCanSetRelationshipForObjectTheyOwn(t *testing.T) { - ctx, srv, pol, creator, alice, builder := setupTestPolicyCmdSetRelationship(t) - - builder.SetRelationship(types.NewActorRelationship("file", "foo", "reader", alice)) - jws, _ := builder.BuildJWS(ctx) - got, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - want := &types.MsgPolicyCmdResponse{ - Result: &types.MsgPolicyCmdResponse_SetRelationshipResult{ - SetRelationshipResult: &types.SetRelationshipCmdResult{ - RecordExisted: false, - Record: &types.RelationshipRecord{ - Actor: alice, - CreationTime: timestamp, - Creator: creator, - PolicyId: pol.Id, - Relationship: types.NewActorRelationship("file", "foo", "reader", alice), - Archived: false, - }, - }, - }, - } - require.Nil(t, err) - require.Equal(t, want, got) -} - -func TestPolicyCmd_SetRelationship_ActorCannotSetRelationshipForUnregisteredObject(t *testing.T) { - ctx, srv, _, creator, alice, builder := setupTestPolicyCmdSetRelationship(t) - - builder.SetRelationship(types.NewActorRelationship("file", "does-not-exist", "reader", alice)) - jws, _ := builder.BuildJWS(ctx) - got, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - require.Nil(t, got) - require.ErrorIs(t, err, types.ErrObjectNotFound) -} - -func TestPolicyCmd_SetRelationship_ActorCannotSetRelationshipForObjectTheyDoNotOwn(t *testing.T) { - ctx, srv, _, creator, _, builder := setupTestPolicyCmdSetRelationship(t) - - bob, bobSigner := mustGenerateActor() - builder.Actor(bob) - builder.SetSigner(bobSigner) - builder.SetRelationship(types.NewActorRelationship("file", "foo", "reader", bob)) - jws, _ := builder.BuildJWS(ctx) - got, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - require.Nil(t, got) - require.ErrorIs(t, err, types.ErrNotAuthorized) -} - -func TestPolicyCmd_SetRelationship_ManagerActorCanSetRelationshipForARelationTheyManage(t *testing.T) { - ctx, srv, pol, creator, _, builder := setupTestPolicyCmdSetRelationship(t) - - // Given object foo and Bob as a manager - bob, bobSigner := mustGenerateActor() - builder.SetRelationship(types.NewActorRelationship("file", "foo", "admin", bob)) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - _, err = srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - require.Nil(t, err) - - // When Bob tries to create a relationship to rel they manage - builder.SetSigner(bobSigner) - builder.Actor(bob) - builder.SetRelationship(types.NewActorRelationship("file", "foo", "reader", bob)) - jws, err = builder.BuildJWS(ctx) - require.Nil(t, err) - got, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - want := &types.MsgPolicyCmdResponse{ - Result: &types.MsgPolicyCmdResponse_SetRelationshipResult{ - SetRelationshipResult: &types.SetRelationshipCmdResult{ - RecordExisted: false, - Record: &types.RelationshipRecord{ - Actor: bob, - CreationTime: timestamp, - Creator: creator, - PolicyId: pol.Id, - Relationship: types.NewActorRelationship("file", "foo", "reader", bob), - Archived: false, - }, - }, - }, - } - require.Equal(t, want, got) - require.Nil(t, err) -} - -func TestPolicyCmd_SetRelationship_ManagerActorCannotSetRelationshipToRelationTheyDoNotManage(t *testing.T) { - ctx, srv, _, creator, _, builder := setupTestPolicyCmdSetRelationship(t) - - // Given object foo and Bob as a manager - bob, bobSigner := mustGenerateActor() - builder.SetRelationship(types.NewActorRelationship("file", "foo", "admin", bob)) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - _, err = srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - require.Nil(t, err) - - builder.Actor(bob) - builder.SetSigner(bobSigner) - builder.SetRelationship(types.NewActorRelationship("file", "foo", "admin", bob)) - jws, err = builder.BuildJWS(ctx) - require.Nil(t, err) - got, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - require.Nil(t, got) - require.ErrorIs(t, err, types.ErrNotAuthorized) -} - -func TestPolicyCmd_SetRelationship_ActorIsNotAllowedToSetAnOwnerRelationshipDirectly(t *testing.T) { - ctx, srv, _, creator, _, builder := setupTestPolicyCmdSetRelationship(t) - - // Given object foo anp Bob as a manager - bob, bobSigner := mustGenerateActor() - builder.SetRelationship(types.NewActorRelationship("file", "foo", "admin", bob)) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - _, err = srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - require.Nil(t, err) - - builder.Actor(bob) - builder.SetSigner(bobSigner) - builder.SetRelationship(types.NewActorRelationship("file", "foo", "owner", bob)) - jws, err = builder.BuildJWS(ctx) - require.Nil(t, err) - got, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - require.Nil(t, got) - require.ErrorIs(t, err, types.ErrAcpProtocolViolation) -} diff --git a/x/acp/keeper/msg_server_policy_cmd_unregister_object_test.go b/x/acp/keeper/msg_server_policy_cmd_unregister_object_test.go deleted file mode 100644 index 5b732a1..0000000 --- a/x/acp/keeper/msg_server_policy_cmd_unregister_object_test.go +++ /dev/null @@ -1,149 +0,0 @@ -package keeper - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/sourcenetwork/sourcehub/x/acp/policy_cmd" - "github.com/sourcenetwork/sourcehub/x/acp/types" -) - -func setupTestPolicyCmdUnregisterObject(t *testing.T) (ctx sdk.Context, srv types.MsgServer, pol *types.Policy, creator string, alice string, builder policy_cmd.CmdBuilder) { - policy := ` - name: policy - resources: - file: - relations: - owner: - types: - - actor - reader: - types: - - actor - ` - ctx, srv, accKeep := setupMsgServer(t) - creator = accKeep.FirstAcc().GetAddress().String() - - resp, err := srv.CreatePolicy(ctx, &types.MsgCreatePolicy{ - Creator: creator, - CreationTime: timestamp, - Policy: policy, - MarshalType: types.PolicyMarshalingType_SHORT_YAML, - }) - require.Nil(t, err) - pol = resp.Policy - - alice, signer := mustGenerateActor() - - builder = policy_cmd.NewCmdBuilder(&logicalClock, params) - builder.Actor(alice) - builder.PolicyID(pol.Id) - builder.CreationTimestamp(timestamp) - builder.SetSigner(signer) - builder.RegisterObject(types.NewObject("file", "foo")) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - _, err = srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - require.Nil(t, err) - - builder.SetRelationship(types.NewActorRelationship("file", "foo", "reader", alice)) - jws, err = builder.BuildJWS(ctx) - require.Nil(t, err) - _, err = srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - require.Nil(t, err) - - builder = policy_cmd.NewCmdBuilder(&logicalClock, params) - builder.Actor(alice) - builder.PolicyID(pol.Id) - builder.CreationTimestamp(timestamp) - builder.SetSigner(signer) - return -} - -func TestPolicyCmd_UnregisterObject_RegisteredObjectCanBeUnregisteredByAuthor(t *testing.T) { - ctx, srv, _, creator, _, builder := setupTestPolicyCmdUnregisterObject(t) - - builder.UnregisterObject(types.NewObject("file", "foo")) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - resp, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - want := &types.MsgPolicyCmdResponse{ - Result: &types.MsgPolicyCmdResponse_UnregisterObjectResult{ - UnregisterObjectResult: &types.UnregisterObjectCmdResult{ - Found: true, - RelationshipsRemoved: 2, - }, - }, - } - require.Equal(t, want, resp) - require.Nil(t, err) -} - -func TestPolicyCmd_UnregisterObject_ActorCannotUnregisterObjectTheyDoNotOwn(t *testing.T) { - ctx, srv, _, creator, _, builder := setupTestPolicyCmdUnregisterObject(t) - - bob, bobSigner := mustGenerateActor() - builder.UnregisterObject(types.NewObject("file", "foo")) - builder.Actor(bob) - builder.SetSigner(bobSigner) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - resp, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - require.Nil(t, resp) - require.ErrorIs(t, err, types.ErrNotAuthorized) -} - -func TestPolicyCmd_UnregisterObject_UnregisteringAnObjectThatDoesNotExistReturnsUnauthorized(t *testing.T) { - ctx, srv, _, creator, _, builder := setupTestPolicyCmdUnregisterObject(t) - - builder.UnregisterObject(types.NewObject("file", "file-that-isnt-registered")) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - resp, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - require.Nil(t, resp) - require.ErrorIs(t, err, types.ErrNotAuthorized) -} - -func TestPolicyCmd_UnregisterObject_UnregisteringAnAlreadyArchivedObjectIsANoop(t *testing.T) { - ctx, srv, _, creator, _, builder := setupTestPolicyCmdUnregisterObject(t) - - // Given an Archived Object - builder.UnregisterObject(types.NewObject("file", "foo")) - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - _, err = srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - require.Nil(t, err) - - // When the Creator Unregisters it - builder.UnregisterObject(types.NewObject("file", "foo")) - jws, _ = builder.BuildJWS(ctx) - resp, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - want := &types.MsgPolicyCmdResponse{ - Result: &types.MsgPolicyCmdResponse_UnregisterObjectResult{ - UnregisterObjectResult: &types.UnregisterObjectCmdResult{ - Found: true, - }, - }, - } - require.Equal(t, want, resp) - require.Nil(t, err) -} - -func TestPolicyCmd_UnregisterObject_SendingInvalidPolicyIdErrors(t *testing.T) { - ctx, srv, _, creator, _, builder := setupTestPolicyCmdUnregisterObject(t) - - builder.UnregisterObject(types.NewObject("file", "foo")) - builder.PolicyID("abc12345") - jws, err := builder.BuildJWS(ctx) - require.Nil(t, err) - resp, err := srv.PolicyCmd(ctx, types.NewMsgPolicyCmdFromJWS(creator, jws)) - - require.Nil(t, resp) - require.ErrorIs(t, err, types.ErrPolicyNotFound) -} diff --git a/x/acp/keeper/msg_server_policy_cmd.go b/x/acp/keeper/msg_server_signed_policy_cmd.go similarity index 82% rename from x/acp/keeper/msg_server_policy_cmd.go rename to x/acp/keeper/msg_server_signed_policy_cmd.go index 602c3ce..d079da6 100644 --- a/x/acp/keeper/msg_server_policy_cmd.go +++ b/x/acp/keeper/msg_server_signed_policy_cmd.go @@ -13,7 +13,7 @@ import ( "github.com/sourcenetwork/sourcehub/x/acp/types" ) -func (k msgServer) PolicyCmd(goCtx context.Context, msg *types.MsgPolicyCmd) (*types.MsgPolicyCmdResponse, error) { +func (k msgServer) SignedPolicyCmd(goCtx context.Context, msg *types.MsgSignedPolicyCmd) (*types.MsgSignedPolicyCmdResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) engine, err := k.GetZanziEngine(ctx) if err != nil { @@ -38,11 +38,11 @@ func (k msgServer) PolicyCmd(goCtx context.Context, msg *types.MsgPolicyCmd) (*t return nil, fmt.Errorf("PolcyCmd: policy %v: %w", payload.PolicyId, types.ErrPolicyNotFound) } - result := &types.MsgPolicyCmdResponse{} + result := &types.PolicyCmdResult{} policy := rec.Policy - switch c := payload.Cmd.(type) { - case *types.PolicyCmdPayload_SetRelationshipCmd: + switch c := payload.Cmd.Cmd.(type) { + case *types.PolicyCmd_SetRelationshipCmd: var found auth_engine.RecordFound var record *types.RelationshipRecord @@ -59,13 +59,13 @@ func (k msgServer) PolicyCmd(goCtx context.Context, msg *types.MsgPolicyCmd) (*t break } - result.Result = &types.MsgPolicyCmdResponse_SetRelationshipResult{ + result.Result = &types.PolicyCmdResult_SetRelationshipResult{ SetRelationshipResult: &types.SetRelationshipCmdResult{ RecordExisted: bool(found), Record: record, }, } - case *types.PolicyCmdPayload_DeleteRelationshipCmd: + case *types.PolicyCmd_DeleteRelationshipCmd: var found auth_engine.RecordFound cmd := relationship.DeleteRelationshipCommand{ @@ -79,12 +79,12 @@ func (k msgServer) PolicyCmd(goCtx context.Context, msg *types.MsgPolicyCmd) (*t break } - result.Result = &types.MsgPolicyCmdResponse_DeleteRelationshipResult{ + result.Result = &types.PolicyCmdResult_DeleteRelationshipResult{ DeleteRelationshipResult: &types.DeleteRelationshipCmdResult{ RecordFound: bool(found), }, } - case *types.PolicyCmdPayload_RegisterObjectCmd: + case *types.PolicyCmd_RegisterObjectCmd: var registrationResult types.RegistrationResult var record *types.RelationshipRecord @@ -105,13 +105,13 @@ func (k msgServer) PolicyCmd(goCtx context.Context, msg *types.MsgPolicyCmd) (*t break } - result.Result = &types.MsgPolicyCmdResponse_RegisterObjectResult{ + result.Result = &types.PolicyCmdResult_RegisterObjectResult{ RegisterObjectResult: &types.RegisterObjectCmdResult{ Result: registrationResult, Record: record, }, } - case *types.PolicyCmdPayload_UnregisterObjectCmd: + case *types.PolicyCmd_UnregisterObjectCmd: var count uint cmd := relationship.UnregisterObjectCommand{ @@ -125,7 +125,7 @@ func (k msgServer) PolicyCmd(goCtx context.Context, msg *types.MsgPolicyCmd) (*t break } - result.Result = &types.MsgPolicyCmdResponse_UnregisterObjectResult{ + result.Result = &types.PolicyCmdResult_UnregisterObjectResult{ UnregisterObjectResult: &types.UnregisterObjectCmdResult{ Found: true, //TODO true, RelationshipsRemoved: uint64(count), @@ -141,5 +141,7 @@ func (k msgServer) PolicyCmd(goCtx context.Context, msg *types.MsgPolicyCmd) (*t } - return result, nil + return &types.MsgSignedPolicyCmdResponse{ + Result: result, + }, nil } diff --git a/x/acp/policy_cmd/builder.go b/x/acp/policy_cmd/builder.go index f8d4b43..770ecd8 100644 --- a/x/acp/policy_cmd/builder.go +++ b/x/acp/policy_cmd/builder.go @@ -24,7 +24,7 @@ func NewCmdBuilder(clock LogicalClock, params types.Params) CmdBuilder { // CmdBuilder builds PolicyCmdPayloads type CmdBuilder struct { clock LogicalClock - cmd types.PolicyCmdPayload + cmd types.SignedPolicyCmdPayload params types.Params cmdErr error signer crypto.Signer @@ -54,11 +54,11 @@ func (b *CmdBuilder) GetSigner() crypto.Signer { return b.signer } -// Build validates the data provided to the Builder, validates it and returns a PolicyCmdPayload or an error. -func (b *CmdBuilder) Build(ctx context.Context) (types.PolicyCmdPayload, error) { +// Build validates the data provided to the Builder, validates it and returns a SignedPolicyCmdPayload or an error. +func (b *CmdBuilder) Build(ctx context.Context) (types.SignedPolicyCmdPayload, error) { height, err := b.clock.GetTimestampNow(ctx) if err != nil { - return types.PolicyCmdPayload{}, fmt.Errorf("cmdBuilder: timestamp failed: %v", err) + return types.SignedPolicyCmdPayload{}, fmt.Errorf("cmdBuilder: timestamp failed: %v", err) } b.cmd.IssuedHeight = height @@ -72,24 +72,24 @@ func (b *CmdBuilder) Build(ctx context.Context) (types.PolicyCmdPayload, error) } if b.cmd.PolicyId == "" { - return types.PolicyCmdPayload{}, fmt.Errorf("cmdBuilder: policy id: %w", ErrBuilderMissingArgument) + return types.SignedPolicyCmdPayload{}, fmt.Errorf("cmdBuilder: policy id: %w", ErrBuilderMissingArgument) } if b.cmd.ExpirationDelta > b.params.PolicyCommandMaxExpirationDelta { - return types.PolicyCmdPayload{}, fmt.Errorf("cmdBuilder: %v", ErrExpirationDeltaTooLarge) + return types.SignedPolicyCmdPayload{}, fmt.Errorf("cmdBuilder: %v", ErrExpirationDeltaTooLarge) } if err := did.IsValidDID(b.cmd.Actor); err != nil { - return types.PolicyCmdPayload{}, fmt.Errorf("cmdBuilder: invalid actor: %v", err) + return types.SignedPolicyCmdPayload{}, fmt.Errorf("cmdBuilder: invalid actor: %v", err) } if b.cmd.Cmd == nil { - return types.PolicyCmdPayload{}, fmt.Errorf("cmdBuilder: Command not specified: %v", ErrBuilderMissingArgument) + return types.SignedPolicyCmdPayload{}, fmt.Errorf("cmdBuilder: Command not specified: %v", ErrBuilderMissingArgument) } if b.cmdErr != nil { // TODO validate commands - return types.PolicyCmdPayload{}, fmt.Errorf("cmdBuilder: Command invalid: %v", b.cmdErr) + return types.SignedPolicyCmdPayload{}, fmt.Errorf("cmdBuilder: Command invalid: %v", b.cmdErr) } return b.cmd, nil @@ -117,42 +117,26 @@ func (b *CmdBuilder) PolicyID(id string) { // SetRelationship builds a Payload for a SetRelationship command func (b *CmdBuilder) SetRelationship(relationship *types.Relationship) { - b.cmd.Cmd = &types.PolicyCmdPayload_SetRelationshipCmd{ - SetRelationshipCmd: &types.SetRelationshipCmd{ - Relationship: relationship, - }, - } + b.cmd.Cmd = types.NewSetRelationshipCmd(relationship) } // DeleteRelationship builds a Payload for a DeleteRelationship command func (b *CmdBuilder) DeleteRelationship(relationship *types.Relationship) { - b.cmd.Cmd = &types.PolicyCmdPayload_DeleteRelationshipCmd{ - DeleteRelationshipCmd: &types.DeleteRelationshipCmd{ - Relationship: relationship, - }, - } + b.cmd.Cmd = types.NewDeleteRelationshipCmd(relationship) } // RegisterObject builds a Payload for a RegisterObject command func (b *CmdBuilder) RegisterObject(obj *types.Object) { - b.cmd.Cmd = &types.PolicyCmdPayload_RegisterObjectCmd{ - RegisterObjectCmd: &types.RegisterObjectCmd{ - Object: obj, - }, - } + b.cmd.Cmd = types.NewRegisterObjectCmd(obj) } // UnregisterObject builds a Payload for a UnregisterObject command func (b *CmdBuilder) UnregisterObject(obj *types.Object) { - b.cmd.Cmd = &types.PolicyCmdPayload_UnregisterObjectCmd{ - UnregisterObjectCmd: &types.UnregisterObjectCmd{ - Object: obj, - }, - } + b.cmd.Cmd = types.NewUnregisterObjectCmd(obj) } // SignPayload produces a JWS serialized version of a Payload from a signing key -func SignPayload(cmd types.PolicyCmdPayload, skey crypto.Signer) (string, error) { +func SignPayload(cmd types.SignedPolicyCmdPayload, skey crypto.Signer) (string, error) { marshaler := jsonpb.Marshaler{} payload, err := marshaler.MarshalToString(&cmd) if err != nil { diff --git a/x/acp/policy_cmd/jws.go b/x/acp/policy_cmd/jws.go index ea86b22..b255dff 100644 --- a/x/acp/policy_cmd/jws.go +++ b/x/acp/policy_cmd/jws.go @@ -2,11 +2,15 @@ package policy_cmd import ( "context" - "encoding/json" "fmt" "github.com/cosmos/gogoproto/jsonpb" + "github.com/cyware/ssi-sdk/crypto" + "github.com/cyware/ssi-sdk/did/key" + secp "github.com/decred/dcrd/dcrec/secp256k1/v4" "github.com/go-jose/go-jose/v3" + "github.com/lestrrat-go/jwx/v2/jwa" + jwxjws "github.com/lestrrat-go/jwx/v2/jws" "github.com/sourcenetwork/sourcehub/x/acp/did" "github.com/sourcenetwork/sourcehub/x/acp/types" @@ -29,42 +33,47 @@ type jwsVerifier struct { // The JOSE header attributes are ignored and only the key derived from the Actor DID is accepted. // This is done to assure no impersonation happens by thinkering the JOSE header in order to produce a valid // JWS, signed by key different than that of the DID owner. -func (s *jwsVerifier) Verify(ctx context.Context, jwsStr string) (*types.PolicyCmdPayload, error) { +func (s *jwsVerifier) Verify(ctx context.Context, jwsStr string) (*types.SignedPolicyCmdPayload, error) { jws, err := jose.ParseSigned(jwsStr) if err != nil { return nil, fmt.Errorf("failed parsing jws: %v", err) } payloadBytes := jws.UnsafePayloadWithoutVerification() - payload := &types.PolicyCmdPayload{} + payload := &types.SignedPolicyCmdPayload{} err = jsonpb.UnmarshalString(string(payloadBytes), payload) if err != nil { return nil, fmt.Errorf("failed unmarshaling PolcyCmd payload: %v", err) } did := payload.Actor - doc, err := s.resolver.Resolve(ctx, did) + // currently the ssi-sdk key resolver does not support secp256k1 + // therefore we skip using the did pkg resolver and decode it directly, + // as that does not error. + didKey := key.DIDKey(did) + pubBytes, keytype, err := didKey.Decode() if err != nil { return nil, fmt.Errorf("failed to resolve actor did: %v", err) } - // TODO this should technically be Authentication - if len(doc.VerificationMethod) == 0 { - return nil, fmt.Errorf("resolved actor did does not contain any verification methods") - } - method := doc.VerificationMethod[0] - jwkRaw, err := json.Marshal(method.PublicKeyJWK) + pubKey, err := crypto.BytesToPubKey(pubBytes, keytype) if err != nil { - return nil, fmt.Errorf("error verifying signature: jwk marshal: %v", err) + return nil, fmt.Errorf("failed to retrieve pub key: %v", err) } - jwk := jose.JSONWebKey{} - err = jwk.UnmarshalJSON(jwkRaw) - if err != nil { - return nil, fmt.Errorf("error verifying signature: jwk unmarshal: %v", err) + var algs []jwa.SignatureAlgorithm + if secpKey, ok := pubKey.(secp.PublicKey); ok { + // https://www.rfc-editor.org/rfc/rfc8812 + algs = []jwa.SignatureAlgorithm{jwa.ES256K} + pubKey = secpKey.ToECDSA() + } else { + algs, err = jwxjws.AlgorithmsForKey(pubKey) + if err != nil { + return nil, fmt.Errorf("failed to retrieve algs for pub key: %v", err) + } } - _, err = jws.Verify(jwk) + _, err = jwxjws.Verify([]byte(jwsStr), jwxjws.WithKey(algs[0], pubKey)) if err != nil { return nil, fmt.Errorf("could not verify actor signature for jwk: %v", err) } diff --git a/x/acp/policy_cmd/spec.go b/x/acp/policy_cmd/spec.go index fc74fe6..701890f 100644 --- a/x/acp/policy_cmd/spec.go +++ b/x/acp/policy_cmd/spec.go @@ -9,7 +9,7 @@ import ( ) // payloadSpec executes validation against a PolicyCmdPayload to ensure it should be accepted -func payloadSpec(params types.Params, currentHeight uint64, payload *types.PolicyCmdPayload) error { +func payloadSpec(params types.Params, currentHeight uint64, payload *types.SignedPolicyCmdPayload) error { if payload.ExpirationDelta > params.PolicyCommandMaxExpirationDelta { return fmt.Errorf("%w: max %v, given %v", ErrExpirationDeltaTooLarge, params.PolicyCommandMaxExpirationDelta, payload.ExpirationDelta) } @@ -24,12 +24,12 @@ func payloadSpec(params types.Params, currentHeight uint64, payload *types.Polic } // ValidateAndExtractCmd validates a MsgPolicyCmd and return the Cmd payload -func ValidateAndExtractCmd(ctx context.Context, params types.Params, resolver did.Resolver, payload string, contentType types.MsgPolicyCmd_ContentType, currentHeight uint64) (*types.PolicyCmdPayload, error) { - var cmd *types.PolicyCmdPayload +func ValidateAndExtractCmd(ctx context.Context, params types.Params, resolver did.Resolver, payload string, contentType types.MsgSignedPolicyCmd_ContentType, currentHeight uint64) (*types.SignedPolicyCmdPayload, error) { + var cmd *types.SignedPolicyCmdPayload var err error switch contentType { - case types.MsgPolicyCmd_JWS: + case types.MsgSignedPolicyCmd_JWS: verifier := newJWSVerifier(resolver) cmd, err = verifier.Verify(ctx, payload) default: diff --git a/x/acp/simulation/policy_cmd.go b/x/acp/simulation/policy_cmd.go index ec2add4..29d1454 100644 --- a/x/acp/simulation/policy_cmd.go +++ b/x/acp/simulation/policy_cmd.go @@ -18,7 +18,7 @@ func SimulateMsgPolicyCmd( return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { simAccount, _ := simtypes.RandomAcc(r, accs) - msg := &types.MsgPolicyCmd{ + msg := &types.MsgSignedPolicyCmd{ Creator: simAccount.Address.String(), } diff --git a/x/acp/types/codec.go b/x/acp/types/codec.go index e7996d0..46d5040 100644 --- a/x/acp/types/codec.go +++ b/x/acp/types/codec.go @@ -27,7 +27,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgCheckAccess{}, ) registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgPolicyCmd{}, + &MsgSignedPolicyCmd{}, ) registry.RegisterImplementations((*sdk.Msg)(nil), &MsgBearerPolicyCmd{}, diff --git a/x/acp/types/message_policy_cmd.go b/x/acp/types/message_policy_cmd.go index ce9411f..ed5c22b 100644 --- a/x/acp/types/message_policy_cmd.go +++ b/x/acp/types/message_policy_cmd.go @@ -6,25 +6,25 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) -var _ sdk.Msg = &MsgPolicyCmd{} +var _ sdk.Msg = &MsgSignedPolicyCmd{} -func NewMsgPolicyCmd(creator string, payload string, contentType MsgPolicyCmd_ContentType) *MsgPolicyCmd { - return &MsgPolicyCmd{ +func NewMsgPolicyCmd(creator string, payload string, contentType MsgSignedPolicyCmd_ContentType) *MsgSignedPolicyCmd { + return &MsgSignedPolicyCmd{ Creator: creator, Payload: payload, Type: contentType, } } -func NewMsgPolicyCmdFromJWS(creator string, jws string) *MsgPolicyCmd { - return &MsgPolicyCmd{ +func NewMsgPolicyCmdFromJWS(creator string, jws string) *MsgSignedPolicyCmd { + return &MsgSignedPolicyCmd{ Creator: creator, - Type: MsgPolicyCmd_JWS, + Type: MsgSignedPolicyCmd_JWS, Payload: jws, } } -func (msg *MsgPolicyCmd) ValidateBasic() error { +func (msg *MsgSignedPolicyCmd) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) diff --git a/x/acp/types/message_policy_cmd_test.go b/x/acp/types/message_policy_cmd_test.go index 5bce700..7bfd508 100644 --- a/x/acp/types/message_policy_cmd_test.go +++ b/x/acp/types/message_policy_cmd_test.go @@ -11,18 +11,18 @@ import ( func TestMsgPolicyCmd_ValidateBasic(t *testing.T) { tests := []struct { name string - msg MsgPolicyCmd + msg MsgSignedPolicyCmd err error }{ { name: "invalid address", - msg: MsgPolicyCmd{ + msg: MsgSignedPolicyCmd{ Creator: "invalid_address", }, err: sdkerrors.ErrInvalidAddress, }, { name: "valid address", - msg: MsgPolicyCmd{ + msg: MsgSignedPolicyCmd{ Creator: sample.AccAddress(), }, }, diff --git a/x/acp/types/policy_cmd.pb.go b/x/acp/types/policy_cmd.pb.go index d171b18..228bdcb 100644 --- a/x/acp/types/policy_cmd.pb.go +++ b/x/acp/types/policy_cmd.pb.go @@ -28,7 +28,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // The message type contains a signature which is used to authenticate the Command's Actor type SignedPolicyCmd struct { // payload contains the command context - Payload *PolicyCmdPayload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + Payload *SignedPolicyCmdPayload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` // signature is a signature of the payload. // The signature is generated using the VerificationMethod / Authorization fields // specificied by the DID document of the Actor. @@ -68,7 +68,7 @@ func (m *SignedPolicyCmd) XXX_DiscardUnknown() { var xxx_messageInfo_SignedPolicyCmd proto.InternalMessageInfo -func (m *SignedPolicyCmd) GetPayload() *PolicyCmdPayload { +func (m *SignedPolicyCmd) GetPayload() *SignedPolicyCmdPayload { if m != nil { return m.Payload } @@ -82,8 +82,8 @@ func (m *SignedPolicyCmd) GetSignature() []byte { return nil } -// PolicyCmdPayload represents the payload containing the context of the issued command -type PolicyCmdPayload struct { +// SignedPolicyCmdPayload represents the payload containing the context of the issued command +type SignedPolicyCmdPayload struct { // actor is a did string representing the actor which issued the command Actor string `protobuf:"bytes,1,opt,name=actor,proto3" json:"actor,omitempty"` // issued_height is the SourceHub block height of when the Payload was created @@ -95,27 +95,22 @@ type PolicyCmdPayload struct { // This is used only as metadata and isn't trusted CreationTime *types.Timestamp `protobuf:"bytes,4,opt,name=creation_time,json=creationTime,proto3" json:"creation_time,omitempty"` // policy_id is the ID of the policy under which the Command will be executed - PolicyId string `protobuf:"bytes,5,opt,name=policy_id,json=policyId,proto3" json:"policy_id,omitempty"` - // Types that are valid to be assigned to Cmd: - // *PolicyCmdPayload_SetRelationshipCmd - // *PolicyCmdPayload_DeleteRelationshipCmd - // *PolicyCmdPayload_RegisterObjectCmd - // *PolicyCmdPayload_UnregisterObjectCmd - Cmd isPolicyCmdPayload_Cmd `protobuf_oneof:"cmd"` + PolicyId string `protobuf:"bytes,5,opt,name=policy_id,json=policyId,proto3" json:"policy_id,omitempty"` + Cmd *PolicyCmd `protobuf:"bytes,6,opt,name=cmd,proto3" json:"cmd,omitempty"` } -func (m *PolicyCmdPayload) Reset() { *m = PolicyCmdPayload{} } -func (m *PolicyCmdPayload) String() string { return proto.CompactTextString(m) } -func (*PolicyCmdPayload) ProtoMessage() {} -func (*PolicyCmdPayload) Descriptor() ([]byte, []int) { +func (m *SignedPolicyCmdPayload) Reset() { *m = SignedPolicyCmdPayload{} } +func (m *SignedPolicyCmdPayload) String() string { return proto.CompactTextString(m) } +func (*SignedPolicyCmdPayload) ProtoMessage() {} +func (*SignedPolicyCmdPayload) Descriptor() ([]byte, []int) { return fileDescriptor_1de5e9736122d1ff, []int{1} } -func (m *PolicyCmdPayload) XXX_Unmarshal(b []byte) error { +func (m *SignedPolicyCmdPayload) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *PolicyCmdPayload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *SignedPolicyCmdPayload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_PolicyCmdPayload.Marshal(b, m, deterministic) + return xxx_messageInfo_SignedPolicyCmdPayload.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -125,122 +120,60 @@ func (m *PolicyCmdPayload) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return b[:n], nil } } -func (m *PolicyCmdPayload) XXX_Merge(src proto.Message) { - xxx_messageInfo_PolicyCmdPayload.Merge(m, src) +func (m *SignedPolicyCmdPayload) XXX_Merge(src proto.Message) { + xxx_messageInfo_SignedPolicyCmdPayload.Merge(m, src) } -func (m *PolicyCmdPayload) XXX_Size() int { +func (m *SignedPolicyCmdPayload) XXX_Size() int { return m.Size() } -func (m *PolicyCmdPayload) XXX_DiscardUnknown() { - xxx_messageInfo_PolicyCmdPayload.DiscardUnknown(m) -} - -var xxx_messageInfo_PolicyCmdPayload proto.InternalMessageInfo - -type isPolicyCmdPayload_Cmd interface { - isPolicyCmdPayload_Cmd() - MarshalTo([]byte) (int, error) - Size() int -} - -type PolicyCmdPayload_SetRelationshipCmd struct { - SetRelationshipCmd *SetRelationshipCmd `protobuf:"bytes,6,opt,name=set_relationship_cmd,json=setRelationshipCmd,proto3,oneof" json:"set_relationship_cmd,omitempty"` -} -type PolicyCmdPayload_DeleteRelationshipCmd struct { - DeleteRelationshipCmd *DeleteRelationshipCmd `protobuf:"bytes,7,opt,name=delete_relationship_cmd,json=deleteRelationshipCmd,proto3,oneof" json:"delete_relationship_cmd,omitempty"` -} -type PolicyCmdPayload_RegisterObjectCmd struct { - RegisterObjectCmd *RegisterObjectCmd `protobuf:"bytes,8,opt,name=register_object_cmd,json=registerObjectCmd,proto3,oneof" json:"register_object_cmd,omitempty"` -} -type PolicyCmdPayload_UnregisterObjectCmd struct { - UnregisterObjectCmd *UnregisterObjectCmd `protobuf:"bytes,9,opt,name=unregister_object_cmd,json=unregisterObjectCmd,proto3,oneof" json:"unregister_object_cmd,omitempty"` +func (m *SignedPolicyCmdPayload) XXX_DiscardUnknown() { + xxx_messageInfo_SignedPolicyCmdPayload.DiscardUnknown(m) } -func (*PolicyCmdPayload_SetRelationshipCmd) isPolicyCmdPayload_Cmd() {} -func (*PolicyCmdPayload_DeleteRelationshipCmd) isPolicyCmdPayload_Cmd() {} -func (*PolicyCmdPayload_RegisterObjectCmd) isPolicyCmdPayload_Cmd() {} -func (*PolicyCmdPayload_UnregisterObjectCmd) isPolicyCmdPayload_Cmd() {} +var xxx_messageInfo_SignedPolicyCmdPayload proto.InternalMessageInfo -func (m *PolicyCmdPayload) GetCmd() isPolicyCmdPayload_Cmd { - if m != nil { - return m.Cmd - } - return nil -} - -func (m *PolicyCmdPayload) GetActor() string { +func (m *SignedPolicyCmdPayload) GetActor() string { if m != nil { return m.Actor } return "" } -func (m *PolicyCmdPayload) GetIssuedHeight() uint64 { +func (m *SignedPolicyCmdPayload) GetIssuedHeight() uint64 { if m != nil { return m.IssuedHeight } return 0 } -func (m *PolicyCmdPayload) GetExpirationDelta() uint64 { +func (m *SignedPolicyCmdPayload) GetExpirationDelta() uint64 { if m != nil { return m.ExpirationDelta } return 0 } -func (m *PolicyCmdPayload) GetCreationTime() *types.Timestamp { +func (m *SignedPolicyCmdPayload) GetCreationTime() *types.Timestamp { if m != nil { return m.CreationTime } return nil } -func (m *PolicyCmdPayload) GetPolicyId() string { +func (m *SignedPolicyCmdPayload) GetPolicyId() string { if m != nil { return m.PolicyId } return "" } -func (m *PolicyCmdPayload) GetSetRelationshipCmd() *SetRelationshipCmd { - if x, ok := m.GetCmd().(*PolicyCmdPayload_SetRelationshipCmd); ok { - return x.SetRelationshipCmd - } - return nil -} - -func (m *PolicyCmdPayload) GetDeleteRelationshipCmd() *DeleteRelationshipCmd { - if x, ok := m.GetCmd().(*PolicyCmdPayload_DeleteRelationshipCmd); ok { - return x.DeleteRelationshipCmd - } - return nil -} - -func (m *PolicyCmdPayload) GetRegisterObjectCmd() *RegisterObjectCmd { - if x, ok := m.GetCmd().(*PolicyCmdPayload_RegisterObjectCmd); ok { - return x.RegisterObjectCmd - } - return nil -} - -func (m *PolicyCmdPayload) GetUnregisterObjectCmd() *UnregisterObjectCmd { - if x, ok := m.GetCmd().(*PolicyCmdPayload_UnregisterObjectCmd); ok { - return x.UnregisterObjectCmd +func (m *SignedPolicyCmdPayload) GetCmd() *PolicyCmd { + if m != nil { + return m.Cmd } return nil } -// XXX_OneofWrappers is for the internal use of the proto package. -func (*PolicyCmdPayload) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*PolicyCmdPayload_SetRelationshipCmd)(nil), - (*PolicyCmdPayload_DeleteRelationshipCmd)(nil), - (*PolicyCmdPayload_RegisterObjectCmd)(nil), - (*PolicyCmdPayload_UnregisterObjectCmd)(nil), - } -} - type PolicyCmd struct { // Types that are valid to be assigned to Cmd: // *PolicyCmd_SetRelationshipCmd @@ -290,16 +223,16 @@ type isPolicyCmd_Cmd interface { } type PolicyCmd_SetRelationshipCmd struct { - SetRelationshipCmd *SetRelationshipCmd `protobuf:"bytes,2,opt,name=set_relationship_cmd,json=setRelationshipCmd,proto3,oneof" json:"set_relationship_cmd,omitempty"` + SetRelationshipCmd *SetRelationshipCmd `protobuf:"bytes,1,opt,name=set_relationship_cmd,json=setRelationshipCmd,proto3,oneof" json:"set_relationship_cmd,omitempty"` } type PolicyCmd_DeleteRelationshipCmd struct { - DeleteRelationshipCmd *DeleteRelationshipCmd `protobuf:"bytes,3,opt,name=delete_relationship_cmd,json=deleteRelationshipCmd,proto3,oneof" json:"delete_relationship_cmd,omitempty"` + DeleteRelationshipCmd *DeleteRelationshipCmd `protobuf:"bytes,2,opt,name=delete_relationship_cmd,json=deleteRelationshipCmd,proto3,oneof" json:"delete_relationship_cmd,omitempty"` } type PolicyCmd_RegisterObjectCmd struct { - RegisterObjectCmd *RegisterObjectCmd `protobuf:"bytes,4,opt,name=register_object_cmd,json=registerObjectCmd,proto3,oneof" json:"register_object_cmd,omitempty"` + RegisterObjectCmd *RegisterObjectCmd `protobuf:"bytes,3,opt,name=register_object_cmd,json=registerObjectCmd,proto3,oneof" json:"register_object_cmd,omitempty"` } type PolicyCmd_UnregisterObjectCmd struct { - UnregisterObjectCmd *UnregisterObjectCmd `protobuf:"bytes,5,opt,name=unregister_object_cmd,json=unregisterObjectCmd,proto3,oneof" json:"unregister_object_cmd,omitempty"` + UnregisterObjectCmd *UnregisterObjectCmd `protobuf:"bytes,4,opt,name=unregister_object_cmd,json=unregisterObjectCmd,proto3,oneof" json:"unregister_object_cmd,omitempty"` } func (*PolicyCmd_SetRelationshipCmd) isPolicyCmd_Cmd() {} @@ -851,7 +784,7 @@ func (*PolicyCmdResult) XXX_OneofWrappers() []interface{} { func init() { proto.RegisterType((*SignedPolicyCmd)(nil), "sourcehub.acp.SignedPolicyCmd") - proto.RegisterType((*PolicyCmdPayload)(nil), "sourcehub.acp.PolicyCmdPayload") + proto.RegisterType((*SignedPolicyCmdPayload)(nil), "sourcehub.acp.SignedPolicyCmdPayload") proto.RegisterType((*PolicyCmd)(nil), "sourcehub.acp.PolicyCmd") proto.RegisterType((*SetRelationshipCmd)(nil), "sourcehub.acp.SetRelationshipCmd") proto.RegisterType((*DeleteRelationshipCmd)(nil), "sourcehub.acp.DeleteRelationshipCmd") @@ -867,57 +800,56 @@ func init() { func init() { proto.RegisterFile("sourcehub/acp/policy_cmd.proto", fileDescriptor_1de5e9736122d1ff) } var fileDescriptor_1de5e9736122d1ff = []byte{ - // 785 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0xcb, 0x4e, 0xdb, 0x4c, - 0x18, 0x4d, 0xc8, 0x85, 0xe4, 0x23, 0xe1, 0x32, 0x24, 0xe0, 0x3f, 0xfc, 0x0a, 0xc1, 0xff, 0xa5, - 0xb4, 0x52, 0x1d, 0x09, 0x56, 0xac, 0xa8, 0x02, 0xad, 0xe8, 0xaa, 0x68, 0x28, 0x12, 0xea, 0x82, - 0xc8, 0xb1, 0x87, 0xc4, 0x34, 0xce, 0x58, 0xe3, 0x71, 0x0b, 0x52, 0xdf, 0xa1, 0x7d, 0x94, 0x3e, - 0x43, 0x57, 0x5d, 0xb2, 0xec, 0xb2, 0x82, 0x87, 0xe8, 0xb6, 0xf2, 0xcc, 0xe4, 0x66, 0x1b, 0xd1, - 0x8a, 0xb2, 0x23, 0x67, 0xce, 0x77, 0xce, 0xcc, 0x99, 0xd1, 0xc1, 0x50, 0xf7, 0x69, 0xc0, 0x2c, - 0xd2, 0x0b, 0x3a, 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4, 0xac, 0x38, 0x59, 0xcd, 0x90, 0x09, 0x1a, - 0xc3, 0x04, 0x8d, 0xd7, 0xc3, 0x04, 0x71, 0x69, 0x38, 0x10, 0x42, 0x68, 0x0d, 0x8a, 0xea, 0x36, - 0x1c, 0x5b, 0xcb, 0x89, 0xad, 0x16, 0x24, 0xf0, 0xd2, 0x46, 0xc7, 0x50, 0xf1, 0x09, 0x6f, 0x4f, - 0xc6, 0x1b, 0x5e, 0x9a, 0x96, 0x17, 0x26, 0x1b, 0x91, 0xf8, 0x8e, 0x08, 0xc7, 0x13, 0xcc, 0x3d, - 0xd7, 0x3e, 0x48, 0x61, 0xe4, 0xc7, 0x50, 0x74, 0x0a, 0xab, 0x36, 0xe9, 0x13, 0x4e, 0xe2, 0xca, - 0xb3, 0x42, 0xf9, 0xdf, 0x88, 0xf2, 0xbe, 0x60, 0xc7, 0xc5, 0xab, 0x76, 0xd2, 0x02, 0xc2, 0xb0, - 0xcc, 0x48, 0xd7, 0xf1, 0x39, 0x61, 0x6d, 0xda, 0x39, 0x27, 0x16, 0x17, 0xda, 0x05, 0xa1, 0xdd, - 0x88, 0x68, 0x63, 0xc5, 0x7c, 0x25, 0x88, 0x52, 0x77, 0x89, 0x45, 0x41, 0x74, 0x02, 0xd5, 0x60, - 0x90, 0xa4, 0x5a, 0x14, 0xaa, 0x7a, 0x44, 0xf5, 0x78, 0xc0, 0x12, 0x74, 0x97, 0x83, 0x38, 0xdc, - 0xca, 0x41, 0xc6, 0x72, 0x6d, 0xfd, 0xc7, 0x0c, 0x14, 0xc7, 0x6f, 0xf5, 0xb6, 0xe4, 0x67, 0x1e, - 0x2c, 0xf9, 0xcc, 0x03, 0x26, 0x9f, 0x7d, 0x90, 0xe4, 0x73, 0x7f, 0x28, 0xf9, 0x63, 0x40, 0xf1, - 0x00, 0xd1, 0x2e, 0x94, 0x26, 0x33, 0x52, 0x95, 0xb1, 0x16, 0x3b, 0xc3, 0x98, 0x82, 0xa7, 0x06, - 0xf4, 0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 0x95, 0xc2, 0x82, 0x88, 0xb4, 0x8f, 0xb2, 0x38, 0x87, 0x5a, 0x52, - 0x01, 0x29, 0x17, 0x99, 0xd6, 0x93, 0x5f, 0xe9, 0xa0, 0x91, 0x91, 0x16, 0x6f, 0x22, 0xe5, 0x75, - 0x0a, 0x2b, 0xd1, 0xda, 0x50, 0x3e, 0xb2, 0xeb, 0xfe, 0xbf, 0xab, 0x8f, 0x46, 0x1e, 0x95, 0xe9, - 0x0b, 0x51, 0xfa, 0x36, 0x68, 0xf1, 0x62, 0x52, 0x0e, 0xb2, 0xf1, 0x36, 0xef, 0xee, 0xa6, 0x91, - 0xc7, 0x4a, 0xb4, 0xa1, 0xe4, 0x4a, 0xab, 0x30, 0x7c, 0x86, 0xad, 0x83, 0xaf, 0xd7, 0xf5, 0xf4, - 0xd5, 0x75, 0x3d, 0xfd, 0xfd, 0xba, 0x9e, 0xfe, 0x74, 0x53, 0x4f, 0x5d, 0xdd, 0xd4, 0x53, 0xdf, - 0x6e, 0xea, 0xa9, 0x37, 0x46, 0xd7, 0xe1, 0xa1, 0x87, 0x45, 0xdd, 0xa6, 0x74, 0x1c, 0x10, 0xfe, - 0x9e, 0xb2, 0xb7, 0xcd, 0xf1, 0x77, 0xd2, 0x85, 0xf8, 0x52, 0xe2, 0x97, 0x1e, 0xf1, 0x3b, 0x79, - 0xf1, 0x59, 0xb0, 0xfd, 0x33, 0x00, 0x00, 0xff, 0xff, 0x9d, 0x6c, 0xfc, 0x2f, 0x97, 0x09, 0x00, - 0x00, + // 779 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcd, 0x4e, 0xdb, 0x4c, + 0x14, 0xcd, 0x0f, 0xc9, 0x47, 0x2e, 0x09, 0x7c, 0x0c, 0x09, 0xf8, 0x0b, 0x9f, 0xd2, 0xe0, 0x96, + 0x96, 0x22, 0xd5, 0x91, 0x60, 0xd5, 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0x2f, 0xb9, 0x9b, 0x31, 0x6e, 0xac, 0x2b, 0x5f, 0xc9, 0x42, 0xc5, 0xbb, 0xcc, 0xe3, 0x20, + 0x3a, 0x81, 0x5a, 0x38, 0x4c, 0x63, 0x55, 0xab, 0x32, 0x63, 0xac, 0xc7, 0x43, 0x9e, 0xc2, 0xbb, + 0x12, 0x26, 0xe1, 0x76, 0x41, 0xae, 0xc7, 0x3c, 0x06, 0x94, 0x34, 0x10, 0xed, 0x41, 0x79, 0xda, + 0x23, 0xed, 0xfc, 0x7a, 0x62, 0x86, 0x49, 0x09, 0x9e, 0x69, 0x30, 0x4f, 0xa0, 0x96, 0xea, 0xde, + 0xdd, 0x99, 0xdb, 0xb0, 0x9c, 0xf0, 0x0e, 0x3d, 0x81, 0xa2, 0xf2, 0x46, 0xf3, 0xd5, 0x62, 0x7c, + 0xaa, 0x12, 0xeb, 0x22, 0xf3, 0x00, 0x56, 0x52, 0x9c, 0xfa, 0x5b, 0x96, 0x8f, 0x60, 0x24, 0xad, + 0xc3, 0x34, 0x08, 0x07, 0x02, 0x6d, 0xc2, 0x22, 0xa7, 0x0e, 0xe3, 0xa4, 0x43, 0x2f, 0x22, 0x15, + 0xf5, 0x78, 0xe7, 0x71, 0x45, 0xa1, 0xcf, 0x15, 0x88, 0x9e, 0x42, 0x51, 0x01, 0xfa, 0x05, 0x6e, + 0xfc, 0xce, 0x07, 0x59, 0x88, 0x75, 0x83, 0xf9, 0x0c, 0xd6, 0x53, 0x1d, 0xd6, 0x17, 0xd8, 0x88, + 0x7c, 0x96, 0x17, 0x38, 0x63, 0xe1, 0x70, 0x24, 0xbf, 0xa0, 0xb0, 0x17, 0x11, 0x64, 0x7e, 0xce, + 0xc2, 0x5a, 0xc2, 0x4a, 0xdd, 0x2e, 0x2f, 0x16, 0xfd, 0x92, 0x8d, 0x8b, 0x29, 0x17, 0x8b, 0xfa, + 0x54, 0x98, 0xa8, 0x16, 0xac, 0x1b, 0xee, 0x32, 0xd3, 0x19, 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 0x00, 0xff, 0xff, 0xd3, 0x8f, 0x2f, 0x47, 0x63, 0x08, 0x00, 0x00, } func (m *SignedPolicyCmd) Marshal() (dAtA []byte, err error) { @@ -962,7 +894,7 @@ func (m *SignedPolicyCmd) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *PolicyCmdPayload) Marshal() (dAtA []byte, err error) { +func (m *SignedPolicyCmdPayload) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -972,24 +904,27 @@ func (m *PolicyCmdPayload) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *PolicyCmdPayload) MarshalTo(dAtA []byte) (int, error) { +func (m *SignedPolicyCmdPayload) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *PolicyCmdPayload) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *SignedPolicyCmdPayload) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.Cmd != nil { { - size := m.Cmd.Size() - i -= size - if _, err := m.Cmd.MarshalTo(dAtA[i:]); err != nil { + size, err := m.Cmd.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { return 0, err } + i -= size + i = encodeVarintPolicyCmd(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x32 } if len(m.PolicyId) > 0 { i -= len(m.PolicyId) @@ -1030,90 +965,6 @@ func (m *PolicyCmdPayload) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *PolicyCmdPayload_SetRelationshipCmd) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PolicyCmdPayload_SetRelationshipCmd) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.SetRelationshipCmd != nil { - { - size, err := m.SetRelationshipCmd.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintPolicyCmd(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - return len(dAtA) - i, nil -} -func (m *PolicyCmdPayload_DeleteRelationshipCmd) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PolicyCmdPayload_DeleteRelationshipCmd) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.DeleteRelationshipCmd != nil { - { - size, err := m.DeleteRelationshipCmd.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintPolicyCmd(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - return len(dAtA) - i, nil -} -func (m *PolicyCmdPayload_RegisterObjectCmd) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PolicyCmdPayload_RegisterObjectCmd) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.RegisterObjectCmd != nil { - { - size, err := m.RegisterObjectCmd.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintPolicyCmd(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } - return len(dAtA) - i, nil -} -func (m *PolicyCmdPayload_UnregisterObjectCmd) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PolicyCmdPayload_UnregisterObjectCmd) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.UnregisterObjectCmd != nil { - { - size, err := m.UnregisterObjectCmd.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintPolicyCmd(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x4a - } - return len(dAtA) - i, nil -} func (m *PolicyCmd) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1163,7 +1014,7 @@ func (m *PolicyCmd_SetRelationshipCmd) MarshalToSizedBuffer(dAtA []byte) (int, e i = encodeVarintPolicyCmd(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -1184,7 +1035,7 @@ func (m *PolicyCmd_DeleteRelationshipCmd) MarshalToSizedBuffer(dAtA []byte) (int i = encodeVarintPolicyCmd(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 } return len(dAtA) - i, nil } @@ -1205,7 +1056,7 @@ func (m *PolicyCmd_RegisterObjectCmd) MarshalToSizedBuffer(dAtA []byte) (int, er i = encodeVarintPolicyCmd(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } return len(dAtA) - i, nil } @@ -1226,7 +1077,7 @@ func (m *PolicyCmd_UnregisterObjectCmd) MarshalToSizedBuffer(dAtA []byte) (int, i = encodeVarintPolicyCmd(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a + dAtA[i] = 0x22 } return len(dAtA) - i, nil } @@ -1670,7 +1521,7 @@ func (m *SignedPolicyCmd) Size() (n int) { return n } -func (m *PolicyCmdPayload) Size() (n int) { +func (m *SignedPolicyCmdPayload) Size() (n int) { if m == nil { return 0 } @@ -1695,59 +1546,12 @@ func (m *PolicyCmdPayload) Size() (n int) { n += 1 + l + sovPolicyCmd(uint64(l)) } if m.Cmd != nil { - n += m.Cmd.Size() - } - return n -} - -func (m *PolicyCmdPayload_SetRelationshipCmd) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.SetRelationshipCmd != nil { - l = m.SetRelationshipCmd.Size() - n += 1 + l + sovPolicyCmd(uint64(l)) - } - return n -} -func (m *PolicyCmdPayload_DeleteRelationshipCmd) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.DeleteRelationshipCmd != nil { - l = m.DeleteRelationshipCmd.Size() - n += 1 + l + sovPolicyCmd(uint64(l)) - } - return n -} -func (m *PolicyCmdPayload_RegisterObjectCmd) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RegisterObjectCmd != nil { - l = m.RegisterObjectCmd.Size() - n += 1 + l + sovPolicyCmd(uint64(l)) - } - return n -} -func (m *PolicyCmdPayload_UnregisterObjectCmd) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.UnregisterObjectCmd != nil { - l = m.UnregisterObjectCmd.Size() + l = m.Cmd.Size() n += 1 + l + sovPolicyCmd(uint64(l)) } return n } + func (m *PolicyCmd) Size() (n int) { if m == nil { return 0 @@ -2045,7 +1849,7 @@ func (m *SignedPolicyCmd) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Payload == nil { - m.Payload = &PolicyCmdPayload{} + m.Payload = &SignedPolicyCmdPayload{} } if err := m.Payload.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -2106,7 +1910,7 @@ func (m *SignedPolicyCmd) Unmarshal(dAtA []byte) error { } return nil } -func (m *PolicyCmdPayload) Unmarshal(dAtA []byte) error { +func (m *SignedPolicyCmdPayload) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2129,10 +1933,10 @@ func (m *PolicyCmdPayload) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PolicyCmdPayload: wiretype end group for non-group") + return fmt.Errorf("proto: SignedPolicyCmdPayload: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PolicyCmdPayload: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: SignedPolicyCmdPayload: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2275,77 +2079,7 @@ func (m *PolicyCmdPayload) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SetRelationshipCmd", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPolicyCmd - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPolicyCmd - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPolicyCmd - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &SetRelationshipCmd{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Cmd = &PolicyCmdPayload_SetRelationshipCmd{v} - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DeleteRelationshipCmd", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPolicyCmd - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPolicyCmd - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPolicyCmd - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &DeleteRelationshipCmd{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Cmd = &PolicyCmdPayload_DeleteRelationshipCmd{v} - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegisterObjectCmd", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Cmd", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2372,46 +2106,12 @@ func (m *PolicyCmdPayload) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &RegisterObjectCmd{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Cmd = &PolicyCmdPayload_RegisterObjectCmd{v} - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnregisterObjectCmd", wireType) + if m.Cmd == nil { + m.Cmd = &PolicyCmd{} } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPolicyCmd - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPolicyCmd - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthPolicyCmd - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &UnregisterObjectCmd{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Cmd.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Cmd = &PolicyCmdPayload_UnregisterObjectCmd{v} iNdEx = postIndex default: iNdEx = preIndex @@ -2463,7 +2163,7 @@ func (m *PolicyCmd) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: PolicyCmd: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 2: + case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SetRelationshipCmd", wireType) } @@ -2498,7 +2198,7 @@ func (m *PolicyCmd) Unmarshal(dAtA []byte) error { } m.Cmd = &PolicyCmd_SetRelationshipCmd{v} iNdEx = postIndex - case 3: + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DeleteRelationshipCmd", wireType) } @@ -2533,7 +2233,7 @@ func (m *PolicyCmd) Unmarshal(dAtA []byte) error { } m.Cmd = &PolicyCmd_DeleteRelationshipCmd{v} iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field RegisterObjectCmd", wireType) } @@ -2568,7 +2268,7 @@ func (m *PolicyCmd) Unmarshal(dAtA []byte) error { } m.Cmd = &PolicyCmd_RegisterObjectCmd{v} iNdEx = postIndex - case 5: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field UnregisterObjectCmd", wireType) } diff --git a/x/acp/types/tx.pb.go b/x/acp/types/tx.pb.go index b0dd295..9e96643 100644 --- a/x/acp/types/tx.pb.go +++ b/x/acp/types/tx.pb.go @@ -32,28 +32,28 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type MsgPolicyCmd_ContentType int32 +type MsgSignedPolicyCmd_ContentType int32 const ( - MsgPolicyCmd_UNKNOWN MsgPolicyCmd_ContentType = 0 - MsgPolicyCmd_JWS MsgPolicyCmd_ContentType = 1 + MsgSignedPolicyCmd_UNKNOWN MsgSignedPolicyCmd_ContentType = 0 + MsgSignedPolicyCmd_JWS MsgSignedPolicyCmd_ContentType = 1 ) -var MsgPolicyCmd_ContentType_name = map[int32]string{ +var MsgSignedPolicyCmd_ContentType_name = map[int32]string{ 0: "UNKNOWN", 1: "JWS", } -var MsgPolicyCmd_ContentType_value = map[string]int32{ +var MsgSignedPolicyCmd_ContentType_value = map[string]int32{ "UNKNOWN": 0, "JWS": 1, } -func (x MsgPolicyCmd_ContentType) String() string { - return proto.EnumName(MsgPolicyCmd_ContentType_name, int32(x)) +func (x MsgSignedPolicyCmd_ContentType) String() string { + return proto.EnumName(MsgSignedPolicyCmd_ContentType_name, int32(x)) } -func (MsgPolicyCmd_ContentType) EnumDescriptor() ([]byte, []int) { +func (MsgSignedPolicyCmd_ContentType) EnumDescriptor() ([]byte, []int) { return fileDescriptor_5bb2974ac27b9ccc, []int{14, 0} } @@ -823,24 +823,24 @@ func (m *MsgCheckAccessResponse) GetDecision() *AccessDecision { return nil } -type MsgPolicyCmd struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - Payload string `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` - Type MsgPolicyCmd_ContentType `protobuf:"varint,3,opt,name=type,proto3,enum=sourcehub.acp.MsgPolicyCmd_ContentType" json:"type,omitempty"` +type MsgSignedPolicyCmd struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Payload string `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` + Type MsgSignedPolicyCmd_ContentType `protobuf:"varint,3,opt,name=type,proto3,enum=sourcehub.acp.MsgSignedPolicyCmd_ContentType" json:"type,omitempty"` } -func (m *MsgPolicyCmd) Reset() { *m = MsgPolicyCmd{} } -func (m *MsgPolicyCmd) String() string { return proto.CompactTextString(m) } -func (*MsgPolicyCmd) ProtoMessage() {} -func (*MsgPolicyCmd) Descriptor() ([]byte, []int) { +func (m *MsgSignedPolicyCmd) Reset() { *m = MsgSignedPolicyCmd{} } +func (m *MsgSignedPolicyCmd) String() string { return proto.CompactTextString(m) } +func (*MsgSignedPolicyCmd) ProtoMessage() {} +func (*MsgSignedPolicyCmd) Descriptor() ([]byte, []int) { return fileDescriptor_5bb2974ac27b9ccc, []int{14} } -func (m *MsgPolicyCmd) XXX_Unmarshal(b []byte) error { +func (m *MsgSignedPolicyCmd) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgPolicyCmd) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgSignedPolicyCmd) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgPolicyCmd.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgSignedPolicyCmd.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -850,61 +850,55 @@ func (m *MsgPolicyCmd) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *MsgPolicyCmd) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgPolicyCmd.Merge(m, src) +func (m *MsgSignedPolicyCmd) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSignedPolicyCmd.Merge(m, src) } -func (m *MsgPolicyCmd) XXX_Size() int { +func (m *MsgSignedPolicyCmd) XXX_Size() int { return m.Size() } -func (m *MsgPolicyCmd) XXX_DiscardUnknown() { - xxx_messageInfo_MsgPolicyCmd.DiscardUnknown(m) +func (m *MsgSignedPolicyCmd) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSignedPolicyCmd.DiscardUnknown(m) } -var xxx_messageInfo_MsgPolicyCmd proto.InternalMessageInfo +var xxx_messageInfo_MsgSignedPolicyCmd proto.InternalMessageInfo -func (m *MsgPolicyCmd) GetCreator() string { +func (m *MsgSignedPolicyCmd) GetCreator() string { if m != nil { return m.Creator } return "" } -func (m *MsgPolicyCmd) GetPayload() string { +func (m *MsgSignedPolicyCmd) GetPayload() string { if m != nil { return m.Payload } return "" } -func (m *MsgPolicyCmd) GetType() MsgPolicyCmd_ContentType { +func (m *MsgSignedPolicyCmd) GetType() MsgSignedPolicyCmd_ContentType { if m != nil { return m.Type } - return MsgPolicyCmd_UNKNOWN + return MsgSignedPolicyCmd_UNKNOWN } -type MsgPolicyCmdResponse struct { - // Types that are valid to be assigned to Result: - // - // *MsgPolicyCmdResponse_SetRelationshipResult - // *MsgPolicyCmdResponse_DeleteRelationshipResult - // *MsgPolicyCmdResponse_RegisterObjectResult - // *MsgPolicyCmdResponse_UnregisterObjectResult - Result isMsgPolicyCmdResponse_Result `protobuf_oneof:"result"` +type MsgSignedPolicyCmdResponse struct { + Result *PolicyCmdResult `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"` } -func (m *MsgPolicyCmdResponse) Reset() { *m = MsgPolicyCmdResponse{} } -func (m *MsgPolicyCmdResponse) String() string { return proto.CompactTextString(m) } -func (*MsgPolicyCmdResponse) ProtoMessage() {} -func (*MsgPolicyCmdResponse) Descriptor() ([]byte, []int) { +func (m *MsgSignedPolicyCmdResponse) Reset() { *m = MsgSignedPolicyCmdResponse{} } +func (m *MsgSignedPolicyCmdResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSignedPolicyCmdResponse) ProtoMessage() {} +func (*MsgSignedPolicyCmdResponse) Descriptor() ([]byte, []int) { return fileDescriptor_5bb2974ac27b9ccc, []int{15} } -func (m *MsgPolicyCmdResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgSignedPolicyCmdResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgPolicyCmdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgSignedPolicyCmdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgPolicyCmdResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgSignedPolicyCmdResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -914,87 +908,25 @@ func (m *MsgPolicyCmdResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *MsgPolicyCmdResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgPolicyCmdResponse.Merge(m, src) +func (m *MsgSignedPolicyCmdResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSignedPolicyCmdResponse.Merge(m, src) } -func (m *MsgPolicyCmdResponse) XXX_Size() int { +func (m *MsgSignedPolicyCmdResponse) XXX_Size() int { return m.Size() } -func (m *MsgPolicyCmdResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgPolicyCmdResponse.DiscardUnknown(m) +func (m *MsgSignedPolicyCmdResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSignedPolicyCmdResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgPolicyCmdResponse proto.InternalMessageInfo - -type isMsgPolicyCmdResponse_Result interface { - isMsgPolicyCmdResponse_Result() - MarshalTo([]byte) (int, error) - Size() int -} +var xxx_messageInfo_MsgSignedPolicyCmdResponse proto.InternalMessageInfo -type MsgPolicyCmdResponse_SetRelationshipResult struct { - SetRelationshipResult *SetRelationshipCmdResult `protobuf:"bytes,1,opt,name=set_relationship_result,json=setRelationshipResult,proto3,oneof" json:"set_relationship_result,omitempty"` -} -type MsgPolicyCmdResponse_DeleteRelationshipResult struct { - DeleteRelationshipResult *DeleteRelationshipCmdResult `protobuf:"bytes,2,opt,name=delete_relationship_result,json=deleteRelationshipResult,proto3,oneof" json:"delete_relationship_result,omitempty"` -} -type MsgPolicyCmdResponse_RegisterObjectResult struct { - RegisterObjectResult *RegisterObjectCmdResult `protobuf:"bytes,3,opt,name=register_object_result,json=registerObjectResult,proto3,oneof" json:"register_object_result,omitempty"` -} -type MsgPolicyCmdResponse_UnregisterObjectResult struct { - UnregisterObjectResult *UnregisterObjectCmdResult `protobuf:"bytes,4,opt,name=unregister_object_result,json=unregisterObjectResult,proto3,oneof" json:"unregister_object_result,omitempty"` -} - -func (*MsgPolicyCmdResponse_SetRelationshipResult) isMsgPolicyCmdResponse_Result() {} -func (*MsgPolicyCmdResponse_DeleteRelationshipResult) isMsgPolicyCmdResponse_Result() {} -func (*MsgPolicyCmdResponse_RegisterObjectResult) isMsgPolicyCmdResponse_Result() {} -func (*MsgPolicyCmdResponse_UnregisterObjectResult) isMsgPolicyCmdResponse_Result() {} - -func (m *MsgPolicyCmdResponse) GetResult() isMsgPolicyCmdResponse_Result { +func (m *MsgSignedPolicyCmdResponse) GetResult() *PolicyCmdResult { if m != nil { return m.Result } return nil } -func (m *MsgPolicyCmdResponse) GetSetRelationshipResult() *SetRelationshipCmdResult { - if x, ok := m.GetResult().(*MsgPolicyCmdResponse_SetRelationshipResult); ok { - return x.SetRelationshipResult - } - return nil -} - -func (m *MsgPolicyCmdResponse) GetDeleteRelationshipResult() *DeleteRelationshipCmdResult { - if x, ok := m.GetResult().(*MsgPolicyCmdResponse_DeleteRelationshipResult); ok { - return x.DeleteRelationshipResult - } - return nil -} - -func (m *MsgPolicyCmdResponse) GetRegisterObjectResult() *RegisterObjectCmdResult { - if x, ok := m.GetResult().(*MsgPolicyCmdResponse_RegisterObjectResult); ok { - return x.RegisterObjectResult - } - return nil -} - -func (m *MsgPolicyCmdResponse) GetUnregisterObjectResult() *UnregisterObjectCmdResult { - if x, ok := m.GetResult().(*MsgPolicyCmdResponse_UnregisterObjectResult); ok { - return x.UnregisterObjectResult - } - return nil -} - -// XXX_OneofWrappers is for the internal use of the proto package. -func (*MsgPolicyCmdResponse) XXX_OneofWrappers() []interface{} { - return []interface{}{ - (*MsgPolicyCmdResponse_SetRelationshipResult)(nil), - (*MsgPolicyCmdResponse_DeleteRelationshipResult)(nil), - (*MsgPolicyCmdResponse_RegisterObjectResult)(nil), - (*MsgPolicyCmdResponse_UnregisterObjectResult)(nil), - } -} - type MsgBearerPolicyCmd struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` BearerToken string `protobuf:"bytes,2,opt,name=bearer_token,json=bearerToken,proto3" json:"bearer_token,omitempty"` @@ -1116,7 +1048,7 @@ func (m *MsgBearerPolicyCmdResponse) GetResult() *PolicyCmdResult { } func init() { - proto.RegisterEnum("sourcehub.acp.MsgPolicyCmd_ContentType", MsgPolicyCmd_ContentType_name, MsgPolicyCmd_ContentType_value) + proto.RegisterEnum("sourcehub.acp.MsgSignedPolicyCmd_ContentType", MsgSignedPolicyCmd_ContentType_name, MsgSignedPolicyCmd_ContentType_value) proto.RegisterType((*MsgUpdateParams)(nil), "sourcehub.acp.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "sourcehub.acp.MsgUpdateParamsResponse") proto.RegisterType((*MsgCreatePolicy)(nil), "sourcehub.acp.MsgCreatePolicy") @@ -1131,8 +1063,8 @@ func init() { proto.RegisterType((*MsgUnregisterObjectResponse)(nil), "sourcehub.acp.MsgUnregisterObjectResponse") proto.RegisterType((*MsgCheckAccess)(nil), "sourcehub.acp.MsgCheckAccess") proto.RegisterType((*MsgCheckAccessResponse)(nil), "sourcehub.acp.MsgCheckAccessResponse") - proto.RegisterType((*MsgPolicyCmd)(nil), "sourcehub.acp.MsgPolicyCmd") - proto.RegisterType((*MsgPolicyCmdResponse)(nil), "sourcehub.acp.MsgPolicyCmdResponse") + proto.RegisterType((*MsgSignedPolicyCmd)(nil), "sourcehub.acp.MsgSignedPolicyCmd") + proto.RegisterType((*MsgSignedPolicyCmdResponse)(nil), "sourcehub.acp.MsgSignedPolicyCmdResponse") proto.RegisterType((*MsgBearerPolicyCmd)(nil), "sourcehub.acp.MsgBearerPolicyCmd") proto.RegisterType((*MsgBearerPolicyCmdResponse)(nil), "sourcehub.acp.MsgBearerPolicyCmdResponse") } @@ -1140,86 +1072,79 @@ func init() { func init() { proto.RegisterFile("sourcehub/acp/tx.proto", fileDescriptor_5bb2974ac27b9ccc) } var fileDescriptor_5bb2974ac27b9ccc = []byte{ - // 1249 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0x4f, 0x6f, 0x1b, 0x45, - 0x14, 0xf7, 0xe2, 0xd6, 0x89, 0x9f, 0x1d, 0xb7, 0x5d, 0xd2, 0xd4, 0xdd, 0x50, 0x37, 0x71, 0x68, - 0x09, 0x16, 0xb5, 0x45, 0x2a, 0x55, 0x50, 0x0e, 0x55, 0x9d, 0x52, 0x15, 0x90, 0x53, 0xb4, 0x49, - 0x5b, 0x09, 0x21, 0xac, 0xf5, 0xee, 0x74, 0xbd, 0x8d, 0xbd, 0x63, 0x76, 0xc6, 0x90, 0x5c, 0x10, - 0xe2, 0x06, 0x27, 0xf8, 0x00, 0xdc, 0x39, 0x46, 0x08, 0xc4, 0x57, 0xc8, 0x09, 0x55, 0x9c, 0x10, - 0x48, 0x08, 0x25, 0x87, 0x88, 0x6f, 0x81, 0xe6, 0xcf, 0x6e, 0x76, 0x67, 0x37, 0x4e, 0x21, 0x95, - 0x7a, 0x69, 0x33, 0xef, 0xfd, 0xe6, 0xfd, 0xf9, 0xed,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, 0x3d, 0xdd, - 0xaf, 0xe5, 0x7e, 0xdf, 0xaf, 0xe5, 0x3e, 0x6a, 0xba, 0x1e, 0x65, 0x71, 0x6c, 0x3c, 0x6c, 0x89, - 0xa8, 0x3e, 0xa2, 0x9f, 0xe3, 0x60, 0xb3, 0xa5, 0xfe, 0x54, 0x64, 0xd7, 0x18, 0xe9, 0x15, 0xf8, - 0x80, 0xb8, 0xfe, 0x6f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x88, 0xfd, 0x9e, 0x78, 0x49, 0x10, 0x00, - 0x00, + // 1142 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x57, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0xe2, 0xd6, 0x49, 0x9e, 0x1d, 0x27, 0x5d, 0xd2, 0xd4, 0xd9, 0x10, 0x27, 0xd9, 0x50, + 0x14, 0x22, 0x62, 0x8b, 0x54, 0xaa, 0xa0, 0x97, 0x2a, 0x49, 0xa9, 0x0a, 0xc8, 0x29, 0xda, 0xa4, + 0xad, 0x84, 0x90, 0xac, 0xf5, 0xee, 0x74, 0xbd, 0xc4, 0xbb, 0x63, 0x76, 0xc6, 0x90, 0x5c, 0x10, + 0xe2, 0x06, 0x27, 0xf8, 0x03, 0xb8, 0x73, 0xcc, 0x01, 0x89, 0x1b, 0xe7, 0x1c, 0x2b, 0x4e, 0x08, + 0x24, 0x54, 0x25, 0x87, 0x88, 0xff, 0x02, 0xcd, 0x0f, 0x6f, 0x76, 0x67, 0x37, 0x4e, 0x21, 0x95, + 0x7a, 0x69, 0xf3, 0xde, 0xfb, 0xe6, 0xcd, 0x7b, 0xdf, 0x7c, 0xfb, 0x66, 0x0c, 0x33, 0x04, 0xf7, + 0x23, 0x07, 0x75, 0xfa, 0xed, 0x86, 0xed, 0xf4, 0x1a, 0x74, 0xbf, 0xde, 0x8b, 0x30, 0xc5, 0xfa, + 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0x01, 0x5b, 0x16, 0xf1, 0xe4, 0x16, 0x07, 0x5a, 0x72, 0xc1, 0x65, 0x24, 0xf4, + 0x9d, 0x06, 0xaf, 0xb3, 0x19, 0x17, 0x46, 0xaf, 0x80, 0x60, 0x85, 0x9f, 0x5b, 0x30, 0x97, 0x53, + 0x4a, 0x4c, 0xd0, 0x34, 0x5c, 0x4d, 0xaa, 0x44, 0x18, 0x6c, 0xc2, 0x54, 0xd8, 0xb0, 0xea, 0x20, + 0x67, 0x6f, 0x83, 0xdf, 0x8d, 0xaf, 0x6c, 0xba, 0x6c, 0x41, 0x45, 0xde, 0xce, 0x11, 0xfa, 0xa2, + 0x8f, 0x08, 0x95, 0xf3, 0xe5, 0x0d, 0x85, 0x04, 0x51, 0xa6, 0x25, 0x30, 0xd6, 0x84, 0x9d, 0x34, + 0x15, 0x4a, 0x76, 0x60, 0x26, 0xdd, 0x5c, 0x42, 0x2e, 0x63, 0x83, 0x37, 0x80, 0x1c, 0xc5, 0xf3, + 0xb9, 0xdb, 0xdc, 0x93, 0x20, 0x2b, 0x86, 0x9b, 0xbf, 0xc9, 0xa1, 0xec, 0x7b, 0x21, 0x72, 0xc5, + 0xc0, 0xde, 0x0a, 0xdc, 0x21, 0xb4, 0x55, 0x61, 0xb4, 0x67, 0x1f, 0x74, 0xb1, 0x3d, 0x20, 0x6d, + 0x60, 0xea, 0x1b, 0x70, 0x25, 0x71, 0x71, 0xad, 0x29, 0x15, 0x64, 0x37, 0xa9, 0x6f, 0xe1, 0x90, + 0xa2, 0x90, 0xf2, 0x2b, 0x8c, 0x2f, 0x35, 0x97, 0xa1, 0x94, 0x70, 0xea, 0x25, 0x18, 0x7d, 0xb4, + 0xfd, 0xf1, 0xf6, 0xc3, 0x27, 0xdb, 0x53, 0x23, 0xfa, 0x28, 0x14, 0x3e, 0x7a, 0xb2, 0x33, 0xa5, + 0x29, 0xac, 0xec, 0x8a, 0xb9, 0x9b, 0x4e, 0x1d, 0x33, 0x73, 0x3b, 0x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b0, 0x32, 0xee, 0x96, 0x2e, 0x1c, 0x56, 0xb9, 0x27, 0x7c, 0xce, 0xd0, 0x69, 0xc1, + 0xa4, 0x3a, 0x38, 0x72, 0x36, 0x50, 0x20, 0x79, 0x1b, 0x9c, 0xf3, 0x4d, 0x1a, 0x57, 0xbf, 0x61, + 0x3f, 0x67, 0x36, 0x1f, 0x1c, 0x1d, 0xd7, 0xb4, 0x67, 0xc7, 0x35, 0xed, 0xf9, 0x71, 0x4d, 0xfb, + 0xe1, 0xa4, 0x36, 0xf2, 0xec, 0xa4, 0x36, 0xf2, 0xc7, 0x49, 0x6d, 0xe4, 0xd3, 0xba, 0xe7, 0x53, + 0x96, 0xc7, 0xc1, 0x41, 0x43, 0x64, 0x0d, 0x11, 0xfd, 0x0a, 0x47, 0x7b, 0x0d, 0xf5, 0x67, 0x0e, + 0x1b, 0xbb, 0xa4, 0x5d, 0xe4, 0x23, 0xe3, 0xd6, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd9, 0xa0, + 0xe8, 0x2b, 0x05, 0x0f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1261,9 +1186,9 @@ type MsgClient interface { // The resulting evaluation is used to generate a cryptographic proof that the given Access Request // was valid at a particular block height. CheckAccess(ctx context.Context, in *MsgCheckAccess, opts ...grpc.CallOption) (*MsgCheckAccessResponse, error) - // PolicyCmd is a wrapper for a Command which is executed within the Context of a Policy. + // SignedPolicyCmd is a wrapper for a Command which is executed within the Context of a Policy. // The Command is signed by the Actor issuing it. - PolicyCmd(ctx context.Context, in *MsgPolicyCmd, opts ...grpc.CallOption) (*MsgPolicyCmdResponse, error) + SignedPolicyCmd(ctx context.Context, in *MsgSignedPolicyCmd, opts ...grpc.CallOption) (*MsgSignedPolicyCmdResponse, error) // BearerPolicyCmd is a Msg containing an instruction which changes the authorization // rules in a Policy. // This Msg authenticates the actor through the the Bearer authentication protocol. @@ -1346,9 +1271,9 @@ func (c *msgClient) CheckAccess(ctx context.Context, in *MsgCheckAccess, opts .. return out, nil } -func (c *msgClient) PolicyCmd(ctx context.Context, in *MsgPolicyCmd, opts ...grpc.CallOption) (*MsgPolicyCmdResponse, error) { - out := new(MsgPolicyCmdResponse) - err := c.cc.Invoke(ctx, "/sourcehub.acp.Msg/PolicyCmd", in, out, opts...) +func (c *msgClient) SignedPolicyCmd(ctx context.Context, in *MsgSignedPolicyCmd, opts ...grpc.CallOption) (*MsgSignedPolicyCmdResponse, error) { + out := new(MsgSignedPolicyCmdResponse) + err := c.cc.Invoke(ctx, "/sourcehub.acp.Msg/SignedPolicyCmd", in, out, opts...) if err != nil { return nil, err } @@ -1393,9 +1318,9 @@ type MsgServer interface { // The resulting evaluation is used to generate a cryptographic proof that the given Access Request // was valid at a particular block height. CheckAccess(context.Context, *MsgCheckAccess) (*MsgCheckAccessResponse, error) - // PolicyCmd is a wrapper for a Command which is executed within the Context of a Policy. + // SignedPolicyCmd is a wrapper for a Command which is executed within the Context of a Policy. // The Command is signed by the Actor issuing it. - PolicyCmd(context.Context, *MsgPolicyCmd) (*MsgPolicyCmdResponse, error) + SignedPolicyCmd(context.Context, *MsgSignedPolicyCmd) (*MsgSignedPolicyCmdResponse, error) // BearerPolicyCmd is a Msg containing an instruction which changes the authorization // rules in a Policy. // This Msg authenticates the actor through the the Bearer authentication protocol. @@ -1432,8 +1357,8 @@ func (*UnimplementedMsgServer) UnregisterObject(ctx context.Context, req *MsgUnr func (*UnimplementedMsgServer) CheckAccess(ctx context.Context, req *MsgCheckAccess) (*MsgCheckAccessResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CheckAccess not implemented") } -func (*UnimplementedMsgServer) PolicyCmd(ctx context.Context, req *MsgPolicyCmd) (*MsgPolicyCmdResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method PolicyCmd not implemented") +func (*UnimplementedMsgServer) SignedPolicyCmd(ctx context.Context, req *MsgSignedPolicyCmd) (*MsgSignedPolicyCmdResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SignedPolicyCmd not implemented") } func (*UnimplementedMsgServer) BearerPolicyCmd(ctx context.Context, req *MsgBearerPolicyCmd) (*MsgBearerPolicyCmdResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BearerPolicyCmd not implemented") @@ -1569,20 +1494,20 @@ func _Msg_CheckAccess_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } -func _Msg_PolicyCmd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgPolicyCmd) +func _Msg_SignedPolicyCmd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSignedPolicyCmd) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).PolicyCmd(ctx, in) + return srv.(MsgServer).SignedPolicyCmd(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/sourcehub.acp.Msg/PolicyCmd", + FullMethod: "/sourcehub.acp.Msg/SignedPolicyCmd", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).PolicyCmd(ctx, req.(*MsgPolicyCmd)) + return srv.(MsgServer).SignedPolicyCmd(ctx, req.(*MsgSignedPolicyCmd)) } return interceptor(ctx, in, info, handler) } @@ -1638,8 +1563,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_CheckAccess_Handler, }, { - MethodName: "PolicyCmd", - Handler: _Msg_PolicyCmd_Handler, + MethodName: "SignedPolicyCmd", + Handler: _Msg_SignedPolicyCmd_Handler, }, { MethodName: "BearerPolicyCmd", @@ -2269,7 +2194,7 @@ func (m *MsgCheckAccessResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *MsgPolicyCmd) Marshal() (dAtA []byte, err error) { +func (m *MsgSignedPolicyCmd) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2279,12 +2204,12 @@ func (m *MsgPolicyCmd) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgPolicyCmd) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgSignedPolicyCmd) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgPolicyCmd) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgSignedPolicyCmd) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2311,7 +2236,7 @@ func (m *MsgPolicyCmd) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgPolicyCmdResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgSignedPolicyCmdResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2321,38 +2246,19 @@ func (m *MsgPolicyCmdResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgPolicyCmdResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgSignedPolicyCmdResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgPolicyCmdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgSignedPolicyCmdResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l if m.Result != nil { { - size := m.Result.Size() - i -= size - if _, err := m.Result.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - } - } - return len(dAtA) - i, nil -} - -func (m *MsgPolicyCmdResponse_SetRelationshipResult) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgPolicyCmdResponse_SetRelationshipResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.SetRelationshipResult != nil { - { - size, err := m.SetRelationshipResult.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Result.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -2364,69 +2270,7 @@ func (m *MsgPolicyCmdResponse_SetRelationshipResult) MarshalToSizedBuffer(dAtA [ } return len(dAtA) - i, nil } -func (m *MsgPolicyCmdResponse_DeleteRelationshipResult) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgPolicyCmdResponse_DeleteRelationshipResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.DeleteRelationshipResult != nil { - { - size, err := m.DeleteRelationshipResult.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - return len(dAtA) - i, nil -} -func (m *MsgPolicyCmdResponse_RegisterObjectResult) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} -func (m *MsgPolicyCmdResponse_RegisterObjectResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.RegisterObjectResult != nil { - { - size, err := m.RegisterObjectResult.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - return len(dAtA) - i, nil -} -func (m *MsgPolicyCmdResponse_UnregisterObjectResult) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgPolicyCmdResponse_UnregisterObjectResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - if m.UnregisterObjectResult != nil { - { - size, err := m.UnregisterObjectResult.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - return len(dAtA) - i, nil -} func (m *MsgBearerPolicyCmd) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -2788,7 +2632,7 @@ func (m *MsgCheckAccessResponse) Size() (n int) { return n } -func (m *MsgPolicyCmd) Size() (n int) { +func (m *MsgSignedPolicyCmd) Size() (n int) { if m == nil { return 0 } @@ -2808,66 +2652,19 @@ func (m *MsgPolicyCmd) Size() (n int) { return n } -func (m *MsgPolicyCmdResponse) Size() (n int) { +func (m *MsgSignedPolicyCmdResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l if m.Result != nil { - n += m.Result.Size() - } - return n -} - -func (m *MsgPolicyCmdResponse_SetRelationshipResult) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.SetRelationshipResult != nil { - l = m.SetRelationshipResult.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n -} -func (m *MsgPolicyCmdResponse_DeleteRelationshipResult) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.DeleteRelationshipResult != nil { - l = m.DeleteRelationshipResult.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n -} -func (m *MsgPolicyCmdResponse_RegisterObjectResult) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.RegisterObjectResult != nil { - l = m.RegisterObjectResult.Size() - n += 1 + l + sovTx(uint64(l)) - } - return n -} -func (m *MsgPolicyCmdResponse_UnregisterObjectResult) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.UnregisterObjectResult != nil { - l = m.UnregisterObjectResult.Size() + l = m.Result.Size() n += 1 + l + sovTx(uint64(l)) } return n } + func (m *MsgBearerPolicyCmd) Size() (n int) { if m == nil { return 0 @@ -4631,7 +4428,7 @@ func (m *MsgCheckAccessResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgPolicyCmd) Unmarshal(dAtA []byte) error { +func (m *MsgSignedPolicyCmd) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4654,10 +4451,10 @@ func (m *MsgPolicyCmd) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgPolicyCmd: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSignedPolicyCmd: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgPolicyCmd: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSignedPolicyCmd: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4738,7 +4535,7 @@ func (m *MsgPolicyCmd) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Type |= MsgPolicyCmd_ContentType(b&0x7F) << shift + m.Type |= MsgSignedPolicyCmd_ContentType(b&0x7F) << shift if b < 0x80 { break } @@ -4764,7 +4561,7 @@ func (m *MsgPolicyCmd) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgPolicyCmdResponse) Unmarshal(dAtA []byte) error { +func (m *MsgSignedPolicyCmdResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4787,85 +4584,15 @@ func (m *MsgPolicyCmdResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgPolicyCmdResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgSignedPolicyCmdResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgPolicyCmdResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgSignedPolicyCmdResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SetRelationshipResult", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &SetRelationshipCmdResult{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Result = &MsgPolicyCmdResponse_SetRelationshipResult{v} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DeleteRelationshipResult", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - v := &DeleteRelationshipCmdResult{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Result = &MsgPolicyCmdResponse_DeleteRelationshipResult{v} - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RegisterObjectResult", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Result", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4892,46 +4619,12 @@ func (m *MsgPolicyCmdResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - v := &RegisterObjectCmdResult{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - m.Result = &MsgPolicyCmdResponse_RegisterObjectResult{v} - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnregisterObjectResult", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF + if m.Result == nil { + m.Result = &PolicyCmdResult{} } - v := &UnregisterObjectCmdResult{} - if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Result.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } - m.Result = &MsgPolicyCmdResponse_UnregisterObjectResult{v} iNdEx = postIndex default: iNdEx = preIndex