diff --git a/itest/test_list_on_test.go b/itest/test_list_on_test.go index ecdc77bcc..d1b0dfa5a 100644 --- a/itest/test_list_on_test.go +++ b/itest/test_list_on_test.go @@ -160,6 +160,10 @@ var testCases = []*testCase{ name: "burn test", test: testBurnAssets, }, + { + name: "federation sync config", + test: testFederationSyncConfig, + }, } var optionalTestCases = []*testCase{ diff --git a/itest/universe_test.go b/itest/universe_test.go index 76b491550..3d1599418 100644 --- a/itest/universe_test.go +++ b/itest/universe_test.go @@ -7,9 +7,12 @@ import ( "encoding/hex" "fmt" "io" + prand "math/rand" "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/btcec/v2/schnorr" + "github.com/lightninglabs/taproot-assets/internal/test" + tap "github.com/lightninglabs/taproot-assets" "github.com/lightninglabs/taproot-assets/asset" "github.com/lightninglabs/taproot-assets/fn" @@ -18,6 +21,7 @@ import ( "github.com/lightninglabs/taproot-assets/taprpc/mintrpc" unirpc "github.com/lightninglabs/taproot-assets/taprpc/universerpc" "github.com/lightninglabs/taproot-assets/universe" + "github.com/lightningnetwork/lnd/lntest/wait" "github.com/stretchr/testify/require" "golang.org/x/exp/maps" @@ -527,3 +531,131 @@ func testUniverseFederation(t *harnessTest) { require.NoError(t.t, err) require.Equal(t.t, 0, len(fedNodes.Servers)) } + +// testFederationSyncConfig tests that we can properly set and query the +// federation sync config. +func testFederationSyncConfig(t *harnessTest) { + ctx := context.Background() + + // Generate a random asset ID in order to generate a universe ID. + rand := prand.New(prand.NewSource(1)) + + // Generate universe ID #1. + assetIDBytes1 := make([]byte, 32) + _, _ = rand.Read(assetIDBytes1) + + var assetID1 asset.ID + copy(assetID1[:], assetIDBytes1) + + uniID1 := universe.Identifier{ + AssetID: assetID1, + ProofType: universe.ProofTypeIssuance, + } + uniIdRpc1 := unirpc.MarshalUniverseID(assetIDBytes1, nil) + uniIdRpc1.ProofType = unirpc.ProofType_PROOF_TYPE_ISSUANCE + + // Generate universe ID #2. + groupKey2 := test.RandPubKey(t.t) + groupKeyBytes2 := groupKey2.SerializeCompressed() + + uniID2 := universe.Identifier{ + GroupKey: groupKey2, + ProofType: universe.ProofTypeTransfer, + } + uniIdRpc2 := unirpc.MarshalUniverseID(nil, groupKeyBytes2) + uniIdRpc2.ProofType = unirpc.ProofType_PROOF_TYPE_TRANSFER + + // Set both the global and a universe specific federation sync configs. + globalConfigs := []*unirpc.GlobalFederationSyncConfig{ + { + ProofType: unirpc.ProofType_PROOF_TYPE_ISSUANCE, + AllowSyncInsert: true, + AllowSyncExport: false, + }, + { + ProofType: unirpc.ProofType_PROOF_TYPE_TRANSFER, + AllowSyncInsert: false, + AllowSyncExport: true, + }, + } + + assetSyncConfigs := []*unirpc.AssetFederationSyncConfig{ + { + Id: uniIdRpc1, + AllowSyncInsert: false, + AllowSyncExport: true, + }, + { + Id: uniIdRpc2, + AllowSyncInsert: true, + AllowSyncExport: false, + }, + } + + _, err := t.tapd.UniverseClient.SetFederationSyncConfig( + ctx, &unirpc.SetFederationSyncConfigRequest{ + GlobalSyncConfigs: globalConfigs, + AssetSyncConfigs: assetSyncConfigs, + }, + ) + require.NoError(t.t, err) + + resp, err := t.tapd.UniverseClient.QueryFederationSyncConfig( + ctx, &unirpc.QueryFederationSyncConfigRequest{}, + ) + require.NoError(t.t, err) + + // Ensure that the global configs are set as expected. + require.Equal(t.t, len(resp.GlobalSyncConfigs), 2) + + for i := range resp.GlobalSyncConfigs { + config := resp.GlobalSyncConfigs[i] + + // Match proof type. + switch config.ProofType { + case unirpc.ProofType_PROOF_TYPE_ISSUANCE: + require.True(t.t, config.AllowSyncInsert) + require.False(t.t, config.AllowSyncExport) + + case unirpc.ProofType_PROOF_TYPE_TRANSFER: + require.False(t.t, config.AllowSyncInsert) + require.True(t.t, config.AllowSyncExport) + + default: + t.Fatalf("unexpected global proof type: %s", + config.ProofType) + } + } + + // Ensure that the universe specific config is set as expected. + require.Equal(t.t, len(resp.AssetSyncConfigs), 2) + + for i := range resp.AssetSyncConfigs { + config := resp.AssetSyncConfigs[i] + + // Unmarshal the universe ID. + uniID, err := tap.UnmarshalUniID(config.Id) + require.NoError(t.t, err) + + switch uniID.String() { + case uniID1.String(): + require.Equal( + t.t, uniID.ProofType, + universe.ProofTypeIssuance, + ) + require.False(t.t, config.AllowSyncInsert) + require.True(t.t, config.AllowSyncExport) + + case uniID2.String(): + require.Equal( + t.t, uniID.ProofType, + universe.ProofTypeTransfer, + ) + require.True(t.t, config.AllowSyncInsert) + require.False(t.t, config.AllowSyncExport) + + default: + t.Fatalf("unexpected universe ID: %v", config.Id) + } + } +} diff --git a/perms/perms.go b/perms/perms.go index 09e1a6993..c1e66ed1c 100644 --- a/perms/perms.go +++ b/perms/perms.go @@ -188,6 +188,14 @@ var ( Entity: "universe", Action: "read", }}, + "/universerpc.Universe/SetFederationSyncConfig": {{ + Entity: "universe", + Action: "write", + }}, + "/universerpc.Universe/QueryFederationSyncConfig": {{ + Entity: "universe", + Action: "read", + }}, "/tapdevrpc.TapDev/ImportProof": {{ Entity: "proofs", Action: "write", diff --git a/rpcserver.go b/rpcserver.go index c99dedcf9..466d1a248 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -2662,15 +2662,34 @@ func UnmarshalUniProofType(rpcType unirpc.ProofType) (universe.ProofType, } } -// unmarshalUniID parses the RPC universe ID into the native counterpart. -func unmarshalUniID(rpcID *unirpc.ID) (universe.Identifier, error) { +// unmarshalAssetSyncConfig parses the RPC asset sync config into the native +// counterpart. +func unmarshalAssetSyncConfig( + config *unirpc.AssetFederationSyncConfig) (*universe.FedUniSyncConfig, + error) { + + // Parse the universe ID from the RPC form. + uniID, err := UnmarshalUniID(config.Id) + if err != nil { + return nil, fmt.Errorf("unable to parse universe id: %w", + err) + } + + return &universe.FedUniSyncConfig{ + UniverseID: uniID, + AllowSyncInsert: config.AllowSyncInsert, + AllowSyncExport: config.AllowSyncExport, + }, nil +} + +// UnmarshalUniID parses the RPC universe ID into the native counterpart. +func UnmarshalUniID(rpcID *unirpc.ID) (universe.Identifier, error) { // Unmarshal the proof type. proofType, err := UnmarshalUniProofType(rpcID.ProofType) if err != nil { return universe.Identifier{}, fmt.Errorf("unable to unmarshal "+ "proof type: %w", err) } - switch { case rpcID.GetAssetId() != nil: var assetID asset.ID @@ -2736,7 +2755,7 @@ func unmarshalUniID(rpcID *unirpc.ID) (universe.Identifier, error) { func (r *rpcServer) QueryAssetRoots(ctx context.Context, req *unirpc.AssetRootQuery) (*unirpc.QueryRootResponse, error) { - universeID, err := unmarshalUniID(req.Id) + universeID, err := UnmarshalUniID(req.Id) if err != nil { return nil, err } @@ -2794,7 +2813,7 @@ func (r *rpcServer) QueryAssetRoots(ctx context.Context, func (r *rpcServer) DeleteAssetRoot(ctx context.Context, req *unirpc.DeleteRootQuery) (*unirpc.DeleteRootResponse, error) { - universeID, err := unmarshalUniID(req.Id) + universeID, err := UnmarshalUniID(req.Id) if err != nil { return nil, err } @@ -2850,7 +2869,7 @@ func marshalLeafKey(leafKey universe.LeafKey) *unirpc.AssetKey { func (r *rpcServer) AssetLeafKeys(ctx context.Context, req *unirpc.ID) (*unirpc.AssetLeafKeyResponse, error) { - universeID, err := unmarshalUniID(req) + universeID, err := UnmarshalUniID(req) if err != nil { return nil, err } @@ -2912,7 +2931,7 @@ func (r *rpcServer) marshalAssetLeaf(ctx context.Context, func (r *rpcServer) AssetLeaves(ctx context.Context, req *unirpc.ID) (*unirpc.AssetLeafResponse, error) { - universeID, err := unmarshalUniID(req) + universeID, err := UnmarshalUniID(req) if err != nil { return nil, err } @@ -3101,7 +3120,7 @@ func (r *rpcServer) marshalIssuanceProof(ctx context.Context, func (r *rpcServer) QueryProof(ctx context.Context, req *unirpc.UniverseKey) (*unirpc.AssetProofResponse, error) { - universeID, err := unmarshalUniID(req.Id) + universeID, err := UnmarshalUniID(req.Id) if err != nil { return nil, err } @@ -3205,7 +3224,7 @@ func (r *rpcServer) InsertProof(ctx context.Context, return nil, fmt.Errorf("key cannot be nil") } - universeID, err := unmarshalUniID(req.Key.Id) + universeID, err := UnmarshalUniID(req.Key.Id) if err != nil { return nil, err } @@ -3291,7 +3310,7 @@ func unmarshalUniverseSyncType(req unirpc.UniverseSyncMode) ( func unmarshalSyncTargets(targets []*unirpc.SyncTarget) ([]universe.Identifier, error) { uniIDs := make([]universe.Identifier, 0, len(targets)) for _, target := range targets { - uniID, err := unmarshalUniID(target.Id) + uniID, err := UnmarshalUniID(target.Id) if err != nil { return nil, err } @@ -3458,6 +3477,113 @@ func (r *rpcServer) DeleteFederationServer(ctx context.Context, return &unirpc.DeleteFederationServerResponse{}, nil } +// SetFederationSyncConfig sets the configuration of the universe federation +// sync. +func (r *rpcServer) SetFederationSyncConfig(ctx context.Context, + req *unirpc.SetFederationSyncConfigRequest) ( + *unirpc.SetFederationSyncConfigResponse, error) { + + // Unmarshal global sync configs. + globalSyncConfig := make( + []*universe.FedGlobalSyncConfig, len(req.GlobalSyncConfigs), + ) + for i := range req.GlobalSyncConfigs { + config := req.GlobalSyncConfigs[i] + + proofType, err := UnmarshalUniProofType(config.ProofType) + if err != nil { + return nil, fmt.Errorf("unable to unmarshal "+ + "proof type: %w", err) + } + + globalSyncConfig[i] = &universe.FedGlobalSyncConfig{ + ProofType: proofType, + AllowSyncInsert: config.AllowSyncInsert, + AllowSyncExport: config.AllowSyncExport, + } + } + + // Unmarshal asset (asset/asset group) specific sync configs. + assetSyncConfigs := make( + []*universe.FedUniSyncConfig, len(req.AssetSyncConfigs), + ) + for i := range req.AssetSyncConfigs { + assetSyncConfig := req.AssetSyncConfigs[i] + config, err := unmarshalAssetSyncConfig(assetSyncConfig) + if err != nil { + return nil, fmt.Errorf("unable to parse asset sync "+ + "config: %w", err) + } + + assetSyncConfigs[i] = config + } + + // Update asset (asset/asset group) specific sync configs. + err := r.cfg.FederationDB.UpsertFederationSyncConfig( + ctx, globalSyncConfig, assetSyncConfigs, + ) + if err != nil { + return nil, fmt.Errorf("unable to set federation sync "+ + "config: %w", err) + } + + return &unirpc.SetFederationSyncConfigResponse{}, nil +} + +// QueryFederationSyncConfig queries the universe federation sync configuration +// settings. +func (r *rpcServer) QueryFederationSyncConfig(ctx context.Context, + _ *unirpc.QueryFederationSyncConfigRequest, +) (*unirpc.QueryFederationSyncConfigResponse, error) { + + // Obtain the general and universe specific federation sync configs. + queryFedSyncConfigs := r.cfg.FederationDB.QueryFederationSyncConfigs + globalConfigs, uniSyncConfigs, err := queryFedSyncConfigs(ctx) + if err != nil { + return nil, fmt.Errorf("unable to query federation sync "+ + "config(s): %w", err) + } + + // Marshal the general sync config into the RPC form. + globalConfigRPC := make( + []*unirpc.GlobalFederationSyncConfig, len(globalConfigs), + ) + for i := range globalConfigs { + globalConfig := globalConfigs[i] + + proofTypeRpc, err := MarshalUniProofType(globalConfig.ProofType) + if err != nil { + return nil, fmt.Errorf("unable to unmarshal "+ + "proof type: %w", err) + } + + globalConfigRPC[i] = &unirpc.GlobalFederationSyncConfig{ + ProofType: proofTypeRpc, + AllowSyncInsert: globalConfig.AllowSyncInsert, + AllowSyncExport: globalConfig.AllowSyncExport, + } + } + + // Marshal universe specific sync configs into the RPC form. + uniConfigRPCs := make( + []*unirpc.AssetFederationSyncConfig, len(uniSyncConfigs), + ) + for i := range uniSyncConfigs { + uniSyncConfig := uniSyncConfigs[i] + uniConfigRPC, err := MarshalAssetFedSyncCfg(*uniSyncConfig) + if err != nil { + return nil, fmt.Errorf("unable to marshal universe "+ + "specific federation sync config: %w", err) + } + uniConfigRPCs[i] = uniConfigRPC + } + + return &unirpc.QueryFederationSyncConfigResponse{ + GlobalSyncConfigs: globalConfigRPC, + AssetSyncConfigs: uniConfigRPCs, + }, nil +} + // ProveAssetOwnership creates an ownership proof embedded in an asset // transition proof. That ownership proof is a signed virtual transaction // spending the asset with a valid witness to prove the prover owns the keys @@ -3768,3 +3894,33 @@ func unmarshalMetaType(rpcMeta taprpc.AssetMetaType) (proof.MetaType, error) { return 0, fmt.Errorf("unknown meta type: %v", rpcMeta) } } + +// MarshalAssetFedSyncCfg returns an RPC ready asset specific federation sync +// config. +func MarshalAssetFedSyncCfg( + config universe.FedUniSyncConfig) (*unirpc.AssetFederationSyncConfig, + error) { + + // Marshal universe ID into the RPC form. + uniID := config.UniverseID + assetIDBytes := uniID.AssetID[:] + + var groupKeyBytes []byte + if uniID.GroupKey != nil { + groupKeyBytes = uniID.GroupKey.SerializeCompressed() + } + uniIdRPC := unirpc.MarshalUniverseID(assetIDBytes, groupKeyBytes) + + // Marshal proof type. + proofTypeRpc, err := MarshalUniProofType(uniID.ProofType) + if err != nil { + return nil, fmt.Errorf("unable to marshal proof type: %w", err) + } + uniIdRPC.ProofType = proofTypeRpc + + return &unirpc.AssetFederationSyncConfig{ + Id: uniIdRPC, + AllowSyncInsert: config.AllowSyncInsert, + AllowSyncExport: config.AllowSyncExport, + }, nil +} diff --git a/tapdb/sqlc/migrations/000007_universe.down.sql b/tapdb/sqlc/migrations/000007_universe.down.sql index 65e36e1f5..e44ba3dfa 100644 --- a/tapdb/sqlc/migrations/000007_universe.down.sql +++ b/tapdb/sqlc/migrations/000007_universe.down.sql @@ -1,6 +1,8 @@ DROP TABLE IF EXISTS universe_leaves; DROP TABLE IF EXISTS universe_roots; DROP TABLE IF EXISTS universe_servers; +DROP TABLE IF EXISTS federation_global_sync_config; +DROP TABLE IF EXISTS federation_uni_sync_config; DROP INDEX IF EXISTS universe_servers_host; DROP TABLE IF EXISTS universe_events; DROP INDEX IF EXISTS universe_events_event_time_idx; @@ -8,4 +10,4 @@ DROP INDEX IF EXISTS universe_events_type_idx; DROP INDEX IF EXISTS universe_roots_asset_id_idx; DROP INDEX IF EXISTS universe_roots_group_key_idx; DROP INDEX IF EXISTS universe_leaves_key_idx; -DROP INDEX IF EXISTS universe_leaves_namespace; +DROP INDEX IF EXISTS universe_leaves_namespace; \ No newline at end of file diff --git a/tapdb/sqlc/migrations/000007_universe.up.sql b/tapdb/sqlc/migrations/000007_universe.up.sql index 60e563db1..8f44d55c4 100644 --- a/tapdb/sqlc/migrations/000007_universe.up.sql +++ b/tapdb/sqlc/migrations/000007_universe.up.sql @@ -85,3 +85,52 @@ CREATE VIEW universe_stats AS FROM universe_events u JOIN universe_roots roots ON u.universe_root_id = roots.id GROUP BY roots.asset_id, roots.group_key, roots.namespace_root; + +-- This table contains global configuration for universe federation syncing. +CREATE TABLE IF NOT EXISTS federation_global_sync_config ( + -- This field is an enum representing the proof type stored in the given + -- universe. + proof_type TEXT NOT NULL PRIMARY KEY CHECK(proof_type IN ('issuance', 'transfer')), + + -- This field is a boolean that indicates whether or not a universe of the + -- given proof type should accept remote proof insertion via federation + -- sync. + allow_sync_insert BOOLEAN NOT NULL, + + -- This field is a boolean that indicates whether or not a universe of the + -- given proof type should accept remote proof export via federation sync. + allow_sync_export BOOLEAN NOT NULL +); + +-- This table contains universe (asset/asset group) specific federation sync +-- configuration. +CREATE TABLE IF NOT EXISTS federation_uni_sync_config ( + -- This field contains the byte serialized ID of the asset to which this + -- configuration is applicable + asset_id BLOB CHECK(length(asset_id) = 32) NULL, + + -- This field contains the byte serialized compressed group key public key + -- of the asset group to which this configuration is applicable. + group_key BLOB CHECK(LENGTH(group_key) = 33) NULL, + + -- This field is an enum representing the proof type stored in the given + -- universe. + proof_type TEXT NOT NULL CHECK(proof_type IN ('issuance', 'transfer')), + + -- This field is a boolean that indicates whether or not the given universe + -- should accept remote proof insertion via federation sync. + allow_sync_insert BOOLEAN NOT NULL, + + -- This field is a boolean that indicates whether or not the given universe + -- should accept remote proof export via federation sync. + allow_sync_export BOOLEAN NOT NULL, + + -- Both the asset ID and group key cannot be null at the same time. + CHECK ( + (asset_id IS NOT NULL AND group_key IS NULL) OR + (asset_id IS NULL AND group_key IS NOT NULL) + ), + + -- Ensure that the universe identifier fields form a unique tuple. + UNIQUE (asset_id, group_key, proof_type) +); \ No newline at end of file diff --git a/tapdb/sqlc/models.go b/tapdb/sqlc/models.go index ead99437d..e15ea0fd0 100644 --- a/tapdb/sqlc/models.go +++ b/tapdb/sqlc/models.go @@ -158,6 +158,20 @@ type ChainTxn struct { TxIndex sql.NullInt32 } +type FederationGlobalSyncConfig struct { + ProofType string + AllowSyncInsert bool + AllowSyncExport bool +} + +type FederationUniSyncConfig struct { + AssetID []byte + GroupKey []byte + ProofType string + AllowSyncInsert bool + AllowSyncExport bool +} + type GenesisAsset struct { GenAssetID int64 AssetID []byte diff --git a/tapdb/sqlc/querier.go b/tapdb/sqlc/querier.go index f2793b016..97a4c44a1 100644 --- a/tapdb/sqlc/querier.go +++ b/tapdb/sqlc/querier.go @@ -121,6 +121,8 @@ type Querier interface { // specified. QueryAssets(ctx context.Context, arg QueryAssetsParams) ([]QueryAssetsRow, error) QueryEventIDs(ctx context.Context, arg QueryEventIDsParams) ([]QueryEventIDsRow, error) + QueryFederationGlobalSyncConfigs(ctx context.Context) ([]FederationGlobalSyncConfig, error) + QueryFederationUniSyncConfigs(ctx context.Context) ([]FederationUniSyncConfig, error) QueryPassiveAssets(ctx context.Context, transferID int64) ([]QueryPassiveAssetsRow, error) QueryReceiverProofTransferAttempt(ctx context.Context, proofLocatorHash []byte) ([]time.Time, error) // TODO(roasbeef): use the universe id instead for the grouping? so namespace @@ -142,6 +144,8 @@ type Querier interface { UpsertAssetMeta(ctx context.Context, arg UpsertAssetMetaParams) (int64, error) UpsertAssetProof(ctx context.Context, arg UpsertAssetProofParams) error UpsertChainTx(ctx context.Context, arg UpsertChainTxParams) (int64, error) + UpsertFederationGlobalSyncConfig(ctx context.Context, arg UpsertFederationGlobalSyncConfigParams) error + UpsertFederationUniSyncConfig(ctx context.Context, arg UpsertFederationUniSyncConfigParams) error UpsertGenesisAsset(ctx context.Context, arg UpsertGenesisAssetParams) (int64, error) UpsertGenesisPoint(ctx context.Context, prevOut []byte) (int64, error) UpsertInternalKey(ctx context.Context, arg UpsertInternalKeyParams) (int64, error) diff --git a/tapdb/sqlc/queries/universe.sql b/tapdb/sqlc/queries/universe.sql index c37df7d5f..c19a655c7 100644 --- a/tapdb/sqlc/queries/universe.sql +++ b/tapdb/sqlc/queries/universe.sql @@ -262,3 +262,33 @@ WHERE event_type IN ('SYNC', 'NEW_PROOF') AND event_timestamp >= @start_time AND event_timestamp <= @end_time GROUP BY day ORDER BY day; + +-- name: UpsertFederationGlobalSyncConfig :exec +INSERT INTO federation_global_sync_config ( + proof_type, allow_sync_insert, allow_sync_export +) +VALUES (@proof_type, @allow_sync_insert, @allow_sync_export) +ON CONFLICT(proof_type) + DO UPDATE SET + allow_sync_insert = @allow_sync_insert, + allow_sync_export = @allow_sync_export; + +-- name: QueryFederationGlobalSyncConfigs :many +SELECT proof_type, allow_sync_insert, allow_sync_export +FROM federation_global_sync_config; + +-- name: UpsertFederationUniSyncConfig :exec +INSERT INTO federation_uni_sync_config ( + asset_id, group_key, proof_type, allow_sync_insert, allow_sync_export +) +VALUES( + @asset_id, @group_key, @proof_type, @allow_sync_insert, @allow_sync_export +) +ON CONFLICT(asset_id, group_key, proof_type) + DO UPDATE SET + allow_sync_insert = @allow_sync_insert, + allow_sync_export = @allow_sync_export; + +-- name: QueryFederationUniSyncConfigs :many +SELECT asset_id, group_key, proof_type, allow_sync_insert, allow_sync_export +FROM federation_uni_sync_config; \ No newline at end of file diff --git a/tapdb/sqlc/universe.sql.go b/tapdb/sqlc/universe.sql.go index 0893e562d..a9c430250 100644 --- a/tapdb/sqlc/universe.sql.go +++ b/tapdb/sqlc/universe.sql.go @@ -372,6 +372,68 @@ func (q *Queries) QueryAssetStatsPerDaySqlite(ctx context.Context, arg QueryAsse return items, nil } +const queryFederationGlobalSyncConfigs = `-- name: QueryFederationGlobalSyncConfigs :many +SELECT proof_type, allow_sync_insert, allow_sync_export +FROM federation_global_sync_config +` + +func (q *Queries) QueryFederationGlobalSyncConfigs(ctx context.Context) ([]FederationGlobalSyncConfig, error) { + rows, err := q.db.QueryContext(ctx, queryFederationGlobalSyncConfigs) + if err != nil { + return nil, err + } + defer rows.Close() + var items []FederationGlobalSyncConfig + for rows.Next() { + var i FederationGlobalSyncConfig + if err := rows.Scan(&i.ProofType, &i.AllowSyncInsert, &i.AllowSyncExport); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + +const queryFederationUniSyncConfigs = `-- name: QueryFederationUniSyncConfigs :many +SELECT asset_id, group_key, proof_type, allow_sync_insert, allow_sync_export +FROM federation_uni_sync_config +` + +func (q *Queries) QueryFederationUniSyncConfigs(ctx context.Context) ([]FederationUniSyncConfig, error) { + rows, err := q.db.QueryContext(ctx, queryFederationUniSyncConfigs) + if err != nil { + return nil, err + } + defer rows.Close() + var items []FederationUniSyncConfig + for rows.Next() { + var i FederationUniSyncConfig + if err := rows.Scan( + &i.AssetID, + &i.GroupKey, + &i.ProofType, + &i.AllowSyncInsert, + &i.AllowSyncExport, + ); err != nil { + return nil, err + } + items = append(items, i) + } + if err := rows.Close(); err != nil { + return nil, err + } + if err := rows.Err(); err != nil { + return nil, err + } + return items, nil +} + const queryUniverseAssetStats = `-- name: QueryUniverseAssetStats :many WITH asset_supply AS ( @@ -680,6 +742,60 @@ func (q *Queries) UniverseRoots(ctx context.Context) ([]UniverseRootsRow, error) return items, nil } +const upsertFederationGlobalSyncConfig = `-- name: UpsertFederationGlobalSyncConfig :exec +INSERT INTO federation_global_sync_config ( + proof_type, allow_sync_insert, allow_sync_export +) +VALUES ($1, $2, $3) +ON CONFLICT(proof_type) + DO UPDATE SET + allow_sync_insert = $2, + allow_sync_export = $3 +` + +type UpsertFederationGlobalSyncConfigParams struct { + ProofType string + AllowSyncInsert bool + AllowSyncExport bool +} + +func (q *Queries) UpsertFederationGlobalSyncConfig(ctx context.Context, arg UpsertFederationGlobalSyncConfigParams) error { + _, err := q.db.ExecContext(ctx, upsertFederationGlobalSyncConfig, arg.ProofType, arg.AllowSyncInsert, arg.AllowSyncExport) + return err +} + +const upsertFederationUniSyncConfig = `-- name: UpsertFederationUniSyncConfig :exec +INSERT INTO federation_uni_sync_config ( + asset_id, group_key, proof_type, allow_sync_insert, allow_sync_export +) +VALUES( + $1, $2, $3, $4, $5 +) +ON CONFLICT(asset_id, group_key, proof_type) + DO UPDATE SET + allow_sync_insert = $4, + allow_sync_export = $5 +` + +type UpsertFederationUniSyncConfigParams struct { + AssetID []byte + GroupKey []byte + ProofType string + AllowSyncInsert bool + AllowSyncExport bool +} + +func (q *Queries) UpsertFederationUniSyncConfig(ctx context.Context, arg UpsertFederationUniSyncConfigParams) error { + _, err := q.db.ExecContext(ctx, upsertFederationUniSyncConfig, + arg.AssetID, + arg.GroupKey, + arg.ProofType, + arg.AllowSyncInsert, + arg.AllowSyncExport, + ) + return err +} + const upsertUniverseLeaf = `-- name: UpsertUniverseLeaf :exec INSERT INTO universe_leaves ( asset_genesis_id, script_key_bytes, universe_root_id, leaf_node_key, diff --git a/tapdb/universe_federation.go b/tapdb/universe_federation.go index cd394b5b6..ce3dd8caa 100644 --- a/tapdb/universe_federation.go +++ b/tapdb/universe_federation.go @@ -2,9 +2,13 @@ package tapdb import ( "context" + "database/sql" "errors" + "fmt" "time" + "github.com/btcsuite/btcd/btcec/v2" + "github.com/lightninglabs/taproot-assets/asset" "github.com/lightninglabs/taproot-assets/fn" "github.com/lightninglabs/taproot-assets/tapdb/sqlc" "github.com/lightninglabs/taproot-assets/universe" @@ -17,11 +21,70 @@ type ( // DelUniverseServer is used to delete a universe server. DelUniverseServer = sqlc.DeleteUniverseServerParams + + // UpsertFedGlobalSyncConfigParams is used to set the global federation + // sync configuration for a given proof type. + UpsertFedGlobalSyncConfigParams = sqlc.UpsertFederationGlobalSyncConfigParams + + // FedGlobalSyncConfig is the proof type specific global federation sync + // config returned from a query. + FedGlobalSyncConfig = sqlc.FederationGlobalSyncConfig + + // UpsertFedUniSyncConfigParams is used to set the universe specific + // federation sync configuration. + UpsertFedUniSyncConfigParams = sqlc.UpsertFederationUniSyncConfigParams + + // FedUniSyncConfigs is the universe specific federation sync config + // returned from a query. + FedUniSyncConfigs = sqlc.FederationUniSyncConfig ) +var ( + // defaultGlobalSyncConfigs is the default set of global federation + // sync configs that will be used if no global configs have been set. + defaultGlobalSyncConfigs = []*universe.FedGlobalSyncConfig{ + { + ProofType: universe.ProofTypeIssuance, + AllowSyncInsert: false, + AllowSyncExport: false, + }, + { + ProofType: universe.ProofTypeTransfer, + AllowSyncInsert: false, + AllowSyncExport: false, + }, + } +) + +// FederationSyncConfigStore is used to manage the set of Universe servers as +// part of a federation. +type FederationSyncConfigStore interface { + // UpsertFederationGlobalSyncConfig sets the global federation sync + // config for a given proof type. + UpsertFederationGlobalSyncConfig(ctx context.Context, + arg UpsertFedGlobalSyncConfigParams) error + + // QueryFederationGlobalSyncConfigs returns all global federation sync + // configurations. + QueryFederationGlobalSyncConfigs( + ctx context.Context) ([]FedGlobalSyncConfig, error) + + // UpsertFederationUniSyncConfig inserts or updates a universe specific + // federation sync config. + UpsertFederationUniSyncConfig(ctx context.Context, + arg UpsertFedUniSyncConfigParams) error + + // QueryFederationUniSyncConfigs returns the set of universe specific + // federation sync configs. + QueryFederationUniSyncConfigs(ctx context.Context) ([]FedUniSyncConfigs, + error) +} + // UniverseServerStore is used to manage the set of Universe servers as part // of a federation. type UniverseServerStore interface { + FederationSyncConfigStore + // InsertUniverseServer inserts a new universe server in to the DB. InsertUniverseServer(ctx context.Context, arg NewUniverseServer) error @@ -174,4 +237,179 @@ func (u *UniverseFederationDB) LogNewSyncs(ctx context.Context, }) } -var _ universe.FederationLog = (*UniverseFederationDB)(nil) +// UpsertFederationSyncConfig upserts both the global and universe specific +// federation sync configs. +func (u *UniverseFederationDB) UpsertFederationSyncConfig( + ctx context.Context, globalSyncConfigs []*universe.FedGlobalSyncConfig, + uniSyncConfigs []*universe.FedUniSyncConfig) error { + + var writeTx UniverseFederationOptions + return u.db.ExecTx(ctx, &writeTx, func(db UniverseServerStore) error { + // Upsert global proof type specific federation sync + // configs. + for i := range globalSyncConfigs { + config := globalSyncConfigs[i] + + params := UpsertFedGlobalSyncConfigParams{ + ProofType: config.ProofType.String(), + AllowSyncInsert: config.AllowSyncInsert, + AllowSyncExport: config.AllowSyncExport, + } + err := db.UpsertFederationGlobalSyncConfig(ctx, params) + if err != nil { + return err + } + } + + // Upsert universe specific sync configs. + for i := range uniSyncConfigs { + var ( + config = uniSyncConfigs[i] + + uniID = config.UniverseID + groupPubKey []byte + assetIDBytes []byte + ) + + // If the group key is set, then we'll serialize it + // into bytes. + if uniID.GroupKey != nil { + groupPubKey = uniID.GroupKey.SerializeCompressed() + } else { + // If the group key is not set, then we'll use + // the asset ID. The group key supersedes the + // asset ID. + assetIDBytes = uniID.AssetID[:] + } + + err := db.UpsertFederationUniSyncConfig( + ctx, UpsertFedUniSyncConfigParams{ + AssetID: assetIDBytes, + GroupKey: groupPubKey, + ProofType: uniID.ProofType.String(), + AllowSyncInsert: config.AllowSyncInsert, + AllowSyncExport: config.AllowSyncExport, + }, + ) + if err != nil { + return err + } + } + + return nil + }) +} + +// QueryFederationSyncConfigs returns the global and universe specific +// federation sync configs. +func (u *UniverseFederationDB) QueryFederationSyncConfigs( + ctx context.Context) ([]*universe.FedGlobalSyncConfig, + []*universe.FedUniSyncConfig, error) { + + var ( + readTx UniverseFederationOptions + + globalConfigs []*universe.FedGlobalSyncConfig + uniConfigs []*universe.FedUniSyncConfig + ) + + err := u.db.ExecTx(ctx, &readTx, func(db UniverseServerStore) error { + // Query for global sync configs. + globalDbConfigs, err := db.QueryFederationGlobalSyncConfigs( + ctx, + ) + switch { + case errors.Is(err, sql.ErrNoRows): + // If the query does not return any rows then a global + // config for each proof type has not yet been set. We + // will return a default config for each proof type. + globalConfigs = defaultGlobalSyncConfigs + + case err != nil: + return err + + default: + // Parse global db sync configs. + globalConfigs = make( + []*universe.FedGlobalSyncConfig, + len(globalDbConfigs), + ) + for i := range globalDbConfigs { + config := globalDbConfigs[i] + + proofType, err := universe.ParseStrProofType( + config.ProofType, + ) + if err != nil { + return err + } + + globalConfigs[i] = &universe.FedGlobalSyncConfig{ + ProofType: proofType, + AllowSyncInsert: config.AllowSyncInsert, + AllowSyncExport: config.AllowSyncExport, + } + } + } + + // Query for universe specific sync configs. + uniDbConfigs, err := db.QueryFederationUniSyncConfigs(ctx) + if err != nil { + return err + } + + // Parse universe specific sync configs. + uniConfigs = make( + []*universe.FedUniSyncConfig, len(uniDbConfigs), + ) + + for i := range uniDbConfigs { + conf := uniDbConfigs[i] + + proofType, err := universe.ParseStrProofType( + conf.ProofType, + ) + if err != nil { + return err + } + + // Construct group key public key from bytes. + var pubKey *btcec.PublicKey + if conf.GroupKey != nil { + pubKey, err = btcec.ParsePubKey(conf.GroupKey) + if err != nil { + return fmt.Errorf("unable to parse "+ + "group key: %v", err) + } + } + + // Construct asset ID from bytes. + var assetID asset.ID + copy(assetID[:], conf.AssetID) + + uniID := universe.Identifier{ + AssetID: assetID, + GroupKey: pubKey, + ProofType: proofType, + } + + uniConfigs[i] = &universe.FedUniSyncConfig{ + UniverseID: uniID, + AllowSyncInsert: conf.AllowSyncInsert, + AllowSyncExport: conf.AllowSyncExport, + } + } + return nil + }) + if err != nil { + return nil, nil, err + } + + return globalConfigs, uniConfigs, nil +} + +// Check at compile time that we implement the correct interfaces. +var ( + _ universe.FederationLog = (*UniverseFederationDB)(nil) + _ universe.FederationSyncConfigDB = (*UniverseFederationDB)(nil) +) diff --git a/taprpc/universerpc/universe.pb.go b/taprpc/universerpc/universe.pb.go index 2be61d631..39ff2d98d 100644 --- a/taprpc/universerpc/universe.pb.go +++ b/taprpc/universerpc/universe.pb.go @@ -2533,6 +2533,346 @@ func (x *GroupedUniverseEvents) GetNewProofEvents() uint64 { return 0 } +type SetFederationSyncConfigRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + GlobalSyncConfigs []*GlobalFederationSyncConfig `protobuf:"bytes,1,rep,name=global_sync_configs,json=globalSyncConfigs,proto3" json:"global_sync_configs,omitempty"` + AssetSyncConfigs []*AssetFederationSyncConfig `protobuf:"bytes,2,rep,name=asset_sync_configs,json=assetSyncConfigs,proto3" json:"asset_sync_configs,omitempty"` +} + +func (x *SetFederationSyncConfigRequest) Reset() { + *x = SetFederationSyncConfigRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_universerpc_universe_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetFederationSyncConfigRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetFederationSyncConfigRequest) ProtoMessage() {} + +func (x *SetFederationSyncConfigRequest) ProtoReflect() protoreflect.Message { + mi := &file_universerpc_universe_proto_msgTypes[38] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetFederationSyncConfigRequest.ProtoReflect.Descriptor instead. +func (*SetFederationSyncConfigRequest) Descriptor() ([]byte, []int) { + return file_universerpc_universe_proto_rawDescGZIP(), []int{38} +} + +func (x *SetFederationSyncConfigRequest) GetGlobalSyncConfigs() []*GlobalFederationSyncConfig { + if x != nil { + return x.GlobalSyncConfigs + } + return nil +} + +func (x *SetFederationSyncConfigRequest) GetAssetSyncConfigs() []*AssetFederationSyncConfig { + if x != nil { + return x.AssetSyncConfigs + } + return nil +} + +type SetFederationSyncConfigResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *SetFederationSyncConfigResponse) Reset() { + *x = SetFederationSyncConfigResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_universerpc_universe_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SetFederationSyncConfigResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SetFederationSyncConfigResponse) ProtoMessage() {} + +func (x *SetFederationSyncConfigResponse) ProtoReflect() protoreflect.Message { + mi := &file_universerpc_universe_proto_msgTypes[39] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SetFederationSyncConfigResponse.ProtoReflect.Descriptor instead. +func (*SetFederationSyncConfigResponse) Descriptor() ([]byte, []int) { + return file_universerpc_universe_proto_rawDescGZIP(), []int{39} +} + +// GlobalFederationSyncConfig is a global proof type specific configuration +// for universe federation syncing. +type GlobalFederationSyncConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // proof_type is the universe proof type which this config applies to. + ProofType ProofType `protobuf:"varint,1,opt,name=proof_type,json=proofType,proto3,enum=universerpc.ProofType" json:"proof_type,omitempty"` + // allow_sync_insert is a boolean that indicates whether leaves from + // universes of the given proof type have may be inserted via federation + // sync. + AllowSyncInsert bool `protobuf:"varint,2,opt,name=allow_sync_insert,json=allowSyncInsert,proto3" json:"allow_sync_insert,omitempty"` + // allow_sync_export is a boolean that indicates whether leaves from + // universes of the given proof type have may be exported via federation + // sync. + AllowSyncExport bool `protobuf:"varint,3,opt,name=allow_sync_export,json=allowSyncExport,proto3" json:"allow_sync_export,omitempty"` +} + +func (x *GlobalFederationSyncConfig) Reset() { + *x = GlobalFederationSyncConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_universerpc_universe_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GlobalFederationSyncConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GlobalFederationSyncConfig) ProtoMessage() {} + +func (x *GlobalFederationSyncConfig) ProtoReflect() protoreflect.Message { + mi := &file_universerpc_universe_proto_msgTypes[40] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GlobalFederationSyncConfig.ProtoReflect.Descriptor instead. +func (*GlobalFederationSyncConfig) Descriptor() ([]byte, []int) { + return file_universerpc_universe_proto_rawDescGZIP(), []int{40} +} + +func (x *GlobalFederationSyncConfig) GetProofType() ProofType { + if x != nil { + return x.ProofType + } + return ProofType_PROOF_TYPE_UNSPECIFIED +} + +func (x *GlobalFederationSyncConfig) GetAllowSyncInsert() bool { + if x != nil { + return x.AllowSyncInsert + } + return false +} + +func (x *GlobalFederationSyncConfig) GetAllowSyncExport() bool { + if x != nil { + return x.AllowSyncExport + } + return false +} + +// AssetFederationSyncConfig is an asset universe specific configuration for +// federation syncing. +type AssetFederationSyncConfig struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // id is the ID of the universe to configure. + Id *ID `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + // allow_sync_insert is a boolean that indicates whether leaves from + // universes of the given proof type have may be inserted via federation + // sync. + AllowSyncInsert bool `protobuf:"varint,2,opt,name=allow_sync_insert,json=allowSyncInsert,proto3" json:"allow_sync_insert,omitempty"` + // allow_sync_export is a boolean that indicates whether leaves from + // universes of the given proof type have may be exported via federation + // sync. + AllowSyncExport bool `protobuf:"varint,3,opt,name=allow_sync_export,json=allowSyncExport,proto3" json:"allow_sync_export,omitempty"` +} + +func (x *AssetFederationSyncConfig) Reset() { + *x = AssetFederationSyncConfig{} + if protoimpl.UnsafeEnabled { + mi := &file_universerpc_universe_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AssetFederationSyncConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AssetFederationSyncConfig) ProtoMessage() {} + +func (x *AssetFederationSyncConfig) ProtoReflect() protoreflect.Message { + mi := &file_universerpc_universe_proto_msgTypes[41] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AssetFederationSyncConfig.ProtoReflect.Descriptor instead. +func (*AssetFederationSyncConfig) Descriptor() ([]byte, []int) { + return file_universerpc_universe_proto_rawDescGZIP(), []int{41} +} + +func (x *AssetFederationSyncConfig) GetId() *ID { + if x != nil { + return x.Id + } + return nil +} + +func (x *AssetFederationSyncConfig) GetAllowSyncInsert() bool { + if x != nil { + return x.AllowSyncInsert + } + return false +} + +func (x *AssetFederationSyncConfig) GetAllowSyncExport() bool { + if x != nil { + return x.AllowSyncExport + } + return false +} + +type QueryFederationSyncConfigRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Target universe ID(s). + Id []*ID `protobuf:"bytes,1,rep,name=id,proto3" json:"id,omitempty"` +} + +func (x *QueryFederationSyncConfigRequest) Reset() { + *x = QueryFederationSyncConfigRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_universerpc_universe_proto_msgTypes[42] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryFederationSyncConfigRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryFederationSyncConfigRequest) ProtoMessage() {} + +func (x *QueryFederationSyncConfigRequest) ProtoReflect() protoreflect.Message { + mi := &file_universerpc_universe_proto_msgTypes[42] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueryFederationSyncConfigRequest.ProtoReflect.Descriptor instead. +func (*QueryFederationSyncConfigRequest) Descriptor() ([]byte, []int) { + return file_universerpc_universe_proto_rawDescGZIP(), []int{42} +} + +func (x *QueryFederationSyncConfigRequest) GetId() []*ID { + if x != nil { + return x.Id + } + return nil +} + +type QueryFederationSyncConfigResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + GlobalSyncConfigs []*GlobalFederationSyncConfig `protobuf:"bytes,1,rep,name=global_sync_configs,json=globalSyncConfigs,proto3" json:"global_sync_configs,omitempty"` + AssetSyncConfigs []*AssetFederationSyncConfig `protobuf:"bytes,2,rep,name=asset_sync_configs,json=assetSyncConfigs,proto3" json:"asset_sync_configs,omitempty"` +} + +func (x *QueryFederationSyncConfigResponse) Reset() { + *x = QueryFederationSyncConfigResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_universerpc_universe_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryFederationSyncConfigResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryFederationSyncConfigResponse) ProtoMessage() {} + +func (x *QueryFederationSyncConfigResponse) ProtoReflect() protoreflect.Message { + mi := &file_universerpc_universe_proto_msgTypes[43] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueryFederationSyncConfigResponse.ProtoReflect.Descriptor instead. +func (*QueryFederationSyncConfigResponse) Descriptor() ([]byte, []int) { + return file_universerpc_universe_proto_rawDescGZIP(), []int{43} +} + +func (x *QueryFederationSyncConfigResponse) GetGlobalSyncConfigs() []*GlobalFederationSyncConfig { + if x != nil { + return x.GlobalSyncConfigs + } + return nil +} + +func (x *QueryFederationSyncConfigResponse) GetAssetSyncConfigs() []*AssetFederationSyncConfig { + if x != nil { + return x.AssetSyncConfigs + } + return nil +} + var File_universerpc_universe_proto protoreflect.FileDescriptor var file_universerpc_universe_proto_rawDesc = []byte{ @@ -2820,121 +3160,189 @@ var file_universerpc_universe_proto_rawDesc = []byte{ 0x04, 0x52, 0x0a, 0x73, 0x79, 0x6e, 0x63, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x28, 0x0a, 0x10, 0x6e, 0x65, 0x77, 0x5f, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0e, 0x6e, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6f, - 0x66, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2a, 0x59, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x6f, 0x66, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, - 0x12, 0x17, 0x0a, 0x13, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, - 0x53, 0x53, 0x55, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x01, 0x12, 0x17, 0x0a, 0x13, 0x50, 0x52, 0x4f, - 0x4f, 0x46, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x46, 0x45, 0x52, - 0x10, 0x02, 0x2a, 0x39, 0x0a, 0x10, 0x55, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x53, 0x79, - 0x6e, 0x63, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x59, 0x4e, 0x43, 0x5f, 0x49, - 0x53, 0x53, 0x55, 0x41, 0x4e, 0x43, 0x45, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x00, 0x12, 0x0d, - 0x0a, 0x09, 0x53, 0x59, 0x4e, 0x43, 0x5f, 0x46, 0x55, 0x4c, 0x4c, 0x10, 0x01, 0x2a, 0xd1, 0x01, - 0x0a, 0x0e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x6f, 0x72, 0x74, - 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x4f, 0x52, 0x54, 0x5f, 0x42, 0x59, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, - 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x52, 0x54, 0x5f, 0x42, 0x59, 0x5f, 0x41, 0x53, - 0x53, 0x45, 0x54, 0x5f, 0x4e, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x4f, - 0x52, 0x54, 0x5f, 0x42, 0x59, 0x5f, 0x41, 0x53, 0x53, 0x45, 0x54, 0x5f, 0x49, 0x44, 0x10, 0x02, - 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x52, 0x54, 0x5f, 0x42, 0x59, 0x5f, 0x41, 0x53, 0x53, 0x45, - 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x10, 0x03, 0x12, 0x17, 0x0a, 0x13, 0x53, 0x4f, 0x52, 0x54, - 0x5f, 0x42, 0x59, 0x5f, 0x54, 0x4f, 0x54, 0x41, 0x4c, 0x5f, 0x53, 0x59, 0x4e, 0x43, 0x53, 0x10, - 0x04, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x4f, 0x52, 0x54, 0x5f, 0x42, 0x59, 0x5f, 0x54, 0x4f, 0x54, - 0x41, 0x4c, 0x5f, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x53, 0x10, 0x05, 0x12, 0x1a, 0x0a, 0x16, 0x53, - 0x4f, 0x52, 0x54, 0x5f, 0x42, 0x59, 0x5f, 0x47, 0x45, 0x4e, 0x45, 0x53, 0x49, 0x53, 0x5f, 0x48, - 0x45, 0x49, 0x47, 0x48, 0x54, 0x10, 0x06, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x4f, 0x52, 0x54, 0x5f, - 0x42, 0x59, 0x5f, 0x54, 0x4f, 0x54, 0x41, 0x4c, 0x5f, 0x53, 0x55, 0x50, 0x50, 0x4c, 0x59, 0x10, - 0x07, 0x2a, 0x40, 0x0a, 0x0d, 0x53, 0x6f, 0x72, 0x74, 0x44, 0x69, 0x72, 0x65, 0x63, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x52, 0x54, 0x5f, 0x44, 0x49, 0x52, 0x45, 0x43, - 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x53, 0x43, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x53, 0x4f, - 0x52, 0x54, 0x5f, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x44, 0x45, 0x53, - 0x43, 0x10, 0x01, 0x2a, 0x5f, 0x0a, 0x0f, 0x41, 0x73, 0x73, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, - 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x15, 0x0a, 0x11, 0x46, 0x49, 0x4c, 0x54, 0x45, 0x52, - 0x5f, 0x41, 0x53, 0x53, 0x45, 0x54, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x17, 0x0a, - 0x13, 0x46, 0x49, 0x4c, 0x54, 0x45, 0x52, 0x5f, 0x41, 0x53, 0x53, 0x45, 0x54, 0x5f, 0x4e, 0x4f, - 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x1c, 0x0a, 0x18, 0x46, 0x49, 0x4c, 0x54, 0x45, 0x52, - 0x5f, 0x41, 0x53, 0x53, 0x45, 0x54, 0x5f, 0x43, 0x4f, 0x4c, 0x4c, 0x45, 0x43, 0x54, 0x49, 0x42, - 0x4c, 0x45, 0x10, 0x02, 0x32, 0xcb, 0x09, 0x0a, 0x08, 0x55, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, - 0x65, 0x12, 0x4b, 0x0a, 0x0a, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x73, 0x12, - 0x1d, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x73, - 0x73, 0x65, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, - 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x73, 0x73, - 0x65, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4e, - 0x0a, 0x0f, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x6f, 0x6f, 0x74, - 0x73, 0x12, 0x1b, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, - 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x1a, 0x1e, - 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x52, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, - 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x6f, 0x6f, - 0x74, 0x12, 0x1c, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, - 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, 0x1a, - 0x1f, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x43, 0x0a, 0x0d, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4c, 0x65, 0x61, 0x66, 0x4b, 0x65, 0x79, - 0x73, 0x12, 0x0f, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, - 0x49, 0x44, 0x1a, 0x21, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, - 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4c, 0x65, 0x61, 0x66, 0x4b, 0x65, 0x79, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0b, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4c, 0x65, - 0x61, 0x76, 0x65, 0x73, 0x12, 0x0f, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, - 0x70, 0x63, 0x2e, 0x49, 0x44, 0x1a, 0x1e, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, - 0x72, 0x70, 0x63, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4c, 0x65, 0x61, 0x66, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, - 0x6f, 0x6f, 0x66, 0x12, 0x18, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, - 0x63, 0x2e, 0x55, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x1a, 0x1f, 0x2e, - 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x73, 0x73, 0x65, - 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, - 0x0a, 0x0b, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x17, 0x2e, - 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x73, 0x73, 0x65, - 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x1a, 0x1f, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, - 0x65, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x49, 0x6e, 0x66, 0x6f, 0x12, - 0x18, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x75, 0x6e, 0x69, 0x76, - 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x0c, 0x53, 0x79, 0x6e, 0x63, 0x55, 0x6e, 0x69, 0x76, - 0x65, 0x72, 0x73, 0x65, 0x12, 0x18, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, - 0x70, 0x63, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, - 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x79, 0x6e, - 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6e, 0x0a, 0x15, 0x4c, 0x69, 0x73, - 0x74, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, - 0x72, 0x73, 0x12, 0x29, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, - 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, - 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, - 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x68, 0x0a, 0x13, 0x41, 0x64, 0x64, - 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, - 0x12, 0x27, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x41, - 0x64, 0x64, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x75, 0x6e, 0x69, 0x76, - 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x64, 0x64, 0x46, 0x65, 0x64, 0x65, 0x72, - 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x71, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x65, 0x64, - 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x2a, 0x2e, + 0x66, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x22, 0xcf, 0x01, 0x0a, 0x1e, 0x53, 0x65, 0x74, 0x46, + 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x57, 0x0a, 0x13, 0x67, 0x6c, + 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, + 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x46, 0x65, 0x64, 0x65, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x52, 0x11, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x73, 0x12, 0x54, 0x0a, 0x12, 0x61, 0x73, 0x73, 0x65, 0x74, 0x5f, 0x73, 0x79, 0x6e, + 0x63, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x26, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x73, + 0x73, 0x65, 0x74, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x79, 0x6e, + 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x10, 0x61, 0x73, 0x73, 0x65, 0x74, 0x53, 0x79, + 0x6e, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x22, 0x21, 0x0a, 0x1f, 0x53, 0x65, 0x74, + 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xab, 0x01, 0x0a, + 0x1a, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x35, 0x0a, 0x0a, 0x70, + 0x72, 0x6f, 0x6f, 0x66, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, + 0x16, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x72, + 0x6f, 0x6f, 0x66, 0x54, 0x79, 0x70, 0x65, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x6f, 0x66, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x79, 0x6e, 0x63, + 0x5f, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x61, + 0x6c, 0x6c, 0x6f, 0x77, 0x53, 0x79, 0x6e, 0x63, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x12, 0x2a, + 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x65, 0x78, 0x70, + 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, + 0x53, 0x79, 0x6e, 0x63, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x94, 0x01, 0x0a, 0x19, 0x41, + 0x73, 0x73, 0x65, 0x74, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x79, + 0x6e, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x1f, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, + 0x70, 0x63, 0x2e, 0x49, 0x44, 0x52, 0x02, 0x69, 0x64, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x6c, 0x6c, + 0x6f, 0x77, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x69, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x53, 0x79, 0x6e, 0x63, 0x49, + 0x6e, 0x73, 0x65, 0x72, 0x74, 0x12, 0x2a, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x73, + 0x79, 0x6e, 0x63, 0x5f, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x53, 0x79, 0x6e, 0x63, 0x45, 0x78, 0x70, 0x6f, 0x72, + 0x74, 0x22, 0x43, 0x0a, 0x20, 0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x0f, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, + 0x49, 0x44, 0x52, 0x02, 0x69, 0x64, 0x22, 0xd2, 0x01, 0x0a, 0x21, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x57, 0x0a, 0x13, + 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x27, 0x2e, 0x75, 0x6e, 0x69, 0x76, + 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x47, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x46, 0x65, + 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x52, 0x11, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x54, 0x0a, 0x12, 0x61, 0x73, 0x73, 0x65, 0x74, 0x5f, 0x73, + 0x79, 0x6e, 0x63, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x26, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, + 0x41, 0x73, 0x73, 0x65, 0x74, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, + 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x10, 0x61, 0x73, 0x73, 0x65, 0x74, + 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x2a, 0x59, 0x0a, 0x09, 0x50, + 0x72, 0x6f, 0x6f, 0x66, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x50, 0x52, 0x4f, 0x4f, + 0x46, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, + 0x45, 0x44, 0x10, 0x00, 0x12, 0x17, 0x0a, 0x13, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x54, 0x59, + 0x50, 0x45, 0x5f, 0x49, 0x53, 0x53, 0x55, 0x41, 0x4e, 0x43, 0x45, 0x10, 0x01, 0x12, 0x17, 0x0a, + 0x13, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x52, 0x41, 0x4e, + 0x53, 0x46, 0x45, 0x52, 0x10, 0x02, 0x2a, 0x39, 0x0a, 0x10, 0x55, 0x6e, 0x69, 0x76, 0x65, 0x72, + 0x73, 0x65, 0x53, 0x79, 0x6e, 0x63, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x59, + 0x4e, 0x43, 0x5f, 0x49, 0x53, 0x53, 0x55, 0x41, 0x4e, 0x43, 0x45, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, + 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x53, 0x59, 0x4e, 0x43, 0x5f, 0x46, 0x55, 0x4c, 0x4c, 0x10, + 0x01, 0x2a, 0xd1, 0x01, 0x0a, 0x0e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x53, 0x6f, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x4f, 0x52, 0x54, 0x5f, 0x42, 0x59, 0x5f, + 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x52, 0x54, 0x5f, 0x42, + 0x59, 0x5f, 0x41, 0x53, 0x53, 0x45, 0x54, 0x5f, 0x4e, 0x41, 0x4d, 0x45, 0x10, 0x01, 0x12, 0x14, + 0x0a, 0x10, 0x53, 0x4f, 0x52, 0x54, 0x5f, 0x42, 0x59, 0x5f, 0x41, 0x53, 0x53, 0x45, 0x54, 0x5f, + 0x49, 0x44, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x52, 0x54, 0x5f, 0x42, 0x59, 0x5f, + 0x41, 0x53, 0x53, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x10, 0x03, 0x12, 0x17, 0x0a, 0x13, + 0x53, 0x4f, 0x52, 0x54, 0x5f, 0x42, 0x59, 0x5f, 0x54, 0x4f, 0x54, 0x41, 0x4c, 0x5f, 0x53, 0x59, + 0x4e, 0x43, 0x53, 0x10, 0x04, 0x12, 0x18, 0x0a, 0x14, 0x53, 0x4f, 0x52, 0x54, 0x5f, 0x42, 0x59, + 0x5f, 0x54, 0x4f, 0x54, 0x41, 0x4c, 0x5f, 0x50, 0x52, 0x4f, 0x4f, 0x46, 0x53, 0x10, 0x05, 0x12, + 0x1a, 0x0a, 0x16, 0x53, 0x4f, 0x52, 0x54, 0x5f, 0x42, 0x59, 0x5f, 0x47, 0x45, 0x4e, 0x45, 0x53, + 0x49, 0x53, 0x5f, 0x48, 0x45, 0x49, 0x47, 0x48, 0x54, 0x10, 0x06, 0x12, 0x18, 0x0a, 0x14, 0x53, + 0x4f, 0x52, 0x54, 0x5f, 0x42, 0x59, 0x5f, 0x54, 0x4f, 0x54, 0x41, 0x4c, 0x5f, 0x53, 0x55, 0x50, + 0x50, 0x4c, 0x59, 0x10, 0x07, 0x2a, 0x40, 0x0a, 0x0d, 0x53, 0x6f, 0x72, 0x74, 0x44, 0x69, 0x72, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x52, 0x54, 0x5f, 0x44, + 0x49, 0x52, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x41, 0x53, 0x43, 0x10, 0x00, 0x12, 0x17, + 0x0a, 0x13, 0x53, 0x4f, 0x52, 0x54, 0x5f, 0x44, 0x49, 0x52, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, + 0x5f, 0x44, 0x45, 0x53, 0x43, 0x10, 0x01, 0x2a, 0x5f, 0x0a, 0x0f, 0x41, 0x73, 0x73, 0x65, 0x74, + 0x54, 0x79, 0x70, 0x65, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x15, 0x0a, 0x11, 0x46, 0x49, + 0x4c, 0x54, 0x45, 0x52, 0x5f, 0x41, 0x53, 0x53, 0x45, 0x54, 0x5f, 0x4e, 0x4f, 0x4e, 0x45, 0x10, + 0x00, 0x12, 0x17, 0x0a, 0x13, 0x46, 0x49, 0x4c, 0x54, 0x45, 0x52, 0x5f, 0x41, 0x53, 0x53, 0x45, + 0x54, 0x5f, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x1c, 0x0a, 0x18, 0x46, 0x49, + 0x4c, 0x54, 0x45, 0x52, 0x5f, 0x41, 0x53, 0x53, 0x45, 0x54, 0x5f, 0x43, 0x4f, 0x4c, 0x4c, 0x45, + 0x43, 0x54, 0x49, 0x42, 0x4c, 0x45, 0x10, 0x02, 0x32, 0xbd, 0x0b, 0x0a, 0x08, 0x55, 0x6e, 0x69, + 0x76, 0x65, 0x72, 0x73, 0x65, 0x12, 0x4b, 0x0a, 0x0a, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x6f, + 0x6f, 0x74, 0x73, 0x12, 0x1d, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, + 0x63, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, + 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x4e, 0x0a, 0x0f, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x73, 0x73, 0x65, 0x74, + 0x52, 0x6f, 0x6f, 0x74, 0x73, 0x12, 0x1b, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, + 0x72, 0x70, 0x63, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x1a, 0x1e, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, + 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x50, 0x0a, 0x0f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x41, 0x73, 0x73, 0x65, + 0x74, 0x52, 0x6f, 0x6f, 0x74, 0x12, 0x1c, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, + 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x1a, 0x1f, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, + 0x63, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x0d, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4c, 0x65, 0x61, + 0x66, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x0f, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, + 0x72, 0x70, 0x63, 0x2e, 0x49, 0x44, 0x1a, 0x21, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, + 0x65, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4c, 0x65, 0x61, 0x66, 0x4b, 0x65, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x0b, 0x41, 0x73, 0x73, + 0x65, 0x74, 0x4c, 0x65, 0x61, 0x76, 0x65, 0x73, 0x12, 0x0f, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, + 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x44, 0x1a, 0x1e, 0x2e, 0x75, 0x6e, 0x69, 0x76, + 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x4c, 0x65, 0x61, + 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x51, 0x75, 0x65, + 0x72, 0x79, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x12, 0x18, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, + 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x55, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x4b, 0x65, + 0x79, 0x1a, 0x1f, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, + 0x41, 0x73, 0x73, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x47, 0x0a, 0x0b, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x6f, + 0x66, 0x12, 0x17, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, + 0x41, 0x73, 0x73, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x6f, 0x66, 0x1a, 0x1f, 0x2e, 0x75, 0x6e, 0x69, + 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x50, 0x72, + 0x6f, 0x6f, 0x66, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x04, 0x49, + 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, + 0x63, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, + 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x66, 0x6f, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x0c, 0x53, 0x79, 0x6e, 0x63, + 0x55, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x12, 0x18, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, + 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, + 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6e, 0x0a, + 0x15, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, + 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x12, 0x29, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, + 0x65, 0x72, 0x70, 0x63, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x2a, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, + 0x4c, 0x69, 0x73, 0x74, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x68, 0x0a, + 0x13, 0x41, 0x64, 0x64, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, + 0x72, 0x76, 0x65, 0x72, 0x12, 0x27, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, + 0x70, 0x63, 0x2e, 0x41, 0x64, 0x64, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, + 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x41, 0x64, 0x64, 0x46, + 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x71, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, + 0x72, 0x12, 0x2a, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, - 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x75, 0x6e, 0x69, 0x76, - 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x65, - 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0d, 0x55, 0x6e, 0x69, 0x76, 0x65, 0x72, - 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x19, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, - 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, - 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, - 0x0a, 0x0f, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x73, 0x73, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, - 0x73, 0x12, 0x1c, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, - 0x41, 0x73, 0x73, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x73, 0x51, 0x75, 0x65, 0x72, 0x79, 0x1a, - 0x1f, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x55, 0x6e, - 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x41, 0x73, 0x73, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x73, - 0x12, 0x50, 0x0a, 0x0b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x12, - 0x1f, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x20, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, - 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x74, - 0x61, 0x70, 0x72, 0x6f, 0x6f, 0x74, 0x2d, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x2f, 0x74, 0x61, - 0x70, 0x72, 0x70, 0x63, 0x2f, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x46, 0x0a, 0x0d, 0x55, 0x6e, + 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x19, 0x2e, 0x75, 0x6e, + 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, + 0x65, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x50, 0x0a, 0x0f, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x73, 0x73, 0x65, 0x74, + 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x1c, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, + 0x72, 0x70, 0x63, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x73, 0x51, 0x75, + 0x65, 0x72, 0x79, 0x1a, 0x1f, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, + 0x63, 0x2e, 0x55, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x41, 0x73, 0x73, 0x65, 0x74, 0x53, + 0x74, 0x61, 0x74, 0x73, 0x12, 0x50, 0x0a, 0x0b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x45, 0x76, 0x65, + 0x6e, 0x74, 0x73, 0x12, 0x1f, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, + 0x63, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, + 0x70, 0x63, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x74, 0x0a, 0x17, 0x53, 0x65, 0x74, 0x46, 0x65, 0x64, + 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x12, 0x2b, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, + 0x53, 0x65, 0x74, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x79, 0x6e, + 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, + 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x65, 0x74, + 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, + 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7a, 0x0a, 0x19, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x65, 0x64, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, + 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2d, 0x2e, 0x75, 0x6e, 0x69, 0x76, + 0x65, 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x65, 0x64, + 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x75, 0x6e, 0x69, 0x76, 0x65, + 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x46, 0x65, 0x64, 0x65, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x79, 0x6e, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x3c, 0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x6e, 0x69, 0x6e, 0x67, + 0x6c, 0x61, 0x62, 0x73, 0x2f, 0x74, 0x61, 0x70, 0x72, 0x6f, 0x6f, 0x74, 0x2d, 0x61, 0x73, 0x73, + 0x65, 0x74, 0x73, 0x2f, 0x74, 0x61, 0x70, 0x72, 0x70, 0x63, 0x2f, 0x75, 0x6e, 0x69, 0x76, 0x65, + 0x72, 0x73, 0x65, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2950,69 +3358,75 @@ func file_universerpc_universe_proto_rawDescGZIP() []byte { } var file_universerpc_universe_proto_enumTypes = make([]protoimpl.EnumInfo, 5) -var file_universerpc_universe_proto_msgTypes = make([]protoimpl.MessageInfo, 40) +var file_universerpc_universe_proto_msgTypes = make([]protoimpl.MessageInfo, 46) var file_universerpc_universe_proto_goTypes = []interface{}{ - (ProofType)(0), // 0: universerpc.ProofType - (UniverseSyncMode)(0), // 1: universerpc.UniverseSyncMode - (AssetQuerySort)(0), // 2: universerpc.AssetQuerySort - (SortDirection)(0), // 3: universerpc.SortDirection - (AssetTypeFilter)(0), // 4: universerpc.AssetTypeFilter - (*AssetRootRequest)(nil), // 5: universerpc.AssetRootRequest - (*MerkleSumNode)(nil), // 6: universerpc.MerkleSumNode - (*ID)(nil), // 7: universerpc.ID - (*UniverseRoot)(nil), // 8: universerpc.UniverseRoot - (*AssetRootResponse)(nil), // 9: universerpc.AssetRootResponse - (*AssetRootQuery)(nil), // 10: universerpc.AssetRootQuery - (*QueryRootResponse)(nil), // 11: universerpc.QueryRootResponse - (*DeleteRootQuery)(nil), // 12: universerpc.DeleteRootQuery - (*DeleteRootResponse)(nil), // 13: universerpc.DeleteRootResponse - (*Outpoint)(nil), // 14: universerpc.Outpoint - (*AssetKey)(nil), // 15: universerpc.AssetKey - (*AssetLeafKeyResponse)(nil), // 16: universerpc.AssetLeafKeyResponse - (*AssetLeaf)(nil), // 17: universerpc.AssetLeaf - (*AssetLeafResponse)(nil), // 18: universerpc.AssetLeafResponse - (*UniverseKey)(nil), // 19: universerpc.UniverseKey - (*AssetProofResponse)(nil), // 20: universerpc.AssetProofResponse - (*AssetProof)(nil), // 21: universerpc.AssetProof - (*InfoRequest)(nil), // 22: universerpc.InfoRequest - (*InfoResponse)(nil), // 23: universerpc.InfoResponse - (*SyncTarget)(nil), // 24: universerpc.SyncTarget - (*SyncRequest)(nil), // 25: universerpc.SyncRequest - (*SyncedUniverse)(nil), // 26: universerpc.SyncedUniverse - (*StatsRequest)(nil), // 27: universerpc.StatsRequest - (*SyncResponse)(nil), // 28: universerpc.SyncResponse - (*UniverseFederationServer)(nil), // 29: universerpc.UniverseFederationServer - (*ListFederationServersRequest)(nil), // 30: universerpc.ListFederationServersRequest - (*ListFederationServersResponse)(nil), // 31: universerpc.ListFederationServersResponse - (*AddFederationServerRequest)(nil), // 32: universerpc.AddFederationServerRequest - (*AddFederationServerResponse)(nil), // 33: universerpc.AddFederationServerResponse - (*DeleteFederationServerRequest)(nil), // 34: universerpc.DeleteFederationServerRequest - (*DeleteFederationServerResponse)(nil), // 35: universerpc.DeleteFederationServerResponse - (*StatsResponse)(nil), // 36: universerpc.StatsResponse - (*AssetStatsQuery)(nil), // 37: universerpc.AssetStatsQuery - (*AssetStatsSnapshot)(nil), // 38: universerpc.AssetStatsSnapshot - (*UniverseAssetStats)(nil), // 39: universerpc.UniverseAssetStats - (*QueryEventsRequest)(nil), // 40: universerpc.QueryEventsRequest - (*QueryEventsResponse)(nil), // 41: universerpc.QueryEventsResponse - (*GroupedUniverseEvents)(nil), // 42: universerpc.GroupedUniverseEvents - nil, // 43: universerpc.UniverseRoot.AmountsByAssetIdEntry - nil, // 44: universerpc.AssetRootResponse.UniverseRootsEntry - (*taprpc.Asset)(nil), // 45: taprpc.Asset - (taprpc.AssetType)(0), // 46: taprpc.AssetType + (ProofType)(0), // 0: universerpc.ProofType + (UniverseSyncMode)(0), // 1: universerpc.UniverseSyncMode + (AssetQuerySort)(0), // 2: universerpc.AssetQuerySort + (SortDirection)(0), // 3: universerpc.SortDirection + (AssetTypeFilter)(0), // 4: universerpc.AssetTypeFilter + (*AssetRootRequest)(nil), // 5: universerpc.AssetRootRequest + (*MerkleSumNode)(nil), // 6: universerpc.MerkleSumNode + (*ID)(nil), // 7: universerpc.ID + (*UniverseRoot)(nil), // 8: universerpc.UniverseRoot + (*AssetRootResponse)(nil), // 9: universerpc.AssetRootResponse + (*AssetRootQuery)(nil), // 10: universerpc.AssetRootQuery + (*QueryRootResponse)(nil), // 11: universerpc.QueryRootResponse + (*DeleteRootQuery)(nil), // 12: universerpc.DeleteRootQuery + (*DeleteRootResponse)(nil), // 13: universerpc.DeleteRootResponse + (*Outpoint)(nil), // 14: universerpc.Outpoint + (*AssetKey)(nil), // 15: universerpc.AssetKey + (*AssetLeafKeyResponse)(nil), // 16: universerpc.AssetLeafKeyResponse + (*AssetLeaf)(nil), // 17: universerpc.AssetLeaf + (*AssetLeafResponse)(nil), // 18: universerpc.AssetLeafResponse + (*UniverseKey)(nil), // 19: universerpc.UniverseKey + (*AssetProofResponse)(nil), // 20: universerpc.AssetProofResponse + (*AssetProof)(nil), // 21: universerpc.AssetProof + (*InfoRequest)(nil), // 22: universerpc.InfoRequest + (*InfoResponse)(nil), // 23: universerpc.InfoResponse + (*SyncTarget)(nil), // 24: universerpc.SyncTarget + (*SyncRequest)(nil), // 25: universerpc.SyncRequest + (*SyncedUniverse)(nil), // 26: universerpc.SyncedUniverse + (*StatsRequest)(nil), // 27: universerpc.StatsRequest + (*SyncResponse)(nil), // 28: universerpc.SyncResponse + (*UniverseFederationServer)(nil), // 29: universerpc.UniverseFederationServer + (*ListFederationServersRequest)(nil), // 30: universerpc.ListFederationServersRequest + (*ListFederationServersResponse)(nil), // 31: universerpc.ListFederationServersResponse + (*AddFederationServerRequest)(nil), // 32: universerpc.AddFederationServerRequest + (*AddFederationServerResponse)(nil), // 33: universerpc.AddFederationServerResponse + (*DeleteFederationServerRequest)(nil), // 34: universerpc.DeleteFederationServerRequest + (*DeleteFederationServerResponse)(nil), // 35: universerpc.DeleteFederationServerResponse + (*StatsResponse)(nil), // 36: universerpc.StatsResponse + (*AssetStatsQuery)(nil), // 37: universerpc.AssetStatsQuery + (*AssetStatsSnapshot)(nil), // 38: universerpc.AssetStatsSnapshot + (*UniverseAssetStats)(nil), // 39: universerpc.UniverseAssetStats + (*QueryEventsRequest)(nil), // 40: universerpc.QueryEventsRequest + (*QueryEventsResponse)(nil), // 41: universerpc.QueryEventsResponse + (*GroupedUniverseEvents)(nil), // 42: universerpc.GroupedUniverseEvents + (*SetFederationSyncConfigRequest)(nil), // 43: universerpc.SetFederationSyncConfigRequest + (*SetFederationSyncConfigResponse)(nil), // 44: universerpc.SetFederationSyncConfigResponse + (*GlobalFederationSyncConfig)(nil), // 45: universerpc.GlobalFederationSyncConfig + (*AssetFederationSyncConfig)(nil), // 46: universerpc.AssetFederationSyncConfig + (*QueryFederationSyncConfigRequest)(nil), // 47: universerpc.QueryFederationSyncConfigRequest + (*QueryFederationSyncConfigResponse)(nil), // 48: universerpc.QueryFederationSyncConfigResponse + nil, // 49: universerpc.UniverseRoot.AmountsByAssetIdEntry + nil, // 50: universerpc.AssetRootResponse.UniverseRootsEntry + (*taprpc.Asset)(nil), // 51: taprpc.Asset + (taprpc.AssetType)(0), // 52: taprpc.AssetType } var file_universerpc_universe_proto_depIdxs = []int32{ 0, // 0: universerpc.ID.proof_type:type_name -> universerpc.ProofType 7, // 1: universerpc.UniverseRoot.id:type_name -> universerpc.ID 6, // 2: universerpc.UniverseRoot.mssmt_root:type_name -> universerpc.MerkleSumNode - 43, // 3: universerpc.UniverseRoot.amounts_by_asset_id:type_name -> universerpc.UniverseRoot.AmountsByAssetIdEntry - 44, // 4: universerpc.AssetRootResponse.universe_roots:type_name -> universerpc.AssetRootResponse.UniverseRootsEntry + 49, // 3: universerpc.UniverseRoot.amounts_by_asset_id:type_name -> universerpc.UniverseRoot.AmountsByAssetIdEntry + 50, // 4: universerpc.AssetRootResponse.universe_roots:type_name -> universerpc.AssetRootResponse.UniverseRootsEntry 7, // 5: universerpc.AssetRootQuery.id:type_name -> universerpc.ID 8, // 6: universerpc.QueryRootResponse.issuance_root:type_name -> universerpc.UniverseRoot 8, // 7: universerpc.QueryRootResponse.transfer_root:type_name -> universerpc.UniverseRoot 7, // 8: universerpc.DeleteRootQuery.id:type_name -> universerpc.ID 14, // 9: universerpc.AssetKey.op:type_name -> universerpc.Outpoint 15, // 10: universerpc.AssetLeafKeyResponse.asset_keys:type_name -> universerpc.AssetKey - 45, // 11: universerpc.AssetLeaf.asset:type_name -> taprpc.Asset + 51, // 11: universerpc.AssetLeaf.asset:type_name -> taprpc.Asset 17, // 12: universerpc.AssetLeafResponse.leaves:type_name -> universerpc.AssetLeaf 7, // 13: universerpc.UniverseKey.id:type_name -> universerpc.ID 15, // 14: universerpc.UniverseKey.leaf_key:type_name -> universerpc.AssetKey @@ -3035,45 +3449,56 @@ var file_universerpc_universe_proto_depIdxs = []int32{ 4, // 31: universerpc.AssetStatsQuery.asset_type_filter:type_name -> universerpc.AssetTypeFilter 2, // 32: universerpc.AssetStatsQuery.sort_by:type_name -> universerpc.AssetQuerySort 3, // 33: universerpc.AssetStatsQuery.direction:type_name -> universerpc.SortDirection - 46, // 34: universerpc.AssetStatsSnapshot.asset_type:type_name -> taprpc.AssetType + 52, // 34: universerpc.AssetStatsSnapshot.asset_type:type_name -> taprpc.AssetType 38, // 35: universerpc.UniverseAssetStats.asset_stats:type_name -> universerpc.AssetStatsSnapshot 42, // 36: universerpc.QueryEventsResponse.events:type_name -> universerpc.GroupedUniverseEvents - 8, // 37: universerpc.AssetRootResponse.UniverseRootsEntry.value:type_name -> universerpc.UniverseRoot - 5, // 38: universerpc.Universe.AssetRoots:input_type -> universerpc.AssetRootRequest - 10, // 39: universerpc.Universe.QueryAssetRoots:input_type -> universerpc.AssetRootQuery - 12, // 40: universerpc.Universe.DeleteAssetRoot:input_type -> universerpc.DeleteRootQuery - 7, // 41: universerpc.Universe.AssetLeafKeys:input_type -> universerpc.ID - 7, // 42: universerpc.Universe.AssetLeaves:input_type -> universerpc.ID - 19, // 43: universerpc.Universe.QueryProof:input_type -> universerpc.UniverseKey - 21, // 44: universerpc.Universe.InsertProof:input_type -> universerpc.AssetProof - 22, // 45: universerpc.Universe.Info:input_type -> universerpc.InfoRequest - 25, // 46: universerpc.Universe.SyncUniverse:input_type -> universerpc.SyncRequest - 30, // 47: universerpc.Universe.ListFederationServers:input_type -> universerpc.ListFederationServersRequest - 32, // 48: universerpc.Universe.AddFederationServer:input_type -> universerpc.AddFederationServerRequest - 34, // 49: universerpc.Universe.DeleteFederationServer:input_type -> universerpc.DeleteFederationServerRequest - 27, // 50: universerpc.Universe.UniverseStats:input_type -> universerpc.StatsRequest - 37, // 51: universerpc.Universe.QueryAssetStats:input_type -> universerpc.AssetStatsQuery - 40, // 52: universerpc.Universe.QueryEvents:input_type -> universerpc.QueryEventsRequest - 9, // 53: universerpc.Universe.AssetRoots:output_type -> universerpc.AssetRootResponse - 11, // 54: universerpc.Universe.QueryAssetRoots:output_type -> universerpc.QueryRootResponse - 13, // 55: universerpc.Universe.DeleteAssetRoot:output_type -> universerpc.DeleteRootResponse - 16, // 56: universerpc.Universe.AssetLeafKeys:output_type -> universerpc.AssetLeafKeyResponse - 18, // 57: universerpc.Universe.AssetLeaves:output_type -> universerpc.AssetLeafResponse - 20, // 58: universerpc.Universe.QueryProof:output_type -> universerpc.AssetProofResponse - 20, // 59: universerpc.Universe.InsertProof:output_type -> universerpc.AssetProofResponse - 23, // 60: universerpc.Universe.Info:output_type -> universerpc.InfoResponse - 28, // 61: universerpc.Universe.SyncUniverse:output_type -> universerpc.SyncResponse - 31, // 62: universerpc.Universe.ListFederationServers:output_type -> universerpc.ListFederationServersResponse - 33, // 63: universerpc.Universe.AddFederationServer:output_type -> universerpc.AddFederationServerResponse - 35, // 64: universerpc.Universe.DeleteFederationServer:output_type -> universerpc.DeleteFederationServerResponse - 36, // 65: universerpc.Universe.UniverseStats:output_type -> universerpc.StatsResponse - 39, // 66: universerpc.Universe.QueryAssetStats:output_type -> universerpc.UniverseAssetStats - 41, // 67: universerpc.Universe.QueryEvents:output_type -> universerpc.QueryEventsResponse - 53, // [53:68] is the sub-list for method output_type - 38, // [38:53] is the sub-list for method input_type - 38, // [38:38] is the sub-list for extension type_name - 38, // [38:38] is the sub-list for extension extendee - 0, // [0:38] is the sub-list for field type_name + 45, // 37: universerpc.SetFederationSyncConfigRequest.global_sync_configs:type_name -> universerpc.GlobalFederationSyncConfig + 46, // 38: universerpc.SetFederationSyncConfigRequest.asset_sync_configs:type_name -> universerpc.AssetFederationSyncConfig + 0, // 39: universerpc.GlobalFederationSyncConfig.proof_type:type_name -> universerpc.ProofType + 7, // 40: universerpc.AssetFederationSyncConfig.id:type_name -> universerpc.ID + 7, // 41: universerpc.QueryFederationSyncConfigRequest.id:type_name -> universerpc.ID + 45, // 42: universerpc.QueryFederationSyncConfigResponse.global_sync_configs:type_name -> universerpc.GlobalFederationSyncConfig + 46, // 43: universerpc.QueryFederationSyncConfigResponse.asset_sync_configs:type_name -> universerpc.AssetFederationSyncConfig + 8, // 44: universerpc.AssetRootResponse.UniverseRootsEntry.value:type_name -> universerpc.UniverseRoot + 5, // 45: universerpc.Universe.AssetRoots:input_type -> universerpc.AssetRootRequest + 10, // 46: universerpc.Universe.QueryAssetRoots:input_type -> universerpc.AssetRootQuery + 12, // 47: universerpc.Universe.DeleteAssetRoot:input_type -> universerpc.DeleteRootQuery + 7, // 48: universerpc.Universe.AssetLeafKeys:input_type -> universerpc.ID + 7, // 49: universerpc.Universe.AssetLeaves:input_type -> universerpc.ID + 19, // 50: universerpc.Universe.QueryProof:input_type -> universerpc.UniverseKey + 21, // 51: universerpc.Universe.InsertProof:input_type -> universerpc.AssetProof + 22, // 52: universerpc.Universe.Info:input_type -> universerpc.InfoRequest + 25, // 53: universerpc.Universe.SyncUniverse:input_type -> universerpc.SyncRequest + 30, // 54: universerpc.Universe.ListFederationServers:input_type -> universerpc.ListFederationServersRequest + 32, // 55: universerpc.Universe.AddFederationServer:input_type -> universerpc.AddFederationServerRequest + 34, // 56: universerpc.Universe.DeleteFederationServer:input_type -> universerpc.DeleteFederationServerRequest + 27, // 57: universerpc.Universe.UniverseStats:input_type -> universerpc.StatsRequest + 37, // 58: universerpc.Universe.QueryAssetStats:input_type -> universerpc.AssetStatsQuery + 40, // 59: universerpc.Universe.QueryEvents:input_type -> universerpc.QueryEventsRequest + 43, // 60: universerpc.Universe.SetFederationSyncConfig:input_type -> universerpc.SetFederationSyncConfigRequest + 47, // 61: universerpc.Universe.QueryFederationSyncConfig:input_type -> universerpc.QueryFederationSyncConfigRequest + 9, // 62: universerpc.Universe.AssetRoots:output_type -> universerpc.AssetRootResponse + 11, // 63: universerpc.Universe.QueryAssetRoots:output_type -> universerpc.QueryRootResponse + 13, // 64: universerpc.Universe.DeleteAssetRoot:output_type -> universerpc.DeleteRootResponse + 16, // 65: universerpc.Universe.AssetLeafKeys:output_type -> universerpc.AssetLeafKeyResponse + 18, // 66: universerpc.Universe.AssetLeaves:output_type -> universerpc.AssetLeafResponse + 20, // 67: universerpc.Universe.QueryProof:output_type -> universerpc.AssetProofResponse + 20, // 68: universerpc.Universe.InsertProof:output_type -> universerpc.AssetProofResponse + 23, // 69: universerpc.Universe.Info:output_type -> universerpc.InfoResponse + 28, // 70: universerpc.Universe.SyncUniverse:output_type -> universerpc.SyncResponse + 31, // 71: universerpc.Universe.ListFederationServers:output_type -> universerpc.ListFederationServersResponse + 33, // 72: universerpc.Universe.AddFederationServer:output_type -> universerpc.AddFederationServerResponse + 35, // 73: universerpc.Universe.DeleteFederationServer:output_type -> universerpc.DeleteFederationServerResponse + 36, // 74: universerpc.Universe.UniverseStats:output_type -> universerpc.StatsResponse + 39, // 75: universerpc.Universe.QueryAssetStats:output_type -> universerpc.UniverseAssetStats + 41, // 76: universerpc.Universe.QueryEvents:output_type -> universerpc.QueryEventsResponse + 44, // 77: universerpc.Universe.SetFederationSyncConfig:output_type -> universerpc.SetFederationSyncConfigResponse + 48, // 78: universerpc.Universe.QueryFederationSyncConfig:output_type -> universerpc.QueryFederationSyncConfigResponse + 62, // [62:79] is the sub-list for method output_type + 45, // [45:62] is the sub-list for method input_type + 45, // [45:45] is the sub-list for extension type_name + 45, // [45:45] is the sub-list for extension extendee + 0, // [0:45] is the sub-list for field type_name } func init() { file_universerpc_universe_proto_init() } @@ -3538,6 +3963,78 @@ func file_universerpc_universe_proto_init() { return nil } } + file_universerpc_universe_proto_msgTypes[38].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetFederationSyncConfigRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_universerpc_universe_proto_msgTypes[39].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SetFederationSyncConfigResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_universerpc_universe_proto_msgTypes[40].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GlobalFederationSyncConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_universerpc_universe_proto_msgTypes[41].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AssetFederationSyncConfig); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_universerpc_universe_proto_msgTypes[42].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryFederationSyncConfigRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_universerpc_universe_proto_msgTypes[43].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryFederationSyncConfigResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_universerpc_universe_proto_msgTypes[2].OneofWrappers = []interface{}{ (*ID_AssetId)(nil), @@ -3557,7 +4054,7 @@ func file_universerpc_universe_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_universerpc_universe_proto_rawDesc, NumEnums: 5, - NumMessages: 40, + NumMessages: 46, NumExtensions: 0, NumServices: 1, }, diff --git a/taprpc/universerpc/universe.pb.gw.go b/taprpc/universerpc/universe.pb.gw.go index e0d708f0a..27bbb2879 100644 --- a/taprpc/universerpc/universe.pb.gw.go +++ b/taprpc/universerpc/universe.pb.gw.go @@ -1291,6 +1291,76 @@ func local_request_Universe_QueryEvents_0(ctx context.Context, marshaler runtime } +func request_Universe_SetFederationSyncConfig_0(ctx context.Context, marshaler runtime.Marshaler, client UniverseClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SetFederationSyncConfigRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.SetFederationSyncConfig(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Universe_SetFederationSyncConfig_0(ctx context.Context, marshaler runtime.Marshaler, server UniverseServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq SetFederationSyncConfigRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.SetFederationSyncConfig(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_Universe_QueryFederationSyncConfig_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Universe_QueryFederationSyncConfig_0(ctx context.Context, marshaler runtime.Marshaler, client UniverseClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFederationSyncConfigRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Universe_QueryFederationSyncConfig_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.QueryFederationSyncConfig(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Universe_QueryFederationSyncConfig_0(ctx context.Context, marshaler runtime.Marshaler, server UniverseServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFederationSyncConfigRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Universe_QueryFederationSyncConfig_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.QueryFederationSyncConfig(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterUniverseHandlerServer registers the http handlers for service Universe to "mux". // UnaryRPC :call UniverseServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -1757,6 +1827,52 @@ func RegisterUniverseHandlerServer(ctx context.Context, mux *runtime.ServeMux, s }) + mux.Handle("POST", pattern_Universe_SetFederationSyncConfig_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/universerpc.Universe/SetFederationSyncConfig", runtime.WithHTTPPathPattern("/v1/taproot-assets/universe/sync/config")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Universe_SetFederationSyncConfig_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Universe_SetFederationSyncConfig_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Universe_QueryFederationSyncConfig_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/universerpc.Universe/QueryFederationSyncConfig", runtime.WithHTTPPathPattern("/v1/taproot-assets/universe/sync/config")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Universe_QueryFederationSyncConfig_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Universe_QueryFederationSyncConfig_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -2198,6 +2314,46 @@ func RegisterUniverseHandlerClient(ctx context.Context, mux *runtime.ServeMux, c }) + mux.Handle("POST", pattern_Universe_SetFederationSyncConfig_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/universerpc.Universe/SetFederationSyncConfig", runtime.WithHTTPPathPattern("/v1/taproot-assets/universe/sync/config")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Universe_SetFederationSyncConfig_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Universe_SetFederationSyncConfig_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_Universe_QueryFederationSyncConfig_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req, "/universerpc.Universe/QueryFederationSyncConfig", runtime.WithHTTPPathPattern("/v1/taproot-assets/universe/sync/config")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Universe_QueryFederationSyncConfig_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Universe_QueryFederationSyncConfig_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -2241,6 +2397,10 @@ var ( pattern_Universe_QueryAssetStats_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"v1", "taproot-assets", "universe", "stats", "assets"}, "")) pattern_Universe_QueryEvents_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"v1", "taproot-assets", "universe", "stats", "events"}, "")) + + pattern_Universe_SetFederationSyncConfig_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"v1", "taproot-assets", "universe", "sync", "config"}, "")) + + pattern_Universe_QueryFederationSyncConfig_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"v1", "taproot-assets", "universe", "sync", "config"}, "")) ) var ( @@ -2283,4 +2443,8 @@ var ( forward_Universe_QueryAssetStats_0 = runtime.ForwardResponseMessage forward_Universe_QueryEvents_0 = runtime.ForwardResponseMessage + + forward_Universe_SetFederationSyncConfig_0 = runtime.ForwardResponseMessage + + forward_Universe_QueryFederationSyncConfig_0 = runtime.ForwardResponseMessage ) diff --git a/taprpc/universerpc/universe.pb.json.go b/taprpc/universerpc/universe.pb.json.go index 2a180ace4..86ef5f693 100644 --- a/taprpc/universerpc/universe.pb.json.go +++ b/taprpc/universerpc/universe.pb.json.go @@ -395,4 +395,54 @@ func RegisterUniverseJSONCallbacks(registry map[string]func(ctx context.Context, } callback(string(respBytes), nil) } + + registry["universerpc.Universe.SetFederationSyncConfig"] = func(ctx context.Context, + conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { + + req := &SetFederationSyncConfigRequest{} + err := marshaler.Unmarshal([]byte(reqJSON), req) + if err != nil { + callback("", err) + return + } + + client := NewUniverseClient(conn) + resp, err := client.SetFederationSyncConfig(ctx, req) + if err != nil { + callback("", err) + return + } + + respBytes, err := marshaler.Marshal(resp) + if err != nil { + callback("", err) + return + } + callback(string(respBytes), nil) + } + + registry["universerpc.Universe.QueryFederationSyncConfig"] = func(ctx context.Context, + conn *grpc.ClientConn, reqJSON string, callback func(string, error)) { + + req := &QueryFederationSyncConfigRequest{} + err := marshaler.Unmarshal([]byte(reqJSON), req) + if err != nil { + callback("", err) + return + } + + client := NewUniverseClient(conn) + resp, err := client.QueryFederationSyncConfig(ctx, req) + if err != nil { + callback("", err) + return + } + + respBytes, err := marshaler.Marshal(resp) + if err != nil { + callback("", err) + return + } + callback(string(respBytes), nil) + } } diff --git a/taprpc/universerpc/universe.proto b/taprpc/universerpc/universe.proto index 2d78d9b93..dde410911 100644 --- a/taprpc/universerpc/universe.proto +++ b/taprpc/universerpc/universe.proto @@ -126,6 +126,20 @@ service Universe { period, grouped by day. */ rpc QueryEvents (QueryEventsRequest) returns (QueryEventsResponse); + + /* + SetFederationSyncConfig sets the configuration of the universe federation + sync. + */ + rpc SetFederationSyncConfig (SetFederationSyncConfigRequest) + returns (SetFederationSyncConfigResponse); + + /* + QueryFederationSyncConfig queries the universe federation sync configuration + settings. + */ + rpc QueryFederationSyncConfig (QueryFederationSyncConfigRequest) + returns (QueryFederationSyncConfigResponse); } message AssetRootRequest { @@ -486,3 +500,57 @@ message GroupedUniverseEvents { uint64 sync_events = 2; uint64 new_proof_events = 3; } + +message SetFederationSyncConfigRequest { + repeated GlobalFederationSyncConfig global_sync_configs = 1; + + repeated AssetFederationSyncConfig asset_sync_configs = 2; +} + +message SetFederationSyncConfigResponse { +} + +// GlobalFederationSyncConfig is a global proof type specific configuration +// for universe federation syncing. +message GlobalFederationSyncConfig { + // proof_type is the universe proof type which this config applies to. + ProofType proof_type = 1; + + // allow_sync_insert is a boolean that indicates whether leaves from + // universes of the given proof type have may be inserted via federation + // sync. + bool allow_sync_insert = 2; + + // allow_sync_export is a boolean that indicates whether leaves from + // universes of the given proof type have may be exported via federation + // sync. + bool allow_sync_export = 3; +} + +// AssetFederationSyncConfig is an asset universe specific configuration for +// federation syncing. +message AssetFederationSyncConfig { + // id is the ID of the universe to configure. + ID id = 1; + + // allow_sync_insert is a boolean that indicates whether leaves from + // universes of the given proof type have may be inserted via federation + // sync. + bool allow_sync_insert = 2; + + // allow_sync_export is a boolean that indicates whether leaves from + // universes of the given proof type have may be exported via federation + // sync. + bool allow_sync_export = 3; +} + +message QueryFederationSyncConfigRequest { + // Target universe ID(s). + repeated ID id = 1; +} + +message QueryFederationSyncConfigResponse { + repeated GlobalFederationSyncConfig global_sync_configs = 1; + + repeated AssetFederationSyncConfig asset_sync_configs = 2; +} diff --git a/taprpc/universerpc/universe.swagger.json b/taprpc/universerpc/universe.swagger.json index 6aef9439d..652e0e001 100644 --- a/taprpc/universerpc/universe.swagger.json +++ b/taprpc/universerpc/universe.swagger.json @@ -1116,6 +1116,60 @@ "Universe" ] } + }, + "/v1/taproot-assets/universe/sync/config": { + "get": { + "summary": "QueryFederationSyncConfig queries the universe federation sync configuration\nsettings.", + "operationId": "Universe_QueryFederationSyncConfig", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/universerpcQueryFederationSyncConfigResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "tags": [ + "Universe" + ] + }, + "post": { + "summary": "SetFederationSyncConfig sets the configuration of the universe federation\nsync.", + "operationId": "Universe_SetFederationSyncConfig", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/universerpcSetFederationSyncConfigResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/universerpcSetFederationSyncConfigRequest" + } + } + ], + "tags": [ + "Universe" + ] + } } }, "definitions": { @@ -1400,6 +1454,24 @@ "universerpcAddFederationServerResponse": { "type": "object" }, + "universerpcAssetFederationSyncConfig": { + "type": "object", + "properties": { + "id": { + "$ref": "#/definitions/universerpcID", + "description": "id is the ID of the universe to configure." + }, + "allow_sync_insert": { + "type": "boolean", + "description": "allow_sync_insert is a boolean that indicates whether leaves from\nuniverses of the given proof type have may be inserted via federation\nsync." + }, + "allow_sync_export": { + "type": "boolean", + "description": "allow_sync_export is a boolean that indicates whether leaves from\nuniverses of the given proof type have may be exported via federation\nsync." + } + }, + "description": "AssetFederationSyncConfig is an asset universe specific configuration for\nfederation syncing." + }, "universerpcAssetKey": { "type": "object", "properties": { @@ -1583,6 +1655,24 @@ "universerpcDeleteRootResponse": { "type": "object" }, + "universerpcGlobalFederationSyncConfig": { + "type": "object", + "properties": { + "proof_type": { + "$ref": "#/definitions/universerpcProofType", + "description": "proof_type is the universe proof type which this config applies to." + }, + "allow_sync_insert": { + "type": "boolean", + "description": "allow_sync_insert is a boolean that indicates whether leaves from\nuniverses of the given proof type have may be inserted via federation\nsync." + }, + "allow_sync_export": { + "type": "boolean", + "description": "allow_sync_export is a boolean that indicates whether leaves from\nuniverses of the given proof type have may be exported via federation\nsync." + } + }, + "description": "GlobalFederationSyncConfig is a global proof type specific configuration\nfor universe federation syncing." + }, "universerpcGroupedUniverseEvents": { "type": "object", "properties": { @@ -1701,6 +1791,23 @@ } } }, + "universerpcQueryFederationSyncConfigResponse": { + "type": "object", + "properties": { + "global_sync_configs": { + "type": "array", + "items": { + "$ref": "#/definitions/universerpcGlobalFederationSyncConfig" + } + }, + "asset_sync_configs": { + "type": "array", + "items": { + "$ref": "#/definitions/universerpcAssetFederationSyncConfig" + } + } + } + }, "universerpcQueryRootResponse": { "type": "object", "properties": { @@ -1714,6 +1821,26 @@ } } }, + "universerpcSetFederationSyncConfigRequest": { + "type": "object", + "properties": { + "global_sync_configs": { + "type": "array", + "items": { + "$ref": "#/definitions/universerpcGlobalFederationSyncConfig" + } + }, + "asset_sync_configs": { + "type": "array", + "items": { + "$ref": "#/definitions/universerpcAssetFederationSyncConfig" + } + } + } + }, + "universerpcSetFederationSyncConfigResponse": { + "type": "object" + }, "universerpcSortDirection": { "type": "string", "enum": [ diff --git a/taprpc/universerpc/universe.yaml b/taprpc/universerpc/universe.yaml index 603b31d8a..e29c1e435 100644 --- a/taprpc/universerpc/universe.yaml +++ b/taprpc/universerpc/universe.yaml @@ -40,6 +40,13 @@ http: post: "/v1/taproot-assets/universe/sync" body: "*" + - selector: universerpc.Universe.SetFederationSyncConfig + post: "/v1/taproot-assets/universe/sync/config" + body: "*" + + - selector: universerpc.Universe.QueryFederationSyncConfig + get: "/v1/taproot-assets/universe/sync/config" + - selector: universerpc.Universe.DeleteAssetRoot delete: "/v1/taproot-assets/universe/delete" diff --git a/taprpc/universerpc/universe_grpc.pb.go b/taprpc/universerpc/universe_grpc.pb.go index 1814fbd62..d8783175c 100644 --- a/taprpc/universerpc/universe_grpc.pb.go +++ b/taprpc/universerpc/universe_grpc.pb.go @@ -98,6 +98,12 @@ type UniverseClient interface { // QueryEvents returns the number of sync and proof events for a given time // period, grouped by day. QueryEvents(ctx context.Context, in *QueryEventsRequest, opts ...grpc.CallOption) (*QueryEventsResponse, error) + // SetFederationSyncConfig sets the configuration of the universe federation + // sync. + SetFederationSyncConfig(ctx context.Context, in *SetFederationSyncConfigRequest, opts ...grpc.CallOption) (*SetFederationSyncConfigResponse, error) + // QueryFederationSyncConfig queries the universe federation sync configuration + // settings. + QueryFederationSyncConfig(ctx context.Context, in *QueryFederationSyncConfigRequest, opts ...grpc.CallOption) (*QueryFederationSyncConfigResponse, error) } type universeClient struct { @@ -243,6 +249,24 @@ func (c *universeClient) QueryEvents(ctx context.Context, in *QueryEventsRequest return out, nil } +func (c *universeClient) SetFederationSyncConfig(ctx context.Context, in *SetFederationSyncConfigRequest, opts ...grpc.CallOption) (*SetFederationSyncConfigResponse, error) { + out := new(SetFederationSyncConfigResponse) + err := c.cc.Invoke(ctx, "/universerpc.Universe/SetFederationSyncConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *universeClient) QueryFederationSyncConfig(ctx context.Context, in *QueryFederationSyncConfigRequest, opts ...grpc.CallOption) (*QueryFederationSyncConfigResponse, error) { + out := new(QueryFederationSyncConfigResponse) + err := c.cc.Invoke(ctx, "/universerpc.Universe/QueryFederationSyncConfig", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // UniverseServer is the server API for Universe service. // All implementations must embed UnimplementedUniverseServer // for forward compatibility @@ -327,6 +351,12 @@ type UniverseServer interface { // QueryEvents returns the number of sync and proof events for a given time // period, grouped by day. QueryEvents(context.Context, *QueryEventsRequest) (*QueryEventsResponse, error) + // SetFederationSyncConfig sets the configuration of the universe federation + // sync. + SetFederationSyncConfig(context.Context, *SetFederationSyncConfigRequest) (*SetFederationSyncConfigResponse, error) + // QueryFederationSyncConfig queries the universe federation sync configuration + // settings. + QueryFederationSyncConfig(context.Context, *QueryFederationSyncConfigRequest) (*QueryFederationSyncConfigResponse, error) mustEmbedUnimplementedUniverseServer() } @@ -379,6 +409,12 @@ func (UnimplementedUniverseServer) QueryAssetStats(context.Context, *AssetStatsQ func (UnimplementedUniverseServer) QueryEvents(context.Context, *QueryEventsRequest) (*QueryEventsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryEvents not implemented") } +func (UnimplementedUniverseServer) SetFederationSyncConfig(context.Context, *SetFederationSyncConfigRequest) (*SetFederationSyncConfigResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetFederationSyncConfig not implemented") +} +func (UnimplementedUniverseServer) QueryFederationSyncConfig(context.Context, *QueryFederationSyncConfigRequest) (*QueryFederationSyncConfigResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryFederationSyncConfig not implemented") +} func (UnimplementedUniverseServer) mustEmbedUnimplementedUniverseServer() {} // UnsafeUniverseServer may be embedded to opt out of forward compatibility for this service. @@ -662,6 +698,42 @@ func _Universe_QueryEvents_Handler(srv interface{}, ctx context.Context, dec fun return interceptor(ctx, in, info, handler) } +func _Universe_SetFederationSyncConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SetFederationSyncConfigRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UniverseServer).SetFederationSyncConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/universerpc.Universe/SetFederationSyncConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UniverseServer).SetFederationSyncConfig(ctx, req.(*SetFederationSyncConfigRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Universe_QueryFederationSyncConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryFederationSyncConfigRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UniverseServer).QueryFederationSyncConfig(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/universerpc.Universe/QueryFederationSyncConfig", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UniverseServer).QueryFederationSyncConfig(ctx, req.(*QueryFederationSyncConfigRequest)) + } + return interceptor(ctx, in, info, handler) +} + // Universe_ServiceDesc is the grpc.ServiceDesc for Universe service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -729,6 +801,14 @@ var Universe_ServiceDesc = grpc.ServiceDesc{ MethodName: "QueryEvents", Handler: _Universe_QueryEvents_Handler, }, + { + MethodName: "SetFederationSyncConfig", + Handler: _Universe_SetFederationSyncConfig_Handler, + }, + { + MethodName: "QueryFederationSyncConfig", + Handler: _Universe_QueryFederationSyncConfig_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "universerpc/universe.proto", diff --git a/universe/interface.go b/universe/interface.go index 6d13133ae..d3cf43c5d 100644 --- a/universe/interface.go +++ b/universe/interface.go @@ -629,6 +629,53 @@ func ParseStrProofType(typeStr string) (ProofType, error) { } } +// FedGlobalSyncConfig is a config that can be used to specify the global +// (default) federation sync behavior. +type FedGlobalSyncConfig struct { + // ProofTypes represents the configuration target universe proof type. + ProofType ProofType + + // AllowSyncExport is a boolean that indicates whether leaves from + // universes of the given proof type have may be inserted via federation + // sync. + AllowSyncInsert bool + + // AllowSyncExport is a boolean that indicates whether leaves from + // universes of the given proof type have may be exported via federation + // sync. + AllowSyncExport bool +} + +// FedUniSyncConfig is a config that can be used to specify the federation sync +// behavior for a given Universe. +type FedUniSyncConfig struct { + // UniverseID is the ID of the Universe that the config applies to. + UniverseID Identifier + + // AllowSyncInsert is a boolean that indicates whether leaves from the + // target universe may be inserted via federation sync. + AllowSyncInsert bool + + // AllowSyncExport is a boolean that indicates whether leaves from the + // target universe may be exported via federation sync. + AllowSyncExport bool +} + +// FederationSyncConfigDB is used to manage the set of Universe servers as part +// of a federation. +type FederationSyncConfigDB interface { + // QueryFederationSyncConfigs returns the global and universe specific + // federation sync configs. + QueryFederationSyncConfigs(ctx context.Context) ([]*FedGlobalSyncConfig, + []*FedUniSyncConfig, error) + + // UpsertFederationSyncConfig upserts both global and universe specific + // federation sync configs. + UpsertFederationSyncConfig( + ctx context.Context, globalSyncConfigs []*FedGlobalSyncConfig, + uniSyncConfigs []*FedUniSyncConfig) error +} + // SyncStatsSort is an enum used to specify the sort order of the returned sync // stats. type SyncStatsSort uint8 diff --git a/universe_rpc_diff.go b/universe_rpc_diff.go index 7a657c378..04301a5b0 100644 --- a/universe_rpc_diff.go +++ b/universe_rpc_diff.go @@ -44,7 +44,7 @@ func unmarshalMerkleSumNode(root *unirpc.MerkleSumNode) mssmt.Node { func unmarshalUniverseRoot( root *unirpc.UniverseRoot) (universe.BaseRoot, error) { - id, err := unmarshalUniID(root.Id) + id, err := UnmarshalUniID(root.Id) if err != nil { return universe.BaseRoot{}, err } @@ -60,7 +60,7 @@ func unmarshalUniverseRoots( baseRoots := make([]universe.BaseRoot, 0, len(roots)) for _, root := range roots { - id, err := unmarshalUniID(root.Id) + id, err := UnmarshalUniID(root.Id) if err != nil { return nil, err }