Hi, it seems like the test runner is running against a file: “/tmp/torrents925035392/codercat.gif.torrent” I’ve decoded the file and encoded the info dictionary and Sha1 hashed which results in hash:
c77829d2a77d6516f88cd7a3de1a26abcbfab0db
And i’m getting: {“failure reason”:“provided invalid infohash”}
My info-hash is passing all the tests; and it seems to only be a problem with this torrent file? Furthermore when the test runner decides to run a test against another torrent; my client correctly downloads all the pieces, but it errors on a timeout. I’ve tried to multi-thread the download of piece-blocks, but to no avail.
i’ve base64 encoded the file “codercat.gif.torrent” and printed it to stdout; such that i could get a copy of it locally. now i’ve uploaded it to https://torrent-metadata.vercel.app/ which reports the same info-hash as my program: c77829d2a77d6516f88cd7a3de1a26abcbfab0db
Hi Matt2843,
The info hash tester is expecting is indeed c77829d2a77d6516f88cd7a3de1a26abcbfab0db
You can find the torrent files here:
You can open them with a torrent program like qBittorrent to validate the info hash (although we’re in agreement on the correct value)
The correct URL we’re expecting to request peers is this: http://bittorrent-test-tracker.codecrafters.io/announce?compact=1&downloaded=0&info_hash=%C7x%29%D2%A7%7De%16%F8%8C%D7%A3%DE%1A%26%AB%CB%FA%B0%DB&left=2994120&peer_id=%1E%83FP%81%96%24+N%C2%96%F7%B6ep%D9f%97A%88&port=6881&uploaded=0
If you look carefully, parts of your info hash in the URL you provided seem to be incorrect: http://bittorrent-test-tracker.codecrafters.io/announce?info_hash=%C7x)%D2%A7%7De%16%F8%8C%D7%A3%DE%1A&%AB%CB%FA%B0%DB&peer_id=-mab-ztorrent-001224&port=6881&uploaded=0&downloaded=0&left=2994120&compact=1
Hope this helps, let me know if you have other questions
Thanks! My only other question was the 2nd comment in this thread, I don’t understand the test-runner timeout constraint. I’ve tried to multithread my client etc. but to no avail; is it something on my end that should be optimzed?
Following the query-grammar of that RFC the byte=0x29 ascii ) does not need to be percent-encoded nor does & which are the two characters that differ in the query-string. The grammar rules are here:
I guess when used in a key-value pair query-string we want to encode the values, so we can interpret & as the separator. i’ll just do it manually, the std.Uri in zig does not have any convenience in this regard. But I still wonder about the timeouts!