hychen / submoloch

The Polkadot version of MolochDAO
Apache License 2.0
0 stars 0 forks source link

Reduce the contract size : split submoloch contract to smaller contracts. #40

Open hychen opened 3 years ago

hychen commented 3 years ago

The size of submoloch is exceeded the limitation.

Possible Solutions

1 split submoloch to three small contracts,

  1. guild :: to manage memberships;
  2. grant :: to process proposals.
  3. pool :: to transfer the funds

    2 shrinking wasm size

  4. Experiment wasm-opt optimization options suggested in (https://github.com/paritytech/cargo-contract/issues/110)
  5. Experiment methodologies suggested in https://github.com/johnthagen/min-sized-rust

    3 Remove erc20 contract from submoloch build dependency. Use erc20-trait instead.

    4 Convert error strings to custom Error types.

    Leave client side decide which error strings should be printed.

    5. Use types that take smaller spaces. (e.x.: u128 -> u8)

hychen commented 3 years ago

Working on https://github.com/hychen/submoloch/tree/split_contract

hychen commented 3 years ago

option 3 and does not help. gonna hack cargo-contract to add some useful options for reducing wasm-size.

hychen commented 3 years ago

HashMap is way more expensive than I thought.