-
Notifications
You must be signed in to change notification settings - Fork 28
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
PortalNetwork: Deal with rough edges in network startup and CLI Support for Portal Network Node #704
PortalNetwork: Deal with rough edges in network startup and CLI Support for Portal Network Node #704
Conversation
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.
This is a great start! Have left some feedback and looking forward to thinking through some of the details.
...opts, | ||
} | ||
|
||
if (!finalOpts.bindAddress) { |
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.
Is this check really needed since you're providing a default value in DEFAULT_OPTS
?
) | ||
} | ||
|
||
const portal = await PortalNetwork.create(finalOpts) |
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.
@ScottyPoi what do you think about adding these defaults to PortalNetwork.create
as well? I'm trying to think of a reason we wouldn't want the bootnodes list to be an optional default in the create
method for the base client and not just the provider here.
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 think PortalNetwork.create
should still default to an empty bootnodes list so the client doesn't automatically ping all of the bootnodes every time we run a test
packages/portalnetwork/EXAMPLES.md
Outdated
@@ -0,0 +1,50 @@ | |||
# Starting a Portal Network Client |
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.
This is a really interesting idea but we need to have the example script in portalnetwork
for this to make sense.
So, for starters, let's move your portalClient.ts
script from packages/cli/scripts
to a new packages/portalnetwork/examples
directory.
Second, since your code is instantiating an UltralightProvider
instead of a pure portal network client, can you invoke the provider.request
method instead of accessing the provider.portal
APIs?
Otherwise, can you rewrite the script so it instantiates a pure Portal Network client via PortalNetwork.create
instead of the provider?
packages/cli/scripts/portalClient.ts
Outdated
} | ||
|
||
async function main() { | ||
let node: UltralightProvider | undefined |
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.
Let's replace this with a pure PortalNetwork
client instead of the UltralightProvider
since you're not accessing the provider methods.
ce1d95a
to
e065bf8
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.
Here is the complete list of the 15 public ultralight nodes:
const ultralightBootnodes = [
'enr:-I24QO4X4ECNw19M51l3UYjQPq91dwy7FzEdOb43xEjvGnJMOU2cqD-KQ0FNZbpuzRWyQRiqLinAWw2qsgnRQ2guLt0EY4d1IDAuMC4xgmlkgnY0gmlwhKRc9_OJc2VjcDI1NmsxoQOdan7kE4_KU8yM1SNzw9OIrd-oQOlDBnz01fA2fz_1yoN1ZHCCE44',
'enr:-I24QFm1w_fuMnMf4DsUr_PDVzn_Kn_PY6zQYsoWkJIk4evHUxO8OBacbdo4-7bAyvrXsYgCmOVgOQulvA_9ompMfc8EY4d1IDAuMC4xgmlkgnY0gmlwhKRc9_OJc2VjcDI1NmsxoQPeFHF3dY24vc0QgrRIM1vz3ZFnbmddmKLjhP34pxaD5YN1ZHCCE40',
'enr:-I24QEkyh8nyn2PLMokMXzc_zpuiYxN2VHKrGfU7YI60K9_5YoGZsq-kSngZqLHeOWP3La-Pt5zaojutlsbbsbZ30dYEY4d1IDAuMC4xgmlkgnY0gmlwhKRc9_OJc2VjcDI1NmsxoQM-ccaM0TOFvYqC_RY_KhZNhEmWx8zdf6AQALhKyMVyboN1ZHCCE4w',
'enr:-I24QDoMcfNTC3xoH_TSmALXS4WMybTM5SQrysabBxR1DG_UaXHVRHtpQdiGNhxqjHvfSONhnPETB8HorZYplIluDS0EY4d1IDAuMC4xgmlkgnY0gmlwhKRc9_OJc2VjcDI1NmsxoQOImp2idIf2UoY-GoY49pOeJAtqeeDLfb5VDxj94h_I44N1ZHCCE48',
'enr:-I24QHZRM9Sd3UgUOdB443q3nX6NOUsg0VMyarcfD69z8M3SB1vW2hkqiPFczPp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this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks this looks great. There are some of our public bootnodes missing from the list. We have 15 total. I left a complete list in a comment.
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.
LGTM!
This PR deals with rough edges in network startup and also implementation for creating and interacting with a Portal Network node. The key features of this PR include:
UltralightProvider Default
bindaddress
andbootnodes
Portal Network node
--method
: Specifies the Portal Network method to invoke (e.g.,portal_statePing
).--params
: Provides JSON-encoded parameters for the method being called.--port
: Defines the port on which the node will run (default:9090
).createNode
function to initialize a Portal Network node usingPortalNetwork.create
with secure key generation and multiaddr configuration.Related Issues
Closes #700