Client: bootstrap() extraction#1222
Conversation
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. |
| // eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
| Promise.all(this.services.map((s) => s.start())) | ||
| .then(() => { | ||
| return Promise.all(this.config.servers.map((s) => s.start())) | ||
| }) | ||
| .then(() => { | ||
| // eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
| Promise.all(this.config.servers.map((s) => s.bootstrap())) | ||
| }) |
There was a problem hiding this comment.
would this achieve the same?
| // eslint-disable-next-line @typescript-eslint/no-floating-promises | |
| Promise.all(this.services.map((s) => s.start())) | |
| .then(() => { | |
| return Promise.all(this.config.servers.map((s) => s.start())) | |
| }) | |
| .then(() => { | |
| // eslint-disable-next-line @typescript-eslint/no-floating-promises | |
| Promise.all(this.config.servers.map((s) => s.bootstrap())) | |
| }) | |
| await Promise.all(this.services.map((s) => s.start())) | |
| await Promise.all(this.config.servers.map((s) => s.start())) | |
| await Promise.all(this.config.servers.map((s) => s.bootstrap())) |
There was a problem hiding this comment.
i believe libp2p runs its own bootstrap, so if the bootstrap() method is only available for RlpxServer, we could add a simple guard to the last line, something like: if('bootstrap' in s) { return s.bootstrap() }
There was a problem hiding this comment.
No, this is just not working, this was my naive (is it?) approach as well on first try. You can test this I guess now also on master with Aleut. If you use this clean await chaining version of yours and do a DEBUG=devp2p:* npm run client:start -- --network=aleut run you should see no Send GET_BLOCK_HEADERS response from our side. If you run with this bad hacky code from my test fix you should see a response together with some follow-up processing (going wrong with "could not decode message BlockHeaders"):
My Promise-feeling unfortunately is so bad that it seems that I don't get this right. Or maybe this just needs some stronger sequentiality with some artificial delays with a timer or so due to the networking stuff? Not sure if this makes sense but we can also try.
Anyhow: I am a bit stuck how to fix this.
There was a problem hiding this comment.
thanks for the info, ok I'll keep looking into it and report back, I am curious now too :)
There was a problem hiding this comment.
I found the problem, we needed to await the Devp2pRLPx initialization, fixed in 0297fd5
…g up bootstrap connections
* fix tests * simplify promises * improve libp2p boostrap comment
51b27ca to
0297fd5
Compare
|
@ryanio thanks for having a look here! 😄 👍 Just pulled the branch and tested with Apart from this test: I am generally wondering what this |
Hmmm, I am seeing it on my side with the current branch, does this run look correct?
All I did was wrap |
|
@ryanio I'll do a new |

@ryanio could you please have a look into this and see how this can be done better? 😄