You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(payment): prevent Int64 overflow panic in settle-timestamp arithmetic
UpdateStreamRecord and TryResumeStreamRecord computed settle timestamps by
calling Int.Int64() on an unbounded sdkmath.Int. When a stream account's
pay-duration exceeded MaxInt64 seconds (~2.9e11 years) the call panicked with
"Int64() out of bound". Because both functions run inside the storage
EndBlocker with no recover(), the panic was deterministic across every
validator and halted the chain.
Fix: perform the full settle-timestamp expression in sdkmath.Int, then handle
an out-of-range result by intent rather than by call site:
- A user-initiated deposit (positive static-balance change, no rate change)
that would overflow is rejected with ErrSettleTimestampOverflow — the
depositor is over-funding past what we can represent and can deposit less.
- Every other path saturates the settle timestamp to math.MaxInt64: forced
EndBlocker updates (where an error would re-trigger the same halt via
abci.go "should not happen"), rate decreases from object deletion or
discontinue, and lazy re-pricing when the SP price falls. The settle
timestamp is only a scheduling hint for the auto-settle queue and is
recomputed on the next balance change or bucket touch, so capping it is
loss-free and never blocks a legitimate object deletion.
Closes MOCA-385
- (app/upgrades) [#289](https://github.com/mocachain/moca/pull/289) Pin v2 feemarket `min_gas_price` to 20 gwei (moca's intended floor) so upgraded chains match genesis.
67
67
- (evm) [#290](https://github.com/mocachain/moca/pull/290) Restore `CallEVM` error-context wrap (method + contract in error message), fix copy-pasted "evil token" comment in `erc721NonTransferable.go`, update stale geth v1.15→v1.16 comments, remove unreachable `AddBalance` blocks in distribution precompile, fix grammar in precompile Run() default cases, and drop dead test-helper expressions.
68
68
- (evm) [#291](https://github.com/mocachain/moca/pull/291) Reject native value sent to precompiles to prevent a balance-reconciliation mint.
69
+
- (x/payment) [MOCA-385] Prevent Int64 overflow panic in `UpdateStreamRecord` and `TryResumeStreamRecord`: settle-timestamp arithmetic is now performed in arbitrary-precision `sdkmath.Int` instead of native `int64`. Only a user-initiated deposit that would push the pay duration past `MaxInt64` is rejected (`ErrSettleTimestampOverflow`) — the depositor can simply deposit less. Every other path (rate decreases from object deletion/discontinue, lazy re-pricing when the SP price falls, and all forced EndBlocker updates) saturates the settle timestamp to `MaxInt64` instead, since it is only a scheduling hint that is recomputed on the next balance change or bucket touch. This keeps a legitimate object deletion from ever being rejected and prevents the EndBlocker from panicking (which would halt the chain).
69
70
- (x/challenge) [#286](https://github.com/mocachain/moca/pull/286) Retire a challenge from the active set once it is attested, making attestation idempotent so duplicate submissions (e.g. redundant relayers or resubmissions by the in-turn submitter) are rejected instead of re-running heartbeat rewards and re-emitting attestation events.
70
71
- (ci) [#65](https://github.com/mocachain/moca/pull/65) Resolve goreleaser CI failures for arm64 docker builds
ErrSettleTimestampOverflow=errorsmod.Register(ModuleName, 1214, "settle timestamp overflow: deposit would fund the account beyond the representable future")
0 commit comments