-
Notifications
You must be signed in to change notification settings - Fork 285
IPFS secio handshake patch likely not forward compatible #1626
Comments
This will likely mean we need to fix this for next release and then push out the timeline for updating to the inline keys until at least enough people upgrade to this next release. |
Thinking through this problem with annotations around the code: primaryTest, err := peer.IDFromPublicKey(s.remote.permanentPubKey)
// *snip*
switch s.remotePeer {
case primaryTest:
// (Primary Case) All good.
case "":
// Ignore
default:
// (Backup Case)
// preparation and checking *snipped*
if s.remotePeer != oldStylePeer {
// Failure Case *snip*
}
} Scenarios:
I see the problem you're describing... it seems the backup test is always stuck producing the hashed peerID when we seem to want the backupTest to use the other algo opposite from the primaryTest. I think the way forward for us will be a function |
That seems like a good approach. Better than when I was suggesting. |
OpenBazaar currently uses hashed ID but intends to later switch to the default inline IDs. During this transition, this commit ensures that nodes of one type should always interop with the other.
OpenBazaar currently uses hashed ID but intends to later switch to the default inline IDs. During this transition, this commit ensures that nodes of one type should always interop with the other.
* commit 'a68e0e617eaa1a3ffa134bc08250b27341e847b4': Bump version to 0.13.4 [OpenBazaar#1626] Fix secio handshake to properly fallback to alt ID generation [OpenBazaar#1634] Apply patch from go-libp2p-secio v0.0.3 release [OpenBazaar#1593] Add Start subcommand option to force key purge from IPNS cache Use separate namespace for IPNS persistent cache Best effort delete ipns record if unmarshaling fails
* development: (77 commits) Fix imports. Remove unused gx code. Delete unused code. Purge unused packages. Add missing gx packages. Handle error when calculating SHA peer id [OpenBazaar#1645] Prevent notifications produced on MODERATOR_ADD and REMOVE Bump version to 0.13.4 [OpenBazaar#1626] Fix secio handshake to properly fallback to alt ID generation [OpenBazaar#1634] Apply patch from go-libp2p-secio v0.0.3 release [OpenBazaar#1593] Add Start subcommand option to force key purge from IPNS cache Use separate namespace for IPNS persistent cache Best effort delete ipns record if unmarshaling fails Don't cache records for our own peerID Add validator in mobile package Add record validator to APIRouter [OpenBazaar#1557] Make CachingRouter implement routing.PubKeyFetcher [OpenBazaar#1557] CachingRouter network lookup fixes Cleanup function naming, lint failures Update mobile/node to use extracted config methods ...
In the code segment below when establishing a new outgoing connection
s.remotePeer
is set to the peerID of the node we're trying to connect to. Ultimately this will either be an old style (hashed) peerID or a new style inline key depending on the actual ID that is used when we try to make a connection.So far so good. Also
peer.IDFromPublicKey
is currently programmed to return an old style (hashed) peerID since we setAdvancedEnableInlining
to false.OK . Now take a look at the secio handshake... this is their raw code without any modifications:
If we ever enable inline keys, old nodes which have not upgraded, when trying to connect to a new style peerID, will pass in a new style ID into
s.remotePeer
butactualRemotePeer
will still be an old style key. Hences.remotePeer
!=actualRemotePeer
and the handshake will fail.If an upgraded node tries to connect to a non-upgraded peerID then
peer.IDFromPublicKey
will return a new style peerID whiles.remotePeer
is an old style key. Hence it will fail to connect.So to make our current release forward compatible with a future release using inline keys I've done:
But looking at it,
s.remotePeer
would be an inline peerID andoldStylePeer
would be an old style key, so I think this is screwed up and would prevent old nodes from connecting to new nodes. I think our current release should be anewStylePeer
and compare it tos.remotePeer
rather than anoldStylePeer
.And then a subsequent release with inline keys should use the code snippet above. (edited)
The text was updated successfully, but these errors were encountered: