|
| 1 | +# ADR_0011: Revive Project-Based Smart Contracts Platform |
| 2 | + |
| 3 | +## Date |
| 4 | + |
| 5 | +Decision date: 2025-07-16. |
| 6 | +Last status update: 2025-07-17. |
| 7 | + |
| 8 | +## Status |
| 9 | + |
| 10 | +- [ ] Proposed |
| 11 | +- [x] Accepted |
| 12 | +- [ ] Deprecated |
| 13 | +- [ ] Superseded |
| 14 | + |
| 15 | +### Implementation Status |
| 16 | + |
| 17 | +- [ ] Planned |
| 18 | +- [x] In Development |
| 19 | +- [ ] Implemented |
| 20 | +- [ ] Verified |
| 21 | +- [ ] Discontinued |
| 22 | + |
| 23 | +## People |
| 24 | + |
| 25 | +### Author/Decision Owner |
| 26 | + |
| 27 | +Alisher Khassanov, [@khssnv](https://github.com/khssnv). |
| 28 | + |
| 29 | +### Consulted |
| 30 | + |
| 31 | +- Denis Pisarev, [@TriplEight](https://github.com/TriplEight). |
| 32 | +- Memechi Kekamoto, [@MemechiKekamoto](https://github.com/MemechiKekamoto). |
| 33 | + |
| 34 | +### Informed |
| 35 | + |
| 36 | +- [x] Alex Vyatkin, [@actinfer](https://github.com/actinfer). |
| 37 | +- [x] Alexander Lygin, [@alexlygin](https://github.com/AlexLgn). |
| 38 | +- [x] Sviatoslav Alekseev, [@zotho](https://github.com/zotho). |
| 39 | + |
| 40 | +## Decision |
| 41 | + |
| 42 | +We will implement a smart contracts platform based on Parity Tech's Revive project. |
| 43 | + |
| 44 | +## Context |
| 45 | + |
| 46 | +There was an effort to implement an in-house smart contracts platform by integrating PolkaVM into the blockchain and creating a Rust SDK for smart contracts. However, this approach proved too resource-intensive and expensive to develop, and the complexity of building a production-ready smart contracts platform from scratch became apparent as the project progressed. Denis Pisarev initially suggested investigating Parity Tech's Revive project as an alternative approach. The Polkadot SDK provides mature PolkaVM integration and a complete smart contracts platform, making our custom implementation redundant. QF Network requires smart contracts functionality for Mainnet launch, but resource constraints demand focus on QF-specific innovations rather than duplicating generic blockchain infrastructure. |
| 47 | + |
| 48 | +## Options |
| 49 | + |
| 50 | +1. Revive project-based smart contracts platform (SELECTED) |
| 51 | +2. In-house smart contracts platform |
| 52 | +3. Frontier project-based smart contracts platform |
| 53 | + |
| 54 | +### Option 1: Revive Project-Based Smart Contracts Platform (SELECTED) |
| 55 | + |
| 56 | +This option uses the Revive compiler (<https://github.com/paritytech/revive>) and includes PolkaVM integration. It allows extension via custom "precompiles" (built-in smart contracts). |
| 57 | + |
| 58 | +**Selected because:** |
| 59 | + |
| 60 | +- Implements most of the features planned in [Smart contract environment for TestNet #9](https://github.com/QuantumFusion-network/spec/issues/9) and [PolkaVM smart contract platform advanced development #145](https://github.com/QuantumFusion-network/spec/issues/145). |
| 61 | +- Future-proof as part of the Polkadot SDK developed by Parity Tech. |
| 62 | + |
| 63 | +**Selected despite:** |
| 64 | + |
| 65 | +- Lack of a native Rust SDK for smart contracts (which we may implement). |
| 66 | +- Currently produces larger blobs (approx. 80x larger than equivalent EVM bytecode, see <https://github.com/polkadot-evm/frontier/pull/1709/files>). |
| 67 | + |
| 68 | +### Option 2: In-house smart contracts platform |
| 69 | + |
| 70 | +This option consists of an in-house PolkaVM integration (<https://github.com/QuantumFusion-network/qf-solochain/tree/bdba37f/pallets/qf-polkavm>) and a native Rust SDK for smart contracts (<https://github.com/QuantumFusion-network/qf-polkavm-sdk/tree/93a21f4/>) with a set of examples. |
| 71 | + |
| 72 | +**Rejected because:** |
| 73 | + |
| 74 | +- Conditions have changed. Initially, there was no alternative, but now the Polkadot SDK provides PolkaVM integration and a smart contracts platform on top of it. |
| 75 | +- High development cost. |
| 76 | + |
| 77 | +**Rejected despite:** |
| 78 | + |
| 79 | +- Significant progress already made in [Smart contract environment for TestNet #9](https://github.com/QuantumFusion-network/spec/issues/9) and [PolkaVM smart contract platform advanced development #145](https://github.com/QuantumFusion-network/spec/issues/145). |
| 80 | + |
| 81 | +### Option 3: Frontier project-based smart contracts platform |
| 82 | + |
| 83 | +This is a popular choice for EVM compatibility in Polkadot SDK-based blockchains (<https://github.com/polkadot-evm/frontier>). See: |
| 84 | + |
| 85 | +- Astar, <https://github.com/AstarNetwork/Astar/tree/373fb07/Cargo.toml#L188-L225> |
| 86 | +- Moonbeam, <https://github.com/moonbeam-foundation/moonbeam/blob/e1e8923/Cargo.toml#L246-L288> |
| 87 | +- Bittensor, <https://github.com/opentensor/subtensor/blob/9f33e759acd763497135043504dc048dcc599c31/Cargo.toml#L196-L227> |
| 88 | + |
| 89 | +**Rejected because:** |
| 90 | + |
| 91 | +- Less performant than a PolkaVM-based execution environment. |
| 92 | +- Does not enable new use cases that a PolkaVM-based environment does. |
| 93 | +- Less recent than the Revive project. |
| 94 | + |
| 95 | +**Rejected despite:** |
| 96 | + |
| 97 | +- Being mature and well-adopted in the ecosystem. |
| 98 | + |
| 99 | +## References |
| 100 | + |
| 101 | +- Revive project review, <https://coda.io/d/QF-Network_df6rzXCWZj8/Revive-project-review_suwtiLjr>. |
| 102 | + |
| 103 | +## ADR Relationships |
| 104 | + |
| 105 | +### Supersedes |
| 106 | + |
| 107 | +Supersedes the following ADRs related to the in-house smart contracts platform: |
| 108 | + |
| 109 | +- [ADR #0008 Scale Coder Decoder](https://github.com/QuantumFusion-network/spec/blob/ec3f35d/docs/ADR/0008-adr-scale-coder-decoder.md). |
| 110 | + |
| 111 | +- [ADR #0009 Smart Contract Return Value](https://github.com/QuantumFusion-network/spec/blob/ec3f35d/docs/ADR/0009-contract-return-value.md). |
| 112 | + |
| 113 | +- [ADR #0010 Design of Polka VM pallet's execute() extrinsic](https://github.com/QuantumFusion-network/spec/blob/ec3f35d/docs/ADR/0010_qfpolkavm_pallet_execute.md). |
0 commit comments