Skip to content

v1.5.0 - Network fees with gas simulation, manual gas settings, ML-ops grant per chain version with fee allowance, Android release signing

Latest

Choose a tag to compare

@gonkavip gonkavip released this 01 Oct 04:17

Network Fees & Gas (chain v0.2.16 fee groups)

  • Replaced the fixed defaultGasLimit (10^13) / zero-fee AuthInfo with real fees: gas_limit = simulated gas_used × headroom, fee = gas_limit × gas price in ngonka
  • NodeClient.simulateTx() (POST /cosmos/tx/v1beta1/simulate, surfaces the chain error message as SimulationException) and NodeClient.getFeeParams() (GET /productscience/inference/inference/params → fee_params)
  • New lib/core/fee/:
    • fee_groups.dart: maps message type URLs to chain fee groups (epoch / cosmos / governance / ibc / wasm); MsgExec and unknown types stay ungrouped
    • fee_params.dart: parses enabled_fee_groups + per-group min_gas_price; tx price = max over enabled groups of its messages, falling back to the legacy global min_gas_price_ngonka; pre-v0.2.16 params resolve to free
    • gas_settings.dart: FeeEstimate, GasSettings (auto/manual, BigInt fee math), validateGas() with blocking issues (limit 0, price below network minimum, fee above the 100 GNK chain cap) and a warning (limit below estimate)
  • New constants: gasAdjustment 1.5, gasPresets ×1.2/×1.5/×2.0, maxTxFeeNgonka (100 GNK), fallbackGasLimit 200000, feeParamsCacheTtl 5 min
  • TxBuilder:
    • buildAndSign() now takes a message list plus gasLimit / feeAmount; buildAndSignMulti() merged into it
    • AuthInfo Fee writes the ngonka Coin only when > 0 and gas_limit only when > 0
    • New buildForSimulation(): SignerInfo without pubkey, empty signature, no fee
  • New lib/core/transaction/tx_draft.dart: TxDraft (messages + memo + waitConfirm) with factories for send, deposit/withdraw collateral, PoC delegation, ML-ops grant, unjail and vote
  • BroadcastService rewritten around estimate(draft) and broadcast(draft, gas): per-message methods are now thin wrappers; fee params cached for 5 min and invalidated on an "insufficient fee" broadcast result; on-chain confirmation polling driven by TxDraft.waitConfirm (PoC delegation, grant, unjail, vote)
  • gasControllerProvider (autoDispose StateNotifier): async estimate with generation guard against stale results, retry, manual override that survives re-estimation, reset to auto
  • New widgets:
    • FeeRow: fee in GNK / ngonka / ≈USD, gas limit, Auto/Manual pill, loading and error-with-retry states, gas issues and insufficient-balance warning
    • GasSettingsSheet: Auto/Manual segmented control, gas limit with headroom presets, gas price with network-minimum hint, live fee preview and validation
  • FeeRow replaces the static "0 GNK" fee on all confirm screens: send, collateral deposit/withdraw, grant, PoC delegation, unjail and proposal vote (estimated per selected option); confirm buttons stay disabled while estimating, on blocking gas issues or when the balance cannot cover amount + fee
  • "Max" amount on Send and collateral Deposit now sends spendable balance minus the fee (isMax passed through routes, "Maximum minus fee" hint on confirm)
  • localizeError(): insufficient fee, fee above maximum and out-of-gas mapped to localized messages

ML-ops Grant

  • Permission list now depends on the chain version (NodeClient.getChainVersion() via RPC /abci_info): mlOpsPermissionsV0215 for chains before v0.2.16, mlOpsPermissionsV0216 otherwise (adds PoC challenge and MsgDeclarePoCIntent messages, drops removed inference/training messages)
  • Grant validity shortened from 2 years to 1 year (mlOpsGrantValidity)
  • New MsgGrantAllowance (/cosmos.feegrant.v1beta1.MsgGrantAllowance with a BasicAllowance of 10 GNK and the same expiration); added to the grant tx only when NodeClient.hasFeeAllowance() finds no existing allowance for the grantee
  • Timestamp encoding extracted to shared encodeTimestamp()
  • BroadcastService.prepareGrantMlOps() builds the draft; grant_confirm_screen shows the permission count, fee allowance (amount or "already set up") and the fee row

WalletConnect

  • Sign request screen now shows the fee and gas limit decoded from authInfoBytes (new auth_info_decoder.dart), with a warning when the fee exceeds the chain maximum

Build & Platforms

  • Android: release builds signed with the upload key from android/key.properties (signingConfigs.release) instead of the debug key
  • Android toolchain: AGP 8.8.2 → 8.13.0, Kotlin 2.1.0 → 2.2.20, Gradle 8.12 → 8.14.3; Flutter migrator flags in gradle.properties
  • iOS/macOS: Flutter plugins via Swift Package Manager (FlutterGeneratedPluginSwiftPackage), Podfile.lock trimmed accordingly
  • macOS deployment target 10.15 → 12.0 (Podfile + Runner.xcodeproj)
  • pubspec.lock and native plugin registrants (macOS/Windows) refreshed

Tests

  • New test/fee_test.dart: fee group mapping, fee params parsing (pre-v0.2.16, v0.2.16 defaults, max-over-groups, legacy min price), gas settings presets / BigInt fee / validation and the exact 100 GNK boundary, AuthInfo fee decoding, ML-ops permission lists per chain version, fee allowance in the grant draft and MsgGrantAllowance encoding
  • test/tx_test.dart: fee amount and gas limit in AuthInfo, zero fee omits the coin, simulation tx has no pubkey / signature / fee; existing cases moved to the new TxBuilder API

Other Improvements

  • Tapping outside a text field dismisses the keyboard app-wide (MaterialApp.builder)
  • New localization keys across all five locales (EN/RU/ES/PT/ZH-Hans): gas settings, fee issues, fee errors, "Maximum minus fee", grant fee allowance; grant permissions value now takes {count}, expiration "1 year"; commonFeeZero removed; app_localizations*.dart regenerated
  • analysis_options.yaml: platform and build folders excluded from analysis
  • Stray blank lines and leftover comments cleaned up across lib/ and test/
  • README: network fees & gas section, updated grant, WalletConnect, fees and build notes
  • Version bumped to 1.5.0+8