Closed BurnWW closed 1 year ago
in polkadart-0.2.1/lib/substrate/era.dart encodeMortal
encodeMortal(int current, int period) { final calPeriod = pow(2, (log(period) / log(2)).ceil()); final phase = current % min(max(calPeriod, 4), 1 << 16); final quantizeFactor = max(1, period >> 12); final quantizedPhase = phase / quantizeFactor * quantizeFactor; return encode(quantizedPhase.toInt(), period); }
if period is 0, get error
Unhandled exception: Unsupported operation: Infinity or NaN toInt #0 double.toInt (dart:core-patch/double.dart) #1 double.ceil (dart:core-patch/double.dart:201:32) #2 Era.encodeMortal (package:polkadart/substrate/era.dart:79:53) #3 SigningPayload.toEncodedMap (package:polkadart/extrinsic/signing_payload.dart:42:24) #4 SigningPayload.encode.<anonymous closure> (package:polkadart/extrinsic/signing_payload.dart:63:26) #5 List.forEach (dart:core-patch/growable_array.dart:416:8) #6 SigningPayload.encode (package:polkadart/extrinsic/signing_payload.dart:59:40) #7 main (file:///home/wetee/Work/asyou.me/dtim/hacks/init_dao.dart:63:33)
Hello @BurnWW, thank you for your report. We have released a new version with a fix for that polkadart 0.2.2
in polkadart-0.2.1/lib/substrate/era.dart encodeMortal
if period is 0, get error