-
Notifications
You must be signed in to change notification settings - Fork 32
feat(pdp): deal with new ServiceProviderRegistry changes #736
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
Conversation
| offering.MinPieceSizeInBytes.Bytes(), | ||
| offering.MaxPieceSizeInBytes.Bytes(), | ||
| offering.StoragePricePerTibPerDay.Bytes(), | ||
| offering.MinProvingPeriodInEpochs.Bytes(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bigEndian; nice!
Co-authored-by: William Morriss <[email protected]>
There was a problem hiding this 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.
curio/tasks/indexing/task_pdp_ipni.go
Lines 356 to 390 in 135e5de
| 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 | |
| } |
Signed-off-by: Jakub Sztandera <[email protected]>
Signed-off-by: Jakub Sztandera <[email protected]>
|
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
* 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]>
| if len(value) >= 20 { | ||
| offering.PaymentTokenAddress = common.BytesToAddress(value[len(value)-20:]).Hex() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ref: FilOzone/filecoin-services#308
Ref: FilOzone/filecoin-services#328
This assumes those PRs will merge. If not, then this can be discarded.