core-contracts icon indicating copy to clipboard operation
core-contracts copied to clipboard

Optimize state clearing contract

Open austinabell opened this issue 3 years ago • 0 comments

Based on some comments made here: https://github.com/near/core-contracts/pull/171#pullrequestreview-767219536

There are a few things that can be done to make this smaller (without changing the interface at all):

  1. Update to 4.0 pre-release of SDK to avoid having to go through blockchain_interface for syscalls
  2. Replace serde/serde-json with something like https://github.com/dtolnay/miniserde. This will make the contract to deploy much smaller, but deserializing might use slightly more compute/gas. This change is likely worth it in the vast majority of cases.
  3. Make it no_std
  4. Replace unwraps with manually handled errors through syscalls to avoid putting file-specific data into wasm binary

austinabell avatar Feb 09 '22 22:02 austinabell