Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: add one-sided coinbase payments #5967

Conversation

hansieodendaal
Copy link
Contributor

@hansieodendaal hansieodendaal commented Nov 18, 2023

Description

Added normal one-sided and stealth one-sided coinbase transactions. Changes are:

  • Coinbases can now only be paid to a nominated wallet address directly.
  • The minotari miner and merge mining proxy will only start if a valid minotari wallet address has been supplied for the particular network.
  • The miner and merge mining proxy does not depend on the wallet anymore to construct the coinbase; it is done directly.
  • Corresponding gRPC method (rpc GetCoinbase (GetCoinbaseRequest) returns (GetCoinbaseResponse)) has been removed from the wallet.
  • A memory-based transactions key manager has been created for use by the miner and merge mining proxy as they do not need persistent storage of keys. This also ensures that new entropy for the generation of keys is created each time the miner or merge mining proxy is started effectively negating any collisions of private keys.
  • All unused code in the output manager and transaction manager have been removed.

Motivation and Context

See #5930

How Has This Been Tested?

Unit tests
Cucumber tests
System-level tests - Completed

What process can a PR reviewer use to test or verify this change?

  • Code walk-through
  • Run cucumber Scenario: Get Transaction Info and review the log files for WALLET_A where the stealth one-sided coinbases will be imported and where payment is made to WALLET_B.

Breaking Changes

  • None
  • Requires data directory on base node to be deleted
  • Requires hard fork
  • Other - Please specify
  • Coinbases can now only be paid to a nominated wallet address directly.
  • Existing wallets need to be recovered into new wallets.

@ghpbot-tari-project ghpbot-tari-project added the CR-too_long Changes Requested - Your PR is too long label Nov 18, 2023
@hansieodendaal hansieodendaal force-pushed the ho_one_sided_coinbase_approach_2 branch 2 times, most recently from 2bc4e36 to ee5729d Compare November 20, 2023 06:14
Copy link

github-actions bot commented Nov 20, 2023

Test Results (CI)

1 249 tests   1 249 ✔️  12m 46s ⏱️
     39 suites         0 💤
       1 files           0

Results for commit 2136543.

♻️ This comment has been updated with latest results.

@ghpbot-tari-project ghpbot-tari-project added P-acks_required Process - Requires more ACKs or utACKs P-reviews_required Process - Requires a review from a lead maintainer to be merged labels Nov 20, 2023
Copy link

github-actions bot commented Nov 20, 2023

Test Results (Integration tests)

31 tests  +31   31 ✔️ +31   15m 1s ⏱️ + 15m 1s
11 suites +11     0 💤 ±  0 
  2 files   +  2     0 ±  0 

Results for commit 2136543. ± Comparison against base commit 64e375b.

♻️ This comment has been updated with latest results.

Added one-sided and stealth coinbase transactions. Coinbases can now only be paid to a
nominated wallet address directly.
@hansieodendaal hansieodendaal changed the title [wip] feat: add one-sided coinbase payments feat: add one-sided coinbase payments Nov 21, 2023
@stringhandler stringhandler changed the title feat: add one-sided coinbase payments feat!: add one-sided coinbase payments Nov 21, 2023
@stringhandler
Copy link
Collaborator

Added exclamation for breaking change

Copy link
Contributor Author

@hansieodendaal hansieodendaal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

System-level testing: Merge mining proxy should panic if the wallet payment address is not set; currently it is logging an error.

Copy link
Contributor Author

@hansieodendaal hansieodendaal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need more detail about imported coinbase transactions on the console wallet's transactions pane

Copy link
Contributor Author

@hansieodendaal hansieodendaal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many of the imported coinbase transactions in the nominated wallet have the incorrect status. We expect FauxUnconfirmed -> FauxConfrimed, but they end up as FauxUnconfirmed -> Completed. The Completed transactions are then broadcast to the mempool, which is just a further symptom to the actual problem.
image
image

Copy link
Collaborator

@SWvheerden SWvheerden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good, a few comments

applications/minotari_console_wallet/README.md Outdated Show resolved Hide resolved
// The coinbase are technically Inbound.
// To determine whether a transaction is coinbase
// we will check whether the message contains `Coinbase`.
is_coinbase: inbound.message.to_lowercase().contains("coinbase"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not have coinbase transactions anymore; we just import one-sided coinbase UTXOs and make faux transactions

applications/minotari_console_wallet/src/init/mod.rs Outdated Show resolved Hide resolved
base_layer/core/src/transactions/coinbase_builder.rs Outdated Show resolved Hide resolved
applications/minotari_miner/src/run_miner.rs Outdated Show resolved Hide resolved
@@ -0,0 +1,69 @@
-- Any old 'outputs' will not be valid due to the removal of 'coinbase_block_height',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove this? we can still add this in?

Copy link
Contributor Author

@hansieodendaal hansieodendaal Nov 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The coinbase_block_height column was only used to manage coinbase transactions in the transaction service; this is not used anymore due to the removal of conbase transactions.

);

-- Any old 'completed_transactions' will not be valid due to the removal of 'coinbase_block_height',
-- so we drop and recreate the table.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

@ghpbot-tari-project ghpbot-tari-project removed the P-reviews_required Process - Requires a review from a lead maintainer to be merged label Nov 23, 2023
@SWvheerden SWvheerden merged commit 89b19f6 into tari-project:development Nov 23, 2023
14 checks passed
@hansieodendaal hansieodendaal deleted the ho_one_sided_coinbase_approach_2 branch November 23, 2023 08:20
sdbondi pushed a commit to sdbondi/tari that referenced this pull request Nov 27, 2023
Description
---
Added normal one-sided and stealth one-sided coinbase transactions.
Changes are:
- Coinbases can now only be paid to a nominated wallet address directly.
- The minotari miner and merge mining proxy will only start if a valid
minotari wallet address has been supplied for the particular network.
- The miner and merge mining proxy does not depend on the wallet anymore
to construct the coinbase; it is done directly.
- Corresponding gRPC method (`rpc GetCoinbase (GetCoinbaseRequest)
returns (GetCoinbaseResponse)`) has been removed from the wallet.
- A memory-based transactions key manager has been created for use by
the miner and merge mining proxy as they do not need persistent storage
of keys. This also ensures that new entropy for the generation of keys
is created each time the miner or merge mining proxy is started
effectively negating any collisions of private keys.
- All unused code in the output manager and transaction manager have
been removed.

Motivation and Context
---
See tari-project#5930

How Has This Been Tested?
---
Unit tests
Cucumber tests
System-level tests - _Completed_

What process can a PR reviewer use to test or verify this change?
---
- Code walk-through
- Run cucumber `Scenario: Get Transaction Info` and review the log files
for `WALLET_A` where the stealth one-sided coinbases will be imported
and where payment is made to `WALLET_B`.


<!-- Checklist -->
<!-- 1. Is the title of your PR in the form that would make nice release
notes? The title, excluding the conventional commit
tag, will be included exactly as is in the CHANGELOG, so please think
about it carefully. -->


Breaking Changes
---

- [ ] None
- [ ] Requires data directory on base node to be deleted
- [ ] Requires hard fork
- [x] Other - Please specify

<!-- Does this include a breaking change? If so, include this line as a
footer -->
- Coinbases can now only be paid to a nominated wallet address directly.
- Existing wallets need to be recovered into new wallets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CR-too_long Changes Requested - Your PR is too long P-acks_required Process - Requires more ACKs or utACKs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants