storj-archived / core

Deprecated. Implementation of the Storj v2 protocol for Node.js.
https://storj.io
Other
395 stars 88 forks source link

fix bug with contract renewal when previous version had hd renter key #686

Closed tacticalchihuahua closed 7 years ago

tacticalchihuahua commented 7 years ago

closes #685

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling ef8519814e74ab35b029a1629c4cad81a022655d on bookchin:bug/renew-key into 7ce3890365a2458dcdeebf7a4c7c2d3a986b2d1b on Storj:master.

littleskunk commented 7 years ago

The fix itself is working. There is a second problem. {"level":"info","message":"handleRenew cannot be changed","timestamp":"2017-04-21T16:13:09.431Z"} https://github.com/Storj/core/blob/2742d487491e485274e1c3c50c47447f426917ba/lib/network/protocol.js#L639

I will try to get a better output. May need a few hours to get the next one.

tacticalchihuahua commented 7 years ago

That's really strange, can you try to log out originalContract and updatedContract?

littleskunk commented 7 years ago
{"level":"info","message":"handleRenew handling renew request from 593844dc7f0076a1aeda9a6b9788af17e67c1052 hash 5938761c30aa15e648740ca9b3a92996b0a46b93","timestamp":"2017-04-21T19:12:41.374Z"}
{"level":"info","message":"handleRenew originalContract: \"{\\\"audit_count\\\":3,\\\"data_hash\\\":\\\"5938761c30aa15e648740ca9b3a92996b0a46b93\\\",\\\"data_size\\\":59020,\\\"farmer_id\\\":\\\"188071ba7cfd974a9e47b59e24b0737ebf845db3\\\",\\\"farmer_signature\\\":\\\"IPHkTCg8pgAZMu9FzOZ7aUGpGEx1dN4N/n/2wb3pz5/8LqRGe9w5MSDlQ2D5uCmjpJT9YOYAUa2eQRASKaPI65g=\\\",\\\"payment_destination\\\":\\\"1LDoMxKY7LJqPPigUm2gcAcfWEXWKKAoRL\\\",\\\"payment_download_price\\\":0,\\\"payment_storage_price\\\":0,\\\"renter_hd_index\\\":7682219,\\\"renter_hd_key\\\":\\\"xpub6AHweYHAxk1EhJSBctQD1nLWPog6Sy2eTpKQLExR1hfzTyyZQWvU4EYNXv1NJN7GpLYXnDLt4PzN874g6zSjAQdFCHZN7U7nbYKYVDUzD42\\\",\\\"renter_id\\\":\\\"549f514c68a9de3170a29b95db0271c7e9b5ff9b\\\",\\\"renter_signature\\\":\\\"IFw/lkDpGubynC5ddBTDoAM5exPfV7y5kGZrZFnCNfj7PGu5qSdpgqP2lThsVi8TIa1uG04XKK2Up3s0snScBW8=\\\",\\\"store_begin\\\":1485159283430,\\\"store_end\\\":1492935283430,\\\"version\\\":0}\"","timestamp":"2017-04-21T19:12:41.377Z"}
{"level":"info","message":"handleRenew updatedContract: \"{\\\"audit_count\\\":3,\\\"data_hash\\\":\\\"5938761c30aa15e648740ca9b3a92996b0a46b93\\\",\\\"data_size\\\":59020,\\\"farmer_id\\\":\\\"74f9955a071ff19c9ce2abc8a620c4565f352fa3\\\",\\\"farmer_signature\\\":\\\"H2rnPkZscC7+NsMngwPoPk/P8/hKjHEscjwzyDOXl9jYYOk2TWeDI1AAPzJSVB4oGBDcg1JVkAx0d9iRh9An1e4=\\\",\\\"payment_destination\\\":\\\"198puXAV9hyHDqP8vFp9kiRAYgBje5jqX9\\\",\\\"payment_download_price\\\":0,\\\"payment_storage_price\\\":0,\\\"renter_hd_index\\\":3558774,\\\"renter_hd_key\\\":\\\"xpub6AHweYHAxk1EhJSBctQD1nLWPog6Sy2eTpKQLExR1hfzTyyZQWvU4EYNXv1NJN7GpLYXnDLt4PzN874g6zSjAQdFCHZN7U7nbYKYVDUzD42\\\",\\\"renter_id\\\":\\\"143a89d5ec8057ec424a93b228055e68c4ce0c25\\\",\\\"renter_signature\\\":\\\"IDIxoz3k81mqi2zXutY774X/j2GjR6hZuFVuqKSERQDZOom7vfvxNz0D2s9UQPdJBy0bdGTkj9OND4CcVU/yKLo=\\\",\\\"store_begin\\\":1478419434735,\\\"store_end\\\":1486195434735,\\\"version\\\":0}\"","timestamp":"2017-04-21T19:12:41.378Z"}
{"level":"info","message":"handleRenew farmer_id cannot be changed","timestamp":"2017-04-21T19:12:41.378Z"}
littleskunk commented 7 years ago

At least the client side has worked correct. The bridge is sending the renew message to the wrong farmer. Merge the pull request and open a new issue for the bridge side?

tacticalchihuahua commented 7 years ago

Yeah, sounds good. Thanks for the help :)

littleskunk commented 7 years ago

https://github.com/Storj/bridge/issues/426