Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add federation sync configuration SQL table and RPC endpoints #537

Merged
merged 4 commits into from
Oct 11, 2023

Conversation

ffranr
Copy link
Contributor

@ffranr ffranr commented Sep 28, 2023

This PR adds functionality to configure the universe federation sync routine. It facilitates both a general configuration and a universe/asset specific configuration.

This PR is part of the work necessary to complete #530 .


This change is Reviewable

@ffranr ffranr requested review from Roasbeef and jharveyb September 28, 2023 16:27
@ffranr ffranr force-pushed the federation-sync-config branch from 43591a1 to fd02dbd Compare September 28, 2023 16:35
@ffranr ffranr force-pushed the federation-sync-config branch 4 times, most recently from 010689b to 76571f6 Compare September 29, 2023 14:56
universe/interface.go Outdated Show resolved Hide resolved
tapdb/sqlc/migrations/000007_universe.up.sql Outdated Show resolved Hide resolved
tapdb/sqlc/migrations/000007_universe.up.sql Outdated Show resolved Hide resolved
tapdb/sqlc/migrations/000007_universe.up.sql Outdated Show resolved Hide resolved
tapdb/sqlc/migrations/000007_universe.up.sql Show resolved Hide resolved
tapdb/sqlc/migrations/000007_universe.up.sql Outdated Show resolved Hide resolved
tapdb/sqlc/migrations/000007_universe.up.sql Outdated Show resolved Hide resolved
tapdb/universe_federation.go Outdated Show resolved Hide resolved
rpcserver.go Outdated Show resolved Hide resolved
@ffranr ffranr force-pushed the federation-sync-config branch from 76571f6 to 4f42c0a Compare October 3, 2023 01:54
@ffranr
Copy link
Contributor Author

ffranr commented Oct 3, 2023

All set/query db transactions are now atomic.

I've added an enum to signify which proofs should be synced. I think it's the cleanest solution because each sync process will either exclude proofs, sync issuance, or sync all proofs. We can also expand the enum (which comes close to Oli's key-value idea.)

Let me know what you guys think @guggero @Roasbeef

@ffranr ffranr requested review from guggero and Roasbeef October 3, 2023 01:58
@ffranr ffranr force-pushed the federation-sync-config branch 3 times, most recently from eacca37 to f38d319 Compare October 3, 2023 12:24
universe/interface.go Outdated Show resolved Hide resolved
tapdb/sqlc/migrations/000007_universe.up.sql Outdated Show resolved Hide resolved
tapdb/sqlc/migrations/000007_universe.up.sql Show resolved Hide resolved
tapdb/sqlc/migrations/000007_universe.up.sql Outdated Show resolved Hide resolved
tapdb/sqlc/migrations/000007_universe.up.sql Outdated Show resolved Hide resolved
tapdb/universe_federation.go Outdated Show resolved Hide resolved
rpcserver.go Outdated Show resolved Hide resolved
rpcserver.go Outdated Show resolved Hide resolved
taprpc/universerpc/universe.proto Outdated Show resolved Hide resolved
taprpc/universerpc/universe.proto Outdated Show resolved Hide resolved
Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good. I think the level of configurability makes sense for the moment.
I assume the code to actually sync according to the setting will be done in a follow-up PR?

universe/interface.go Outdated Show resolved Hide resolved
universe/interface.go Outdated Show resolved Hide resolved
tapdb/universe_federation.go Outdated Show resolved Hide resolved
rpcserver.go Outdated Show resolved Hide resolved
taprpc/universerpc/universe.proto Outdated Show resolved Hide resolved

// QueryFederationSyncConfigs returns the general and universe specific
// federation sync configs.
func (u *UniverseFederationDB) QueryFederationSyncConfigs(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A standalone unit test for DB operations would be nice.

taprpc/universerpc/universe.proto Outdated Show resolved Hide resolved
itest/universe_test.go Outdated Show resolved Hide resolved
@ffranr ffranr force-pushed the federation-sync-config branch 4 times, most recently from e037319 to e05294b Compare October 4, 2023 15:14
@Roasbeef
Copy link
Member

Roasbeef commented Oct 4, 2023

I assume the code to actually sync according to the setting will be done in a follow-up PR?

Yep plan is to do this as we work through #544.

@Roasbeef
Copy link
Member

Roasbeef commented Oct 4, 2023

Needs a rebase!

@ffranr ffranr force-pushed the federation-sync-config branch from e05294b to 2af624b Compare October 5, 2023 15:23
@ffranr ffranr changed the base branch from main to uni-namespace-proof-type October 5, 2023 15:23
@ffranr ffranr force-pushed the uni-namespace-proof-type branch from 7b813c1 to 5557ce6 Compare October 5, 2023 15:52
@ffranr ffranr self-assigned this Oct 6, 2023
@ffranr ffranr force-pushed the uni-namespace-proof-type branch from 5557ce6 to 05da767 Compare October 6, 2023 15:01
@Roasbeef Roasbeef requested a review from guggero October 7, 2023 00:46
@ffranr ffranr force-pushed the uni-namespace-proof-type branch from b1c6588 to 3ab1c01 Compare October 9, 2023 21:32
@ffranr ffranr force-pushed the federation-sync-config branch 3 times, most recently from 54f716f to 0dcd95c Compare October 10, 2023 01:07
@ffranr ffranr requested review from Roasbeef and guggero October 10, 2023 01:10
Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

tapdb/sqlc/migrations/000007_universe.down.sql Outdated Show resolved Hide resolved
@ffranr ffranr force-pushed the federation-sync-config branch 2 times, most recently from fe93d2c to 7f6d3fa Compare October 10, 2023 19:53
@ffranr ffranr force-pushed the federation-sync-config branch 5 times, most recently from 8544884 to 3616bd6 Compare October 10, 2023 23:36
This commit adds two tables for storing universe federation sync
configuration settings:
1. federation_global_sync_config stores global (but proof type specific)
federation sync configuration.
2. federation_uni_sync_config stores universe specific sync
configuration.
Add RPC endpoints for setting and querying for federation sync config:
* SetFederationSyncConfig
* QueryFederationSyncConfig
@ffranr ffranr force-pushed the federation-sync-config branch from 3616bd6 to 95b03be Compare October 10, 2023 23:57
@ffranr ffranr requested a review from Roasbeef October 11, 2023 00:22
@Roasbeef Roasbeef requested a review from guggero October 11, 2023 02:37
Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 16 files at r5, all commit messages.
Reviewable status: 9 of 22 files reviewed, 37 unresolved discussions (waiting on @ffranr, @guggero, and @jharveyb)


rpcserver.go line 2598 at r4 (raw file):

	return &universe.FedUniSyncConfig{
		UniverseID: uniID,
		ProofTypes: proofTypes,

I think we still want this here to distinguish between issuance/transfer trees for insert/export?

Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🧲


-- This table contains universe (asset/asset group) specific federation sync
-- configuration.
CREATE TABLE IF NOT EXISTS federation_uni_sync_config (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC, in order for something to later on have a foreign key that refs this table, it does in fact still need a primary key.

I think we just want a composite primary key here. Though I saw you had to re-work things slightly tho, non-blocking comment.

@Roasbeef Roasbeef merged commit 28e4a6b into uni-namespace-proof-type Oct 11, 2023
14 checks passed
@guggero guggero deleted the federation-sync-config branch October 11, 2023 07:24
@ffranr ffranr restored the federation-sync-config branch October 11, 2023 11:59
@ffranr ffranr deleted the federation-sync-config branch October 11, 2023 12:28
@ffranr ffranr mentioned this pull request Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants