Skip to content

Add adequate fund/collateral check to revision creation.

Marcin Jachymiak requested to merge 2020-03-check-revision-costs into master

MERGE REQUEST

Overview

This MR avoids hiding the error that zeroes out certain types.Currency values in revisions when renter funds and/or host collateral run low.

build.Critical should not be called in normal circumstances.

Example for Visual changes (ie Screenshot)

Issues Closed

Addresses build.Critical errors showing up on Skynet portals.

siad[25319]: goroutine 229546092 [running]:
siad[25319]: runtime/debug.Stack(0x44aa27, 0x0, 0xc04dad97f8)
siad[25319]:         runtime/debug/stack.go:24 +0x9d
siad[25319]: runtime/debug.PrintStack()
siad[25319]:         runtime/debug/stack.go:16 +0x22
siad[25319]: gitlab.com/NebulousLabs/Sia/build.Critical(0xc04dad98a0, 0x1, 0x1)
siad[25319]:         gitlab.com/NebulousLabs/Sia@/build/critical.go:16 +0xaa
siad[25319]: gitlab.com/NebulousLabs/Sia/types.Currency.Sub(0xc92400, 0xc188fcbbc0, 0x2, 0x6, 0xc188fac800, 0xc188fcbe00, 0x2, 0x6, 0x0, 0x0, ...)
siad[25319]:         gitlab.com/NebulousLabs/Sia@/types/currency.go:184 +0x14e
siad[25319]: gitlab.com/NebulousLabs/Sia/modules/renter/proto.newRevision(0x272cf1a03474a9e1, 0xd6bac1e89eff5f18, 0x88101548dd8d0d8d, 0x74067d9a2dc64253, 0x0, 0xc36dff5bd0, 0x2, 0x2, 0x2, 0x37, ...)
siad[25319]:         gitlab.com/NebulousLabs/Sia@/modules/renter/proto/negotiate.go:216 +0x24f
siad[25319]: gitlab.com/NebulousLabs/Sia/modules/renter/proto.newDownloadRevision(...)
siad[25319]:         gitlab.com/NebulousLabs/Sia@/modules/renter/proto/negotiate.go:232
siad[25319]: gitlab.com/NebulousLabs/Sia/modules/renter/proto.(*Session).Read(0xc188310600, 0xf01e60, 0xc18914c7e0, 0xc188fcbd10, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0, ...)
siad[25319]:         gitlab.com/NebulousLabs/Sia@/modules/renter/proto/session.go:438 +0xa6f
siad[25319]: gitlab.com/NebulousLabs/Sia/modules/renter/proto.(*Session).ReadSection(0xc188310600, 0x1b0f668ac03a83a8, 0x57794ba1e20cad8d, 0xc4437c51be183f64, 0xd99598f7dea7ed75, 0x4000000000, 0x0, 0x0, 0x0, 0x0, ...)
siad[25319]:         gitlab.com/NebulousLabs/Sia@/modules/renter/proto/session.go:582 +0x183
siad[25319]: gitlab.com/NebulousLabs/Sia/modules/renter/contractor.(*hostSession).Download(0xc1870f7b00, 0x1b0f668ac03a83a8, 0x57794ba1e20cad8d, 0xc4437c51be183f64, 0xd99598f7dea7ed75, 0x4000000000, 0x0, 0x0, 0x0, 0x0, ...)
siad[25319]:         gitlab.com/NebulousLabs/Sia@/modules/renter/contractor/session.go:123 +0xfe
siad[25319]: gitlab.com/NebulousLabs/Sia/modules/renter.(*worker).Download(0xc1067c6a80, 0x1b0f668ac03a83a8, 0x57794ba1e20cad8d, 0xc4437c51be183f64, 0xd99598f7dea7ed75, 0x0, 0x1, 0x0, 0x0, 0x0, ...)
siad[25319]:         gitlab.com/NebulousLabs/Sia@/modules/renter/workertools.go:71 +0x2bb
siad[25319]: gitlab.com/NebulousLabs/Sia/modules/renter.(*projectDownloadByRoot).managedStartJobDownloadByRoot(0xc04ea7d710, 0xc1067c6a80)
siad[25319]:         gitlab.com/NebulousLabs/Sia@/modules/renter/projectdownloadbyroot.go:161 +0x9b
siad[25319]: gitlab.com/NebulousLabs/Sia/modules/renter.(*jobDownloadByRoot).callPerformJobDownloadByRoot(0xc04dadbd68, 0xc1067c6a80)
siad[25319]:         gitlab.com/NebulousLabs/Sia@/modules/renter/projectdownloadbyroot.go:78 +0x5e
siad[25319]: gitlab.com/NebulousLabs/Sia/modules/renter.(*worker).managedLaunchJobDownloadByRoot(0xc1067c6a80, 0xc04dadbd00)
siad[25319]:         gitlab.com/NebulousLabs/Sia@/modules/renter/workerdownloadbyroot.go:54 +0x116
siad[25319]: gitlab.com/NebulousLabs/Sia/modules/renter.(*worker).threadedWorkLoop(0xc1067c6a80)
siad[25319]:         gitlab.com/NebulousLabs/Sia@/modules/renter/worker.go:209 +0x1dd
siad[25319]: gitlab.com/NebulousLabs/Sia/modules/renter.(*workerPool).callUpdate.func1(0xc00e36c720, 0xc1067c6a80)
siad[25319]:         gitlab.com/NebulousLabs/Sia@/modules/renter/workerpool.go:84 +0x8e
siad[25319]: created by gitlab.com/NebulousLabs/Sia/modules/renter.(*workerPool).callUpdate
siad[25319]:         gitlab.com/NebulousLabs/Sia@/modules/renter/workerpool.go:76 +0x5e1
siad[25319]: Critical error: negative currency not allowed
siad[25319]: Please submit a bug report here: https://gitlab.com/NebulousLabs/Sia/issues

Checklist

Review and complete the checklist to ensure that the MR is complete before assigned to an approver.

  • All new methods, or updating methods have clear docstrings
  • Testing added or updated for new methods
  • Any new packages are added to Makefile and .gitlab-ci.yml
  • API documentation updated for API updates
  • Module README.md updated for changes to work flow
  • Issue added to Sia-UI repo for new supporting features
  • Changelog updated
Edited by Marcin Jachymiak

Merge request reports