v2.6.1
Mandatory Upgrade
This is a mandatory update for the upcoming Fort Canning Hill chain upgrade. It contains a key fixes that upgrades the protocol.
Fort Canning Hill upgrade is set for block 1604999 (approx. ETA Feb 7, 2022 UTC) on mainnet.
Update of mainnet node to v2.6.1
before the chain upgrade block is REQUIRED.
Upgrade Notes
- For nodes that are running
<= v2.5.0
, this is a drop in upgrade. No reindex or fresh sync needed. - For nodes that are being restored from recent snapshot, as with all updates before:
-rescan
for the wallet txs and additionally-spv_resync
for users who hold BTC. If either isn't used, they may not be shown in the wallet until rescanned/resynced. - For nodes that had already upgraded to the
2.6.0
prior to2.6.1
release, one of the following is required: a fresh sync, the most recent backup from 2.5.0, latest snapshot.
What’s Changed
v2.6.1
- The prior 2.6.0 release was retracted due to a mismatch in calculation between 2.5.0 and 2.6.0 that in rare conditions, caused the new nodes to reject valid blocks on 2.5.0 mainnet before the Fort Canning Hill Network upgrade. This is fixed in 2.6.1 and is the required node for Fort Canning Hill upgrade. The mismatch was due to a hidden bug in how 2.5.0 calculates
interestPerBlock
.2.6.1
nodes now addresses this condition recreating the calculation exactly as 2.5.0 pre-upgrade.
v2.6.0
Key Focus
- Loans - Existing Payback
- Issues with partial payback of loans from the previous versions are now fixed, and should work as expected after the upgrade block.
- For extremely small loans, before FCH, the min interest per. block is 1 fi per. block (min. unit) and is calculated every block. After FCH, these smaller loans will accumulate the last 1 fi over multiple blocks until payback or fully matures.
interestPerBlock
will continue to be at 1 fi precision, as that's still the min. unit. However, this will be the interest as per the block in which positions are closed.- New
realizedInterestPerBlock
will show higher precision interest rate that's used to accrue interest rate internally. Note the minimum unit of transactions on the blockchain still continues to be 1 fi precision. It only affects accumulation, so users aren't charged 1 fi every block.
- Loans - Payback Capability with DFI
- After FCH upgrade block, payback of loans with DFI instead of the dTokens at a set additional oracle fee, can be enabled. Currently, due to protocol serialisation requiring breaking changes, its capability is limited only to DUSD dToken. The internal capability is expected to be made generic and be expanded to all dTokens in the next planned upgrade. Note: however, this is just the capability. The activation and deactivation is designed to be toggled through on-chain gov.
- When DFI payback is used, the whole amount is burned (loan token value + loan interest value + % fees).
- New
getburninfo
API categories:dfipaybackfee
anddfipaybacktokens
- Loans - Withdrawal
- From FCH, 50% DFI requirement in vault is now relaxed to 50% of the vault's active min. loan. ratio as DFI. Rest can be withdrawn freely - withdrawing other collateral tokens before DFI to maintain 50% DFI is no longer required.
- Bi-directional DEX fees
- DEX now has the ability to charge a % fee on both the maker and taker, if enabled.
- This is designed to be activated, disabled and changed on the fly per pool pair through on-chain governance.
- New
getburninfo
API categories:dexfeetokens
- Built-in Supplementary Contracts
- A new built-in system for all supplementary smart contracts (eg. DFIP related smart contracts) with the following new RPCs:
listsmartcontracts
executesmartcontract
- dBTC-DFI swap (DFIP2201) is implemented via. this layer.
- These contracts are designed to be activated or disabled through on-chain governance.
- dBTC Swap:
executesmartcontract dbtcdfiswap 1@BTC
to swap dBTC to DFI if the contract is activated.
- A new built-in system for all supplementary smart contracts (eg. DFIP related smart contracts) with the following new RPCs:
RPC Changes
- Existing:
getburninfo
adds the following additional fields:dexfeetokens
dfipaybackfee
dfipaybacktokens
getinterest
adds the following field after FCH block:realizedInterestPerBlock
- New:
listsmartcontracts
executesmartcontracts
🚀 Features
- Accounting tokens / penalty payed via DFI @bvbfan (#1060)
- Payback of DUSD loan with DFI @Mixa84 (#1024)
- High precision interest calculation @Mixa84 (#991)
- Smart contract exchange of BTC for DFI @Bushstar (#1045)
- Add getversioninfo @mambisi (#941)
- Bi-directional DEX fee burn capability @bvbfan (#1031)
- Add option regtest to simulate mainnet target time span and spacing @bvbfan (#1037)
- Add custom path option to testpoolswap RPC @Jouzo (#1021)
- Test liquidity rewards when poolpair status is false @Jouzo (#1027)
🐛 Bug Fixes
- Fix node message in functional tests @bvbfan (91d4602)
- Fix gov attributes set @bvbfan (07e8f08)
- Fix interest per block float calculation @bvbfan (ed5daaa)
- Higher precision interest per block info @prasannavl (#1082)
- Format DFI payback fee @Bushstar (#1081)
- Make burninfo API more discoverable @prasannavl (#1077)
- Add pre and post fork loan checks @hidiego (#1075)
- Fix format of immature interest @Mixa84 (#1076)
- Reduce FCH migration to a single block @prasannavl (#1073)
- Allow internal zero swaps @prasannavl (#1071)
- Fix pool swap zero amount result @bvbfan (#1067)
- Resolve mempool segfault @Bushstar (#1061)
- Use head commit instead of base branch merge for PR tests @hidiego (#1051)
- Don't count minted coins in block stats @bvbfan (#1048)
- Collateral increases in value and should be able to be withdrawn @Jouzo (#988)
- Fix mempool reorg issue @bvbfan (#1034)
- Fix llvm CI error @Bushstar (#1041)
- Floor token swap result @bvbfan (#1023)
🧰 Maintenance
- Update test to resolve rare inconsistency @Bushstar (#1065)
- Tests: Replace sync_all with sync_blocks/sync_mempools @Bushstar (#1074)
- Update logs and error message in mn_checks.cpp @Jouzo (#1066)
- Cleanups + indentation @bvbfan (#1063)
- Refactor smart contracts @prasannavl (#1057)
- Show DEx fee percentage in pool pair JSON output @Bushstar (#1058)
- Refactor gov attributes value (#1055) @prasannavl (#1056)
- Rename vars. Update test to avoid errors. @Bushstar (#1050)
- Test whether DUSD can be used as collateral @Jouzo (#1043)
- Better define composite swap behaviour @Bushstar (#956)
- Remove unused vars in mn_checks @Jouzo (#1036)
- Get attrs direct from Gov view @Bushstar (#1033)
- Save attributes in view @Bushstar (#1032)
- Add ATTRIBUTES Gov var @Bushstar (#998)
How to run?
Download and untar the relevant version to your operating system, run bin/defid
or bin/defid.exe
to start a DeFi Blockchain daemon. The client (CLI) can be found at bin/defi-cli
or bin/defi-cli.exe
.
DeFi App (GUI) users
If you are running the desktop DeFi App, you do not have to manually update the underlying node as the app will handle it. Check https://github.com/DeFiCh/app/releases for the latest releases.
Testnet Info
The following are informational updates that apply only for development on testnet:
- Testnet upgrade block for FCH is set to
828900
- Reference blockhash of testnet 827500:
1f8ae3e7881bfaf45414798824eb8c415be512cf29aea4c5316828887400db36
- Note: Same upgrade notes as mainnet apply to testnet. Please reindex / restore as necessary.
Note: Certain test related infrastructure components (like defiscan.live) could take a while to reflect this change, due to the re-indexing constraints on the specific applications.
Testnet rollback tips (if needed):
$ defi-cli -testnet invalidateblock $(defi-cli -testnet getblockhash 827500)
$ defi-cli -testnet clearbanned
$ defi-cli -testnet reconsiderblock 1f8ae3e7881bfaf45414798824eb8c415be512cf29aea4c5316828887400db36