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

Rebase tari script to 0.8.7 #2833

Merged

Conversation

SWvheerden
Copy link
Collaborator

Description

This PR releases tari_script branch to 0.8.7.
It also fixes tests added and broken between the branch out point and 0.8.7
This also addresses a review comment left in PR #2794

Motivation and Context

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Feature refactor (No new feature or functional changes, but performance or technical debt improvements)
  • New Tests
  • Documentation

Checklist:

  • I'm merging against the development branch.
  • I ran cargo-fmt --all before pushing.
  • I ran cargo test successfully before submitting my PR.
  • I have squashed my commits into a single commit.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

philipr-za and others added 30 commits March 9, 2021 16:39
The text_message_service was an idea in the very early days of the code base and it was put on hold so it was just commented out but the code base has moved on significantly and it was never removed.

This PR axes it finally.
Reverts logic.

Only the submit_block request needs special handling depending for the proxy_submit_to_origin configuration option.

cargo-fmt
Fix solo merged mining example config that was mistakenly using a subaddress instead of normal address for mainnet configuration, ModeroD doesn't currently support requesting block templates using subaddresses. Self-select configuration can remain the same as the pool wallet address is used to request the template, the miner address is purely for the pool to be able to pay out the miner.

Updated docs to reflect the same.

Review comments
This PR contains a write up off the NO_OP TariScript vulnerability spotted by @mikethetike.
This cucumber test verifies that a base node detects if kernel and/or UTXO MMR
sizes are meddeled with when a miner submits a block back to the base node.
Fixes minor bug with `list-headers` that made it impossible to list the genesis block using `list-header [from-tip]`
…bility

