I am happy to announce that we are getting close to starting the process of upgrading the SNIP-20 token contracts on Secret Network.
Over the past several months, @supdoggie and @darwinzero were doing a tremendous amount of work to implement the updated SNIP token standard with crucial improvements in privacy and scalability, as well as to develop migration routines that will allow upgrading the existing contracts. This work is supported through SCRT Labs Grants Program.
Main improvements:
- Improved privacy with Delayed Write Buffers and Bitwise Trie of Bucketed Entries, addressing the “spicy printf” leaks once and for all. See the detailed description of the solution here.
- Improved scalability and UX through Private Notifications - see the description here.
- Blanket Permit feature (one permit allowing querying all tokens) - description here.
What this means for users:
-
Stronger privacy: DWBs and BTBEs protect your privacy by removing patterns that could link senders and recipients. This effectively creates large anonymity sets for each transaction — all with low gas costs and no changes to how you send or receive tokens.
-
Instant updates: If you’re using a compatible wallet or dApp, you’ll get instant notifications when you are the recipient of a SNIP transfer. No need to manually check or query the network — it’s a much smoother user experience!
-
Simpler permissions: With blanket permits, you only need to approve one query permit to access all your current and future SNIP tokens. No need to approve each one individually.
The full PR can be seen here.
Testing prior to the upgrade
As part of the process, supdoggie and darwinzero developed an elaborate testing suite to make sure that both the migration and the new implementation work fine.
To test the migration process, the suite creates several synthetic tokens, distributes them across multiple wallets, performs the migration process, and then validates that all the balances are accurate.
In addition, the testing routine performs hundreds of token transfers, covers all possible SNIP-2x actions, and monitors the state of the delayed write buffer and the bitwise trie of bucketed entries while doing so.
In the past weeks, SCRT Labs team ran extensive testing of the upgrade process to validate that everything works as expected. The testing was performed on three levels:
- Localsecret
- Pulsar-3 testnet
- Secret-4 mainnet (using synthetic tokens)
The source code of the testing suite can be found here.
Upgrade Process
The contract migration will be performed in stages:
- Stage 1: All SNIP-25 contracts tokens with code-id 877 and 6 decimals
- Stage 2: All SNIP-25 contracts with code-id 877 and 8-18 decimals
- Stage 3: All SNIP-24 contracts with code-id 563
- Stage 4: SNIP-20 contract sSCRT
In each batch, we will start with upgrading less popular tokens (by number of unique wallets accessing them).
The list of all tokens that will be upgraded, and the planned order of upgrade is available here.
Most of the tokens to be upgraded are administered by SCRT Labs, with the exception of two: SILK and SHD that are administered by Shade. We will work closely with the Shade team to help perform the upgrade.
Next Steps
After an initial discussion on the forum, we will post an on-chain signaling proposal to get the network’s formal approval for the upgrade.
