Conversation
9372c0d to
aec9e75
Compare
--bootstrap-url parameter for simple initialization of archive node
--bootstrap-url parameter for simple initialization of archive node--bootstrap-url parameter for simple initialization of archive node
aec9e75 to
ddf6eb2
Compare
ddf6eb2 to
0b16a1c
Compare
| @@ -0,0 +1,13 @@ | |||
| package types | |||
There was a problem hiding this comment.
(Not directly relevant to the PR.)
The package should've been called rpctypes so that one doesn't have to rename it all the time
(actually, I have the same thought about connection_manager which is contra at least two go conventions: no snake_case and a manager cannot be a package; the package should be what the manager manages; I suggest smth like connections there)
| func (nb *nodeApiBuilder) WithLocalShardApiRw(shardId types.ShardId, txnpool txnpool.Pool) *nodeApiBuilder { | ||
| var localShardApi shardApiRw = newLocalShardApiRw(newLocalShardApiRo(shardId, nb.db), txnpool) | ||
| var bootstrapConfig *rpctypes.BootstrapConfig // = nil — not used in rw API methods | ||
| var localShardApi shardApiRw = newLocalShardApiRw(newLocalShardApiRo(shardId, nb.db, bootstrapConfig), txnpool) |
There was a problem hiding this comment.
why not shardApiRw := newLocalShardApiRw(newLocalShardApiRo(shardId, nb.db, nil), txnpool)?
There was a problem hiding this comment.
Answered in a neighboring comment. I want to see the interface type explicitly.
There was a problem hiding this comment.
To see the explicit interface type for what purpose?
(it's usually shown by an IDE btw)
There was a problem hiding this comment.
This is more of a contract for the code below
| shardId types.ShardId, | ||
| bootstrapConfig *rpctypes.BootstrapConfig, | ||
| ) *nodeApiBuilder { | ||
| var localShardApi shardApiRo = newLocalShardApiRo(shardId, nb.db, bootstrapConfig) |
There was a problem hiding this comment.
Actually, this code was written by me earlier, just changing the formatting here. But I purposely used an explicit type statement for clarity and to express the intent.
There was a problem hiding this comment.
I disagree that var localShardApi shardApiRo = newLocalShardApiRo is more clear than localShardApi := newLocalShardApiRo
But up to you
There was a problem hiding this comment.
The point is that the "constructor" returns a pointer to the implementation (this may also be controversial, but so far I find it more practical). At the point of assignment, I emphasize that the code should not rely on the details of the implementation, but rather work with the interface.
Yes, this is probably really far-fetched, but I found it convenient.
| }() | ||
| if err = initSyncers(ctx, res.syncers, cfg.AllowDbDrop); err != nil { | ||
| if err = initSyncers( | ||
| libp2pnetwork.WithAllowLimitedConn(ctx, "allow working through relay with traffic proxying"), |
There was a problem hiding this comment.
shouldn't it be done on some lower level?
There was a problem hiding this comment.
I think ultimately we need to deal with establishing a direct connection, but as I wrote in the PR description, it's not the most trivial task. So such an obvious "plug" that the eye clings to seems to me preferable to a solution that will pretend to be good.
3c259cd to
021a07f
Compare
c9abe69 to
925dfee
Compare
| shardId types.ShardId, | ||
| bootstrapConfig *rpctypes.BootstrapConfig, | ||
| ) *nodeApiBuilder { | ||
| var localShardApi shardApiRo = newLocalShardApiRo(shardId, nb.db, bootstrapConfig) |
There was a problem hiding this comment.
I disagree that var localShardApi shardApiRo = newLocalShardApiRo is more clear than localShardApi := newLocalShardApiRo
But up to you
| func (nb *nodeApiBuilder) WithLocalShardApiRw(shardId types.ShardId, txnpool txnpool.Pool) *nodeApiBuilder { | ||
| var localShardApi shardApiRw = newLocalShardApiRw(newLocalShardApiRo(shardId, nb.db), txnpool) | ||
| var bootstrapConfig *rpctypes.BootstrapConfig // = nil — not used in rw API methods | ||
| var localShardApi shardApiRw = newLocalShardApiRw(newLocalShardApiRo(shardId, nb.db, bootstrapConfig), txnpool) |
There was a problem hiding this comment.
To see the explicit interface type for what purpose?
(it's usually shown by an IDE btw)
925dfee to
c6e4e74
Compare
This is an alternative approach to the one proposed in #813.
Pros:
Caveats:
EnableAutoNATv2andEnableHolePunchingin real or near real conditions. To avoid being blocked by this now, I've enabled theWithInfiniteLimitssetting on relays, andWithAllowLimitedConnon nodes. This should work "cheap but surly".