Skip to content

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Jul 30, 2025

This is a rename to match the PDPVerifier contract that is about to be deployed. The main changes are the terminology of "proof set" becoming "data set" and "root" becoming "piece", but these have large flow-on effects.

I've split this into 3 commits, so it's possible to not go the whole way, although the last commit does contain additional cleanup as I kept on finding things, unfortunately, so if we opt for a part-way rename then I'd have to do a bit more reconciliation work. IMO just doing the full thing makes everything easier and we don't have weird mismatches anywhere in the stack. But I understand that it introduces a little more complication in the mkv2 migration but hopefully that's minimal since the rules are clear.

  1. Internal rename, mainly focused on the interaction with PDPVerifier, trying to be fairly minimal and non-breaking except for the PDPVerifier interaction (this was my initial intent for this PR but the more I got into the it the more I felt that we could/should just go the whole way).
  2. External API rename - /pdp/ routes get renamed and their request and response values get renamed too. I took the opportunity to fix some inconsistencies (like piece_cid->pieceCid and proofsetRoot->dataSetRoot (S`)) and opted for "SubRoot" and "subRoot", never "subroot". This commit does a fairly nice job of cleaning things up but it is breaking for clients. Ultimately in the SDK and all external interactions we want to entirely remove the old language, we don't want to see error traces or network logs showing "proofset" or "root".
  3. This is the whole hog - database tables and columns renamed and a migration to support it. I've tested the migration with my database and it works nicely.

Unfortunately, as I mentioned above, this third commit also contains some non-database renames that I found and ended up getting squashed into that commit.

Going to leave this draft until we have a contract deployed and the ability to test it against it. I'd like to do full e2e testing with the SDK rename I'm working on in FilOzone/synapse-sdk#129.

@rjan90 rjan90 added the team/fs-wg Items being worked on or tracked by the "FS Working Group". See FilOzone/github-mgmt #10 label Jul 30, 2025
@FilOzzy FilOzzy added this to FS Jul 30, 2025
@github-project-automation github-project-automation bot moved this to 📌 Triage in FS Jul 30, 2025
Comment on lines +5 to +15
-- Check if migration has already been run (idempotency check)
DO $$
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.tables
WHERE table_schema = current_schema()
AND table_name = 'pdp_data_sets') THEN
RAISE NOTICE 'Migration already applied, skipping...';
RETURN;
END IF;
END
$$;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Migrations are already guarded in harmonydb, this is redundant - https://github.com/filecoin-project/curio/blob/main/harmony/harmonydb/harmonydb.go#L271-L297

(To be fair we could improve the harmonydb guard - right now the base table prevents from a migration running twice, but it doesn't prevent from two nodes starting a migration at the same time - this could be solved with a second table, e.g. base_apply - before starting an update a node would look at that table, try to insert an entry with it's address - if that fails it means another node is running the upgrade, or that the upgrade has failed, and in either case the correct behavior is to sit there and wait for the entry to disappear + relevant base entry to appear)

Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens if this is applied in a running cluster?

I'm all for the rename, but there are multiple live pretty serious clusters with the expectation that all upgrades can be performed live (tho admittedly that set doesn't really overlap with the set of nodes running PDP, for now).

Maybe for now this is fine, but in the future we need to build some mechanism which makes migrations like this possible - e.g. a feature/upgrade flags table, where each node goes and says e.g. "I support PDP name migration", then the cluster operator would roughly:

  • Do a rolling upgrade of all nodes in the cluster
  • All nodes would advertise support for the pdp upgrade
  • The upgrade would trigger (automatically or manually) in some atomic way (e.g. cordoning tasks related to the feature flag)
  • Additional mechanism could e.g. apply an implicit config layer which would be applied to nodes NOT supporting a certain feature flag enabled in the cluster (so that old nodes joining the cluster after a feature flag was enabled don't cause a mess)

@rvagg
Copy link
Member Author

rvagg commented Aug 4, 2025

Updated new PDP contract address in here and made it bork on mainnet PDP because that's not deployed yet (@rjan90 maybe we should get a matching mainnet one deployed too?).

Re database -- one problem we have with this is that the data itself cannot be migrated because the new contract is not a plain upgrade of the old one with state copied across, so this unfortunately has to be coupled with a cleared database. Which is not going to be ideal for anyone on mainnet, but currently we lack any infrastructure that has a notion of matching proof sets ("data sets") to contracts, it's just one global contract. So we'll have to work on docs & messaging for that, perhaps also some warning or prompting .. somehow.

@rvagg rvagg changed the base branch from main to rename August 4, 2025 11:56
@rvagg
Copy link
Member Author

rvagg commented Aug 4, 2025

Retargetted to the rename branch so we can do CommPv2 work on top of this and iterate this into a nicely working state.

@rvagg rvagg marked this pull request as ready for review August 4, 2025 11:57
@rjan90 rjan90 merged commit d42873d into filecoin-project:rename Aug 5, 2025
17 checks passed
@github-project-automation github-project-automation bot moved this from 📌 Triage to 🎉 Done in FS Aug 5, 2025
@rjan90
Copy link
Collaborator

rjan90 commented Aug 5, 2025

I've manually merged the changes from rvagg:rvagg/rename into the rename branch to preserve the commit history and optionality that Rod included in his implementation.

@ZenGround0 ZenGround0 mentioned this pull request Aug 12, 2025
33 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team/fs-wg Items being worked on or tracked by the "FS Working Group". See FilOzone/github-mgmt #10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants