Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimise GUI asset files #875

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Optimise GUI asset files #875

wants to merge 2 commits into from

Conversation

smk762
Copy link
Collaborator

@smk762 smk762 commented Nov 28, 2023

Closes: #872
Initial implementation to review for feasibility of solution.

Reduction methods:

  • Removed items from coins_config which are already present in coins file (deduplication)
  • Move repeated items in coins_config (swap_contract, fallback swap_contract, parent_coin) into coin_type_map.json. These values are accessible via the type value in coins_config.
  • Remove tickers from coins file which are not present in coins_config file (e.g. where rejected due to failing electrums or lack of data etc)
  • Minify json output (no indentation)

Earlier, the script was modified to output TCP / SSL / WSS only variants of coins_config. These should be used where appropriate to further filter out data not relevant to usage. See #821 for more info.

The above reductions are applied to each variant after they have been re-calculated. Originals have been retained in case of external / legacy usage to avoid breaking backwards compatibility.

@CharlVS please advise if the newer reduced output is usable in flutter apps. There should be minimal changes to code required beyond updating filenames and sourcing some info from either coin_type_map.json or coins_*_minified instead of coins_config_*.json

@shamardy are there any data keys within the coins file which can be safely removed (or moved to a supplemental file) without upsetting mm2?

@shamardy
Copy link

shamardy commented Dec 1, 2023

@shamardy are there any data keys within the coins file which can be safely removed (or moved to a supplemental file) without upsetting mm2?

1 - links similar to the below is not used in mm2

coins/coins

Lines 209 to 212 in d6b78c6

"links": {
"github": "https://github.com/aave",
"homepage": "https://aave.com/ "
}

2 - fname is not used too

coins/coins

Line 193 in d6b78c6

"fname": "AAVE",

3 - Any UTXO coin with decimals = 8 like the below the decimals field can be removed since it's set as 8 by default in mm2. This is for coins with "protocol": {"type": "UTXO"} only, so be carefull with this.

coins/coins

Lines 7065 to 7084 in d6b78c6

{
"coin": "LNC",
"name": "lightningcash",
"fname": "LightningCash",
"rpcport": 9110,
"pubtype": 28,
"p2shtype": 50,
"wiftype": 176,
"decimals": 8,
"signature_version": "base",
"txfee": 10000,
"segwit": true,
"bech32_hrp": "lnc",
"mm2": 1,
"required_confirmations": 6,
"avg_blocktime": 5,
"protocol": {
"type": "UTXO"
}
},

4 - Signature version defaults to base when there is no fork_id in config similar to the below, so it can be removed in similar cases, also be careful with this.

coins/coins

Lines 14380 to 14405 in d6b78c6

{
"coin": "CRNC",
"name": "crioniccoin",
"fname": "CrionicCoin",
"sign_message_prefix": "Crioniccoin Signed Message:\n",
"rpcport": 4466,
"pubtype": 28,
"p2shtype": 45,
"wiftype": 176,
"decimals": 8,
"signature_version": "base",
"txfee": 10000,
"segwit": true,
"bech32_hrp": "crnc",
"mm2": 1,
"required_confirmations": 3,
"avg_blocktime": 20,
"protocol": {
"type": "UTXO"
},
"derivation_path": "m/44'/192'",
"links": {
"github": "https://github.com/diabaths/Crionic-Coin",
"homepage": "https://coin.crionic.org"
}
},

5 - Any utxo coin with txfee: 1000 since this is the default value when txfee is missing

coins/coins

Line 3402 in d6b78c6

"txfee": 1000,

6 - Any utxo coin that has "segwit": false since this is the default

coins/coins

Line 10391 in d6b78c6

"segwit": false,

7 - Any "requires_notarization": false

8 - Any utxo with "required_confirmations": 1, since this is the default

I couldn't go through the whole coins file of course but the above is a list of what I found :)

@smk762 smk762 added the on hold label Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Optimise filesize of assets used in guis
2 participants