Document the NO_OP TariScript vulnerability
… the wallet (tari-project#2740)

The text_message_service was an idea in the very early days of the code base
and it was put on hold so it was just commented out but the code base has moved
on significantly and it was never removed.

This PR axes it finally.
…st_to_monerod

Only the submit_block request needs special handling depending on the proxy_submit_to_origin configuration option.

Additionally also fixes the following issue with trying to parse the body of GET requests, detailed below:
```
2021-03-09 16:19:57.311444000 [tari_mm_proxy::proxy] DEBUG [monerod] request: GET http://18.132.124.81:18081/getheight
2021-03-09 16:19:57.311534000 [tari_mm_proxy::proxy] ERROR Error handling request: JSON error: EOF while parsing a value at line 1 column 0
```
[Documentation] Minor Fixes
Adds `cargo:rerun-if-changed` directives for include proto files
(i.e proto files that are not directly generated, but used as modules
for other protos). `build.rs` will be automatically rerun if these
change without the developer having to somehow force a protobuf rebuild.
…ment branch only

Point Circle CI status badge to development branch only
…r include protos

Adds cargo:rerun-if-changed directives for include proto files
(i.e proto files that are not directly generated, but used as modules
for other protos). build.rs will be automatically rerun if these
change without the developer having to somehow force a protobuf rebuild.
Fixes a bug that returns many headers while header sync is in progress
Fixes minor bug with list-headers that made it impossible to list the genesis block using list-header [from-tip]
… h=0

Fixes an edge case where a node will never bootstrap (and therefore not
accept mined blocks) if header/block sync completes but there are no
blocks (other than genesis) on the network.
…th MMR sizes

Add cucumber test verify meddling with MMR sizes
 the commit.
Removed some unused dependencies from basenode, console wallet and core
Adds a new error case to the output manager service. When selecting
UTXOs and not enough spendable funds are available, check if the pending
incoming balance would cover the shortfall. If so, return the new
`FundsPending` error instead of `NotEnoughFunds`. This way, the caller
can differentiate between the two cases.
This PR adds the functionality to the LibWallet FFI to recovery a wallet from a set of seed words. 

There was an implementation of the recovery process in the Tari Console Wallet and this was moved into LibWallet and generalised to be used for both clients. The process is now started and a stream of events will be used to inform the client of the progress. Furthermore the progress of the process is now persisted in the LibWallet db backend to allow for the resuming of the process from where it left off. The Console wallet was updated to check if a restoration is in progress and to continue it.

- Added the ability to create a TariSeedWordsObject and add words to it. The u8 enum return from `seed_words_push_word(…)` tells the client if the word was valid and when the seed phrase of 24 words is complete.
- Add a call to check if there was an In Progress restoration. The wallet client can ignore this if they want to, the wallet functions as normal but obviously we won’t be sure that all outputs have been recovered or not.
- Add a call to start the recovery process. The client provides a callback whose arguments are what block we have recovered to and the current total chain length. Based on these two values the client will be informed of the status of the asynchronous recovery process.
Expanded cucumber tests.
Fixed bug that was reintroduced which was caught by cucumber tests.

cargo-fmt

update
Adds a new consensus validator to the base node mempool service, which
checks that any transaction submitted to the mempool must be below the
one block maximum weight.
…guration

Added saf message duration to configuration
stringhandler and others added 21 commits March 31, 2021 14:21
…rs if any transaction is not found

get_transaction_info no longer errors if any transaction is not found
…osed on CommsNode

Removes deprecated CommsNode::connection_manager method that exposes
an interface internal to comms. The connectivity interface should be used instead.
…e header-stats command

- `rewind-blockchain [to-height]` rewinds the blockchain to the given
  height
- header-stats write to a csv file (custom filename be specified)
- header-stats can filter out monero and sha3 PoW
- fix header-stats command docs
Changes header sync to continue downloading headers until a higher
accumulated PoW than the current tip is acheived.

Added cucumber tests for sync with large reorg
Prettier was missing some paths, also ran a cargo fmt.
Add check during sync that header is correctly linked to the previous
header.
No longer squashes error details whe n making RPC requests
Adds `rpc_max_simultaneous_sessions` setting to config with a default of
1000.  Setting to `-1` means there is no session limit.
Changes since v0.8.6

Wallet
---
- [tari-project#2825](tari-project#2825) [wallet] correctly log RPC error messages
- [tari-project#2824](tari-project#2824) [wallet] Output error message for ConfigError
- [tari-project#2818](tari-project#2818) [wallet] get_transaction_info no longer errors if any transaction is not found
- [tari-project#2819](tari-project#2819) [wallet] Clear UI before starting UI loop
- [tari-project#2798](tari-project#2798) [wallet] Add MinedUnconfirmed to command mode wait stage
- [tari-project#2793](tari-project#2793) [wallet] Add menu to console wallet
- [tari-project#2765](tari-project#2765) [wallet] Friendly incorrect password message
- [tari-project#2753](tari-project#2753) [wallet] Update base node service to use RPC
- [tari-project#2762](tari-project#2762) [wallet] Implement wallet recovery process in LibWallet FFI
- [tari-project#2761](tari-project#2761) [wallet] Differentiate "funds pending" case in UTXO selection
- [tari-project#2748](tari-project#2748) [wallet] Added saf message duration to configuration

Base Node
---
- [tari-project#2814](tari-project#2814) [base-node] Add previous hash check to sync validator
- [tari-project#2759](tari-project#2759) [base-node] Fix handling of large chain reorgs in header sync
- [tari-project#2813](tari-project#2813) [base-node] Add rewind-blockchain and improve header-stats command
- [tari-project#2795](tari-project#2795) [base-node] Update mempool consensus validator to check weight excluding coinbase
- [tari-project#2738](tari-project#2738) [base-node] Rewind prune mode behind horizon
- [tari-project#2768](tari-project#2768) [base-node] Add transaction consensus validator
- [tari-project#2764](tari-project#2764) [base-node] Remove reorgs from total tx count
- [tari-project#2755](tari-project#2755) [base-node] Node bootstraps after initial sync if all other nodes are h=0
- [tari-project#2751](tari-project#2751) [base-node] Minor fix for list-headers

Mining
---
- [tari-project#2807](tari-project#2807) [merge-mining] Added getLastBlockHeader cucumber test
- [tari-project#2792](tari-project#2792) [mining-node] Added additional command line arguments
- [tari-project#2791](tari-project#2791) [merge-mining] Add stdout information
- [tari-project#2767](tari-project#2767) [mmproxy] Expanded cucumber tests for merged mining proxy
- [tari-project#2743](tari-project#2743) [merge-mining] Fix logic flaw in proxy_request_to_monerod

Other
---
- [tari-project#2826](tari-project#2826) [common] Add rpc_max_simultaneous_sessions setting to config
- [tari-project#2823](tari-project#2823) [chore] Fix import
- [tari-project#2822](tari-project#2822) [chore] Update prettier paths
- [tari-project#2815](tari-project#2815) [comms] Connection manager requester not exposed on CommsNode
- [tari-project#2820](tari-project#2820) [chore] Use prettier for integration tests
- [tari-project#2821](tari-project#2821) [other] Add memory net summary
- [tari-project#2757](tari-project#2757) [ci] Add all-targets to clippy
- [tari-project#2796](tari-project#2796) [docs] Add WalletNotify info to config samples
- [tari-project#2773](tari-project#2773) [tests] Add custom log file paths for wallet and mmproxy
- [tari-project#2763](tari-project#2763) [tests] Update mempool waits to be dynamic
- [tari-project#2769](tari-project#2769) [ci] Increase Cucumber CI to include all tests except "long running"
- [tari-project#2747](tari-project#2747) [docs] Update rfc 201 for coinbase
- [tari-project#276](tari-project#276) [chore] Removed some unused dependencies
- [tari-project#2576](tari-project#2576) [common] Increase flood ban config
- [tari-project#2572](tari-project#2572) [tests] Add cucumber test verify meddling with MMR sizes
- [tari-project#2754](tari-project#2754) [common] Emit rerun-if-changed directives for include protos
- [tari-project#2745](tari-project#2745) [ci] Point Circle CI status badge to development branch only
- [tari-project#2744](tari-project#2744) [docs] Minor Fixes
- [tari-project#2740](tari-project#2740) [chore] Remove the text_message_service from the wallet (tari-project#2740)
- [tari-project#2739](tari-project#2739) [docs] Document the NO_OP TariScript vulnerability
hansieodendaal and others added 3 commits April 12, 2021 09:28
Added tari script transaction data structures as per RFC-0201
<https://rfc.tari.com/RFC-0201_TariScript.html>, used default
tari script values everywhere. Also updated comms wire mode
to keep this network seperate.
TODO:
- Fix all unit tests
- Migrate tari script into all transaction protocols

wip
Implement TariScript base node validation and default scripts in transactions

This PR includes the work of @SWvheerden@hansieodendaal and myself to implement the foundations of TariScript support in the Tari base node and wallets.

The goal of this PR is to add all the data required for TariScripts while building transactions and also to validate the TariScripts by base nodes. 

On the wallet side of things this PR updates the wallet Sql database to store all the elements that the wallet needs to remember to spend an output with a script and updates the Transaction Negotiation Protocols to work with TariScripts. The updates are able to support general TariScripts but in the Wallet the current assumption is that all outputs will have the “Default” Nop script for now.

This PR also adds the fields to the headers required for script validation and the base node validation has been updated to also check the script elements for individual transactions and the accumulated offset for  constructed blocks and the blockchain.

One last feature that is included in this PR as it was easy to add in during the Transaction Protocol refactor is that the Coin Split function in the Wallet now produces outputs that are rewindable and thus can be recovered by a wallet recovery.

fix unit tests

Some code review comments
@SWvheerden SWvheerden force-pushed the sw_tar-Script_validation branch from ff6a4dc to 0f806c6 Compare April 12, 2021 07:29
@hansieodendaal
Copy link
Contributor

Multiple compile errors with cargo clippy --all-targets -- -D warnings
cc.log

@stringhandler stringhandler merged commit 82ee32a into tari-project:tari-script Apr 14, 2021
@hansieodendaal
Copy link
Contributor

hansieodendaal commented Apr 14, 2021

Also multiple compile errors with cargo build --release
cbr.log

@SWvheerden SWvheerden deleted the sw_tar-Script_validation branch April 22, 2021 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants