Conversation
pkg/check/gsoc/gsoc.go
Outdated
| return err | ||
| } | ||
| resourceId, socAddress, err := mineResourceId(ctx, addresses.Overlay, privKey, 1) | ||
| depth := 6 |
There was a problem hiding this comment.
Why depth of 6?
Can you change the var name to describe why this depth, or to add comment?
There was a problem hiding this comment.
maybe the depth should be configurable, so we can 1 for the CI, and and a different value for the testnet?
There was a problem hiding this comment.
for depth, maybe commitment depth can be used from the /status endpoint?
There was a problem hiding this comment.
Depth here is the number matching prefix between the mined soc address and the nodes overlay. Not the committed depth or storage depth
It increases the likelihood that the listener node is the one selected for push.
Say you have a target listener node
n1=cad272543ccb97a829694b6686ad8d9950a33a4a0a30e07c73c00b537bca39bf
Then you mine a soc for that target node with depth=1 and obtain
soc_addr=c19aa88ebd6853ef048a7503d9d9b5241db7a3583865ea54b8d9e61598a16fa9.
The chunk could be pushed out instead to another node (having the same depth as the soc)
n2=c8fe3459d51267f1d1fbc7b3d7542845d6c5c865027ce5ab1cebd56a13c2ec6e.
So the test will fail.
Increasing the depth gives us more guarantee that our listener will be selected.
e.g with depth=6,
when the target node is
n1=cad272543ccb97a829694b6686ad8d9950a33a4a0a30e07c73c00b537bca39bf
mined soc will be soc_addr=cad272....
It's also unlikely that there's another node with that prefix. So our target node will be selected for push.
In nugeons original integration tests, he used 11
https://github.com/anythread/gsoc/blob/master/test/index.spec.ts#L24
11 takes a long time to mine and 6 seems to be sweet spot between testnet and CI.
There was a problem hiding this comment.
Can you change the var name for beter description, something like:
prefixMatchDepth, or anything that describes it better?
Increase the depth for mining the soc addresses so that the listener node is picked more accurately when pushing out the chunk on the uploader.
Also increases the timeout to receive all messages.