I have some transaction failing during a dryrun with the following rejection error:
logic eval error: panic in TEAL Eval: &{0xc00008c000 map[file:userBalance.go function:github.com/algorand/go-algorand/data/basics.AccountData.WithUpdatedRewards line:411] 2021-09-14 23:14:21.6489054 -0300 -03 m=+34698.978071801 panic <nil> AccountData.WithUpdatedRewards(): overflowed account balance when applying rewards {997009} + 0*(0-203354) <nil> <nil>
What could be the source of this problem? It does not fail in the TEAL code itself (the dryrun shows after this message a proper trace of TEAL output).
I tried several accounts.
Thank you.
Addendum. Here is the complete stack trace during the dryrun:
goroutine 1090797 [running]:
github.com/algorand/go-algorand/data/transactions/logic.eval.func1(0xc009ea8240, 0xc004fa2a00, 0xc009ea8248)
github.com/algorand/go-algorand/data/transactions/logic/eval.go:399 +0xcf
panic(0x7ff6c6af84e0, 0xc009aed730)
runtime/panic.go:971 +0x49a
github.com/algorand/go-algorand/logging.logger.Panicf.func1(0xc00008c070, 0xc000006028)
github.com/algorand/go-algorand/logging/log.go:274 +0x91
panic(0x7ff6c6af84e0, 0xc009aed730)
runtime/panic.go:965 +0x1c7
github.com/sirupsen/logrus.Entry.log(0xc00008c000, 0xc012bf8900, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
github.com/sirupsen/logrus@v1.4.2/entry.go:239 +0x2f3
github.com/sirupsen/logrus.(*Entry).Log(0xc009aed6c0, 0x0, 0xc009c08b40, 0x1, 0x1)
github.com/sirupsen/logrus@v1.4.2/entry.go:268 +0xf2
github.com/sirupsen/logrus.(*Entry).Logf(0xc009aed6c0, 0xc000000000, 0x7ff6c6b6ead8, 0x62, 0xc003f0fa00, 0x4, 0x4)
github.com/sirupsen/logrus@v1.4.2/entry.go:314 +0xed
github.com/sirupsen/logrus.(*Entry).Panicf(...)
github.com/sirupsen/logrus@v1.4.2/entry.go:352
github.com/algorand/go-algorand/logging.logger.Panicf(0xc00008c070, 0xc000006028, 0x7ff6c6b6ead8, 0x62, 0xc003f0fa00, 0x4, 0x4)
github.com/algorand/go-algorand/logging/log.go:278 +0x1a7
github.com/algorand/go-algorand/data/basics.AccountData.WithUpdatedRewards(0x0, 0xf3691, 0x31aa3, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
github.com/algorand/go-algorand/data/basics/userBalance.go:411 +0x2d8
github.com/algorand/go-algorand/ledger.(*roundCowState).Get(0xc009006380, 0x2faf28a0ee3cca9c, 0x2c0dda1b01f40aa2, 0xd035c7401d900d37, 0xbac1323ca345c979, 0x1, 0x0, 0x0, 0x0, 0x0, ...)
github.com/algorand/go-algorand/ledger/eval.go:236 +0x205
github.com/algorand/go-algorand/ledger.(*logicLedger).Balance(0xc003f0f5c0, 0x2faf28a0ee3cca9c, 0x2c0dda1b01f40aa2, 0xd035c7401d900d37, 0xbac1323ca345c979, 0x2c0dda1b01f40aa2, 0xd035c7401d900d37, 0xbac1323ca345c979)
github.com/algorand/go-algorand/ledger/applications.go:73 +0xac
github.com/algorand/go-algorand/data/transactions/logic.opBalance.func1(0x2faf28a0ee3cca9c, 0x2c0dda1b01f40aa2, 0xd035c7401d900d37, 0xbac1323ca345c979, 0xc00705d180, 0x2faf28a0ee3cca9c, 0x2c0dda1b01f40aa2, 0xd035c7401d900d37)
github.com/algorand/go-algorand/data/transactions/logic/eval.go:2725 +0x4e
github.com/algorand/go-algorand/data/transactions/logic.opBalanceQuery(0xc004fa2a00, 0xc009c09bc8, 0x7ff6c6b1e781, 0x7, 0x203002700000000, 0x219625fffff)
github.com/algorand/go-algorand/data/transactions/logic/eval.go:2709 +0x11a
github.com/algorand/go-algorand/data/transactions/logic.opBalance(0xc004fa2a00)
github.com/algorand/go-algorand/data/transactions/logic/eval.go:2727 +0x79
github.com/algorand/go-algorand/data/transactions/logic.(*evalContext).step(0xc004fa2a00)
github.com/algorand/go-algorand/data/transactions/logic/eval.go:659 +0x64a
github.com/algorand/go-algorand/data/transactions/logic.eval(0xc00d3c3400, 0x3e1, 0x3e1, 0xc004fa2a00, 0x10d0961cd7548200, 0x0, 0x0)
github.com/algorand/go-algorand/data/transactions/logic/eval.go:479 +0x36e
github.com/algorand/go-algorand/data/transactions/logic.EvalStateful(0xc00d3c3400, 0x3e1, 0x3e1, 0xc009ba8680, 0xc00705d180, 0x0, 0x0, 0xc009ba7b80, 0x1, 0x1, ...)
github.com/algorand/go-algorand/data/transactions/logic/eval.go:373 +0xf3
github.com/algorand/go-algorand/ledger.(*roundCowState).StatefulEval(0xc009006000, 0xc009ba8680, 0xc00705d180, 0x0, 0x0, 0xc009ba7b80, 0x1, 0x1, 0x0, 0xc009bae000, ...)
github.com/algorand/go-algorand/ledger/appcow.go:494 +0x138
github.com/algorand/go-algorand/daemon/algod/api/server/v2.doDryrunRequest(0xc0140a4c80, 0xc009eaade8)
github.com/algorand/go-algorand/daemon/algod/api/server/v2/dryrun.go:506 +0x743
github.com/algorand/go-algorand/daemon/algod/api/server/v2.(*Handlers).TealDryrun(0xc0077f33b0, 0x7ff6c6d3ae38, 0xc00ab8c820, 0x7ff6c693d280, 0xc003694df8)
github.com/algorand/go-algorand/daemon/algod/api/server/v2/handlers.go:442 +0x550
github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated.(*ServerInterfaceWrapper).TealDryrun(0xc002f89670, 0x7ff6c6d3ae38, 0xc00ab8c820, 0x40, 0xc00fe8c4c0)
github.com/algorand/go-algorand/daemon/algod/api/server/v2/generated/routes.go:441 +0x3f9
github.com/algorand/go-algorand/daemon/algod/api/server/lib/middlewares.(*AuthMiddleware).handler.func1(0x7ff6c6d3ae38, 0xc00ab8c820, 0x1, 0x1)
github.com/algorand/go-algorand/daemon/algod/api/server/lib/middlewares/auth.go:100 +0x30d
github.com/labstack/echo/v4.(*Echo).add.func1(0x7ff6c6d3ae38, 0xc00ab8c820, 0x7ff6c6b30975, 0x1b)
github.com/labstack/echo/v4@v4.1.17/echo.go:522 +0x69
github.com/labstack/echo/v4/middleware.CORSWithConfig.func1.1(0x7ff6c6d3ae38, 0xc00ab8c820, 0x7ff6c733a580, 0x0)
github.com/labstack/echo/v4@v4.1.17/middleware/cors.go:121 +0x483
github.com/algorand/go-algorand/daemon/algod/api/server/lib/middlewares.(*LoggerMiddleware).handler.func1(0x7ff6c6d3ae38, 0xc00ab8c820, 0x2, 0x2)
github.com/algorand/go-algorand/daemon/algod/api/server/lib/middlewares/logger.go:52 +0xde
github.com/labstack/echo/v4.(*Echo).ServeHTTP.func1(0x7ff6c6d3ae38, 0xc00ab8c820, 0x1, 0x0)
github.com/labstack/echo/v4@v4.1.17/echo.go:627 +0x113
github.com/labstack/echo/v4/middleware.RemoveTrailingSlashWithConfig.func1.1(0x7ff6c6d3ae38, 0xc00ab8c820, 0x1, 0x1)
github.com/labstack/echo/v4@v4.1.17/middleware/slash.go:118 +0x18e
github.com/labstack/echo/v4.(*Echo).ServeHTTP(0xc0000023c0, 0x7ff6c6d1c150, 0xc013c9aa80, 0xc00e6e1000)
github.com/labstack/echo/v4@v4.1.17/echo.go:633 +0x2bc
net/http.serverHandler.ServeHTTP(0x7ff6c733a760, 0x7ff6c6d1c150, 0xc013c9aa80, 0xc00e6e1000)
net/http/server.go:2887 +0xaa
net/http.(*conn).serve(0xc0085a0280, 0x7ff6c6d1ffc8, 0xc003f0f3c0)
net/http/server.go:1952 +0x8cd
created by net/http.(*Server).Serve
net/http/server.go:3013 +0x3b8