Skip to content

Conversation

@rvagg
Copy link
Member

@rvagg rvagg commented Oct 24, 2025

Ref: FilOzone/filecoin-services#308
Ref: FilOzone/filecoin-services#328

This assumes those PRs will merge. If not, then this can be discarded.

offering.MinPieceSizeInBytes.Bytes(),
offering.MaxPieceSizeInBytes.Bytes(),
offering.StoragePricePerTibPerDay.Bytes(),
offering.MinProvingPeriodInEpochs.Bytes(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

bigEndian; nice!

Copy link
Contributor

@LexLuthr LexLuthr left a comment

Choose a reason for hiding this comment

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

Can we add IPNI key here as well in registration process? We should not allow users to change it in UI. We can implement sync part later. It would be a small change and would consolidate everything registry in single PR.

func (P *PDPIPNITask) initProvider(tx *harmonydb.Tx) error {
var privKey []byte
err := tx.QueryRow(`SELECT priv_key FROM ipni_peerid WHERE sp_id = $1`, PDP_SP_ID).Scan(&privKey)
if err != nil {
if err != pgx.ErrNoRows {
return xerrors.Errorf("failed to get private libp2p key: %w", err)
}
// generate the ipni provider key
pk, _, err := crypto.GenerateEd25519Key(rand.Reader)
if err != nil {
return xerrors.Errorf("failed to generate a new key: %w", err)
}
privKey, err = crypto.MarshalPrivateKey(pk)
if err != nil {
return xerrors.Errorf("failed to marshal the private key: %w", err)
}
pid, err := peer.IDFromPublicKey(pk.GetPublic())
if err != nil {
return xerrors.Errorf("getting peer ID: %w", err)
}
n, err := tx.Exec(`INSERT INTO ipni_peerid (priv_key, peer_id, sp_id) VALUES ($1, $2, $3)`, privKey, pid.String(), PDP_SP_ID)
if err != nil {
return xerrors.Errorf("failed to to insert the key into DB: %w", err)
}
if n == 0 {
return xerrors.Errorf("failed to insert the key into db")
}
}
return nil
}
has the code you will need to generate the key for completely new providers.

@rjan90
Copy link
Collaborator

rjan90 commented Oct 27, 2025

I have approved, given that Mayanks request for changes seems to have been addressed ref slack conversation, and not have this blocking getting to a E2E-testing state in the pdpNext branch with the FWSS GA contracts.

// capabilitiesToOffering converts contract capabilities to FSPDPOffering and remaining custom capabilities
func capabilitiesToOffering(keys []string, values [][]byte) (*FSPDPOffering, map[string]string) {
offering := &FSPDPOffering{}
customCaps := make(map[string]string)
Copy link
Collaborator

Choose a reason for hiding this comment

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

consider returning all capabilities instead of just the unknown ones. This way, when unknown capabilities become known capabilities, it will not be a breaking change.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I want to unblock us currently, and this is not a stable API, so we can change it later.

@Kubuxu Kubuxu merged commit 7e43141 into pdpNext Oct 27, 2025
15 checks passed
@Kubuxu Kubuxu deleted the rvagg/sp-registry-changes branch October 27, 2025 18:31
rvagg added a commit that referenced this pull request Oct 29, 2025
* feat(pdp): deal with new ServiceProviderRegistry changes

Ref: FilOzone/filecoin-services#308
Ref: FilOzone/filecoin-services#328

* fixup! feat(pdp): deal with new ServiceProviderRegistry changes

* fix: treat key presence as truthy for boolean options

Co-authored-by: William Morriss <[email protected]>

* feat(pdp): add IpniPeerID to PDPOfferingData

Signed-off-by: Jakub Sztandera <[email protected]>

* feat(pdp): show IpniPeerID in webui, use IpniPeerID in FSUpdatePDP

Signed-off-by: Jakub Sztandera <[email protected]>

---------

Signed-off-by: Jakub Sztandera <[email protected]>
Co-authored-by: William Morriss <[email protected]>
Co-authored-by: Jakub Sztandera <[email protected]>
Comment on lines +293 to +295
if len(value) >= 20 {
offering.PaymentTokenAddress = common.BytesToAddress(value[len(value)-20:]).Hex()
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants