utxo_ledger (reference): no coinbase authorization; mempool admits any input-less MINING_REWARD

Open
#8,767 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 10 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
blockchain, python

Research direction

Read rips/rustchain-core and trace UtxoSet.add_transaction and apply_transaction, then inspect the block-processing path and epoch reward schedule. Check how coinbase transactions enter each path and how their amount is validated. Done means mempool coinbase is rejected, block processing validates the scheduled reward, and the zero-reward share case in main.py is handled.

Written by the indexing model from the issue text.

Description

Found while reviewing #8302. It is a design gap, and it already exists on main.

Where: rips/rustchain-core reference ledger. Both UtxoSet.add_transaction (mempool) and apply_transaction accept an input-less MINING_REWARD of any amount. Nothing checks who may mint coinbase or how much. After #8302 the mempool admits coinbase-shaped transactions on purpose, to mirror apply.

Why it matters: coinbase should come only from the block producer, for the scheduled reward, and never from the mempool. This can't be reached today, because nothing calls the pool. It would become a free-mint path the moment something does.

Suggested direction:

  1. The mempool rejects MINING_REWARD outright.
  2. apply_transaction accepts coinbase only through a block-processing path that checks the amount against the epoch reward schedule.

Related, and low priority: Box(value=0) now raises. main.py _process_block calls Transaction.mining_reward() in an unguarded loop, so a share that rounds down to 0 would abort block processing partway through. Add if miner.reward <= 0: continue.

Dominant language
Python
Stars
850
Forks
589
Avg merge
11d 7h
Merged PRs (30d)
29

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Scottcjn/Rustchain

All issues in Scottcjn/Rustchain

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.