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

fix: store remote agent and protocol version during identify #943

Conversation

achingbrain
Copy link
Member

These values were not being stored during identify.

These values were not being stored during identify.
@achingbrain achingbrain requested review from vasco-santos and jacobheun and removed request for vasco-santos May 12, 2021 15:44
@achingbrain
Copy link
Member Author

achingbrain commented May 12, 2021

I did have a couple of questions about this - why is message.agentVersion stored PascalCase style as "AgentVersion", I would have thought "agentVersion" would be more idiomatic?

Why are they stored as Uint8Arrays when they are deserialized from the incoming protobuf message as strings?

@vasco-santos
Copy link
Member

I did have a couple of questions about this - why is message.agentVersion stored PascalCase style as "AgentVersion", I would have thought "agentVersion" would be more idiomatic?

I tracked it down to #724 . I am not sure, probably to be similar to Go? We did try to follow go whenever possible for storing stuff in the stores.

Why are they stored as Uint8Arrays when they are deserialized from the incoming protobuf message as strings?

Because we persist the metadataBook content as Uint8Array, as a Datastore Value. In this case, we considered that anything could be stored as metadata, including a serialized protobuf

await pWaitFor(() => connection.streams.length === 0)
await connection.close()

const remotePeer = PeerId.createFromB58String('12D3KooWHFKTMzwerBtsVmtz4ZZEQy2heafxzWw6wNn5PPYkBxJ5')
Copy link
Member

Choose a reason for hiding this comment

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

Can we do not have the peerId hardcoded?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought I would have been able to get it from remoteLibp2p but that var does't appear to be set anywhere in the tests?

Copy link
Member

Choose a reason for hiding this comment

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

I was meaning, probably more bullet proof to extract the id from the multiaddr

Copy link
Member Author

Choose a reason for hiding this comment

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

Aha, have updated it.

Copy link
Member

@vasco-santos vasco-santos left a comment

Choose a reason for hiding this comment

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

LGTM

@vasco-santos vasco-santos merged commit 818d2b2 into master May 12, 2021
@vasco-santos vasco-santos deleted the fix/store-remote-agent-and-protocol-versions-during-identify branch May 12, 2021 17:11
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.

2 participants