Fee structure overhaul discussion
In response to network load, a proposal to switch to a fee structure based on the number of inputs and outputs was discussed.
Agenda summary 5
Zebra update - concurrency rewrite
Zcash Foundation · Teor
- With the increased network load, this was the first time Zebra had processed this many blocks and transactions, so the team rewrote concurrency from the very top, where blocks enter the pipeline, to the very bottom, where proofs and signatures are verified in parallel.
- Note commitment tree updates are now also processed in parallel, using Rayon, a Rust thread task scheduling library.
- The team found and fixed redundant work in which entire blocks were deserialized from the DB to answer block header and hash requests. It was effectively deserializing 500 blocks just to get their hashes.
- In response to Adi's question, Teor answered that it is being tested with lightwalletd in CI and timing bugs exposed by the load are being fixed. They said not much manual testing with real wallets has been done recently.
Zcashd 5.2.0 release
Electric Coin Company · Str4d, Daira, Deirdre
- 5.2.0 was released the day before. It centers on performance improvements that respond to the network load that has grown since 5.1.0 and increase stability as a lightwalletd backend.
- It caches the validity of Sapling and Orchard proofs and signatures verified through mempool intake or getblocktemplate checks, and removes entries when they are included in a block.
- This is expected to improve steady-state performance and block propagation time and lower the recently elevated miner orphan block rate. It does not help with wallet rescans.
- Wallet scanning got multi-threaded, batch trial decryption for Sapling and Orchard, and witness data that is no longer needed is pruned. Once 100 blocks have passed after a note is spent, its witness can be discarded.
- When Deirdre asked whether permission to verify from a cache should be stated in the spec, Daira answered that the spec does not prescribe when verification happens, so it is a transparent optimization, and they were sympathetic to putting ordinary notes in ZIP 401.
- Str4d noted that zcashd extends Bitcoin's transparent signature cache, and that the implementation that clears the cache on block connection must behave correctly with respect to consensus.
Open discussion - FROST ZIP draft
Zcash Foundation · Conrado, Deirdre
- A draft ZIP specifying FROST threshold signatures for Zcash is ready, and useful feedback was received at last week's ZIP sync. Only cleanup remains and the team looks forward to submitting it.
- Deirdre explained that the ZIP is proceeding without waiting for the security proof of the FROST variant (being written by Chelsea), and the proof is being written in parallel and will be linked when complete. The draft is PR 3 in the Zcash Foundation zips repository.
Open discussion - proposed fee structure change
Daira, Kris, Adi ZCG, Dodger, Str4d
- The current load comes from huge transactions that pay only the base fee regardless of size. Kris proposed charging a fee proportional to the number of inputs and outputs.
- The concrete proposal is 250 zat per input and output with a minimum of 1000 zat, so a 2-in 2-out transaction keeps the current fee. The reason for counting rather than bytes is so shielded transactions are not disadvantaged, since transparent inputs and outputs are small.
- Daira also presented a proposal to reverse the earlier change that lowered the fee from 10,000 zat to 1,000 zat. Kris estimated that combining the two proposals raises the cost of an attack from about $20 to about $200,000.
- Adi supported the direction of charging more but opposed the EIP 1559 approach because fees are hard to predict and it is bad for privacy and dust cleanup. Kris answered that non-discretionary adjustment is also possible.
- As for rollout order, when raising fees wallets go first, and when lowering them nodes go first. Kris said to start not with a consensus rule but with wallet updates, then miner selection defaults, then relay fees.
- Daira found a March 2017 fee ideas document and a May 2019 DoS mitigation document, and said part of them is ZIP 401, implemented in zcashd and Zebra.
Open discussion - rollout and UX impact of the fee change
Electric Coin Company · Pacu, Nate Wilcox, Daira, Adi ZCG
- Pacu pointed out that mobile non-custodial wallet users are not forced to update, so there is a risk that old versions try to send with low fees.
- Nate proposed a general versioning scheme in which wallets read a protocol or behavior version signal from the chain and notify users on old versions. An opinion was also raised to make fees a parameter that is easy to change in the SDK.
- Nate said the fixed fee of shielded transactions is a UX advantage but is hard to maintain when blocks are full. They worried that shielded wallets that cannot adjust fees would have the problem of transfers not confirming when the mempool grows.
- As a short-term mitigation, Daira recommended miners lower the zcashd option blockmaxsize and reduce blockprioritysize proportionally. For the long term, they mentioned recursive proofs or proof aggregation.
- Daira also mentioned the possibility of reducing the maximum transaction size (100 kB before Sapling, 2 MB after), but said caution is needed since it limits uses.
- Dodger said lightwalletd should tell wallets the recommended fee. Daira said that if the calculation changes, only lightwalletd or zcashd needs to be changed, and suggested a developer meeting.
This summary is based on the original meeting notes; check them for exact details.