-
Notifications
You must be signed in to change notification settings - Fork 74
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
feat(daemon): multiplayer #2114
Conversation
0109bb0
to
fc4c179
Compare
fc4c179
to
375c3e9
Compare
assertValidFormulaIdentifier utility
8cec137
to
f7e7f21
Compare
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.
Only notes.
const type = formulaIdentifier.slice(0, delimiterIndex); | ||
const number = formulaIdentifier.slice(delimiterIndex + 1); | ||
return { type, number }; | ||
const [type, number, location] = formulaIdentifier.split(':'); |
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’m guessing this eventually evolves to the endo://NODE/VALUE?type=TYPE
subset of endo://NODE/VALUE?type=TYPE&subtype=&address=&address=
@@ -21,8 +21,10 @@ const { quote: q } = assert; | |||
* @param {import('./types.js').DaemonCore['incarnateWebBundle']} args.incarnateWebBundle | |||
* @param {import('./types.js').DaemonCore['incarnateHandle']} args.incarnateHandle | |||
* @param {import('./types.js').DaemonCore['storeReaderRef']} args.storeReaderRef | |||
* @param {import('./types.js').DaemonCore['getAllNetworkAddresses']} args.getAllNetworkAddresses |
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’m fine abbreviating this to addresses
packages/daemon/src/host.js
Outdated
networksDirectoryFormulaIdentifier, | ||
); | ||
const peerInfo = { | ||
location: ownLocation, |
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.
Location is going to become quickly ambiguous since we will have locations of varying specificity:
endo://node
node locationendo://node/value
value locationendo://node/value.type
typed value locationendo://node/value.type?address=&address=
value location (née offline capability) with connection hintsendo://node/value.blob-reader-base64/application/javascript?address=&address=
MIME-typed downloadable blob location over base64 until CapTP maybe someday can do byte streams
This can perhaps just be peer
implying “peer identifier” or “peer public key” someday
packages/daemon/src/daemon.js
Outdated
// eslint-disable-next-line no-use-before-define | ||
const ownLocation = getDerivedId( | ||
'location', | ||
rootEntropy, | ||
cryptoPowers.makeSha512(), | ||
); | ||
// eslint-disable-next-line no-use-before-define | ||
const peersFormulaNumber = getDerivedId( | ||
'peers', | ||
rootEntropy, | ||
cryptoPowers.makeSha512(), | ||
); |
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.
Why are these derived as opposed to random?
If this is needed, the function should be renamed getDerivedNumber
and we could move it to the top to get rid of the eslint-disable
directives.
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 made a refactor that made sense at the time that separated endoCore generic methods from the configured Endo. this looked good at the time but now provideValueforFormulaIdentifier (and everything that uses it) rely on the configuration of the ownLocation. I made the smallest change here, but it invalidated the previous refactor.
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.
So we can just use random numbers instead?
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.
after arm wrestling daemonCore
a bit, yes
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 recommend we do this after simplifying the daemon's provideWhateverFromFormulaWhatever
code paths
🎉 🎉 🎉 |
provideValueForFormulaIdentifier
looks up non-local values via the formulaIdentifier's nodeIdentifier when peer is knowngetPeerInfo
,addPeerInfo
for introducing peers