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 multisig script that returns aggregate of signed public keys #4742

Conversation

hansieodendaal
Copy link
Contributor

@hansieodendaal hansieodendaal commented Sep 27, 2022

Description

Added an m-of-n multisig TariScript that returns the aggregate public key of the signatories if successful and fails otherwise.

This is useful if the aggregate public key of the signatories is also the script public key, where signatories would work together to create an aggregate script signature using their individual script private keys.

Motivation and Context

To enhance the practicality of the m-of-n multisig TariScript.

How Has This Been Tested?

Unit tests

Co-Authored-By: SW van Heerden swvheerden@gmail.com

@stringhandler stringhandler added the P-controversial Process - This PR or Issue is controversial and/or requires more attention that simpler issues label Sep 27, 2022
@stringhandler
Copy link
Collaborator

Needs a link to an RFC

@stringhandler stringhandler added the P-needs_rfc Process - Please provide link to RFC related to this change label Sep 27, 2022
@hansieodendaal
Copy link
Contributor Author

Please see tari-project/rfcs#14 where the op codes have been added.

@jorgeantonio21
Copy link
Contributor

LGTM !

Copy link
Member

@sdbondi sdbondi left a comment

Choose a reason for hiding this comment

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

Makes sense. One very minor improvement.

An alternative is make CHECK_MULTISIG_VERIFY push an aggregate public key (breaking change, but does not matter at this stage) and the user/script author could discard this using drop if needed but IDK this may be better and the difference between CHECK_MULTISIG_VERIFY and this opcode should be pretty straightforward to document/understand.

infrastructure/tari_script/src/op_codes.rs Outdated Show resolved Hide resolved
stringhandler pushed a commit that referenced this pull request Oct 3, 2022
Description
---
- Adds ToRistrettoPoint opcodes
- Added scalar stack item

Motivation and Context
---
As per RFC-202
Ref tari-project/rfcs#15
Ref #4742

How Has This Been Tested?
---
Additional unit tests + tests updated
Added an m-of-n multisig TariScript that returns the aggregate public key of
the signatories if successful and fails otherwise.
@hansieodendaal hansieodendaal force-pushed the ho_CheckMultiSigVerifyAggregatePubKey branch from 061f5e2 to e512299 Compare October 3, 2022 11:59
@hansieodendaal
Copy link
Contributor Author

An alternative is make CHECK_MULTISIG_VERIFY push an aggregate public key (breaking change, but does not matter at this stage) and the user/script author could discard this using drop if needed but IDK this may be better and the difference between CHECK_MULTISIG_VERIFY and this opcode should be pretty straightforward to document/understand.

@CjS77 and @stringhandler your opinions? Do we add this additional op-code or condense CheckMultiSigVerifyAggregatePubKey into CheckMultiSigVerify?

stringhandler pushed a commit that referenced this pull request Oct 10, 2022
…key (#4759)

Description
---
The goal of the current PR is to add a cli command such that a wallet can create a utxo with a spend `CheckMultiSigVerifyAggregatePubKey` script that requires the a m-of-n list of keys to spend.
It should be merged after #4742 and #4751.

Motivation and Context
---
It addresses `Step 2` in the following [MvP](https://demo.hedgedoc.org/rgLUGP_YRiGKjKkgehiG4w#Step-2).

How Has This Been Tested?
---
Unit tests
@CjS77 CjS77 added the P-acks_required Process - Requires more ACKs or utACKs label Oct 19, 2022
@stringhandler stringhandler merged commit c004e30 into tari-project:development Oct 19, 2022
sdbondi added a commit to sdbondi/tari that referenced this pull request Oct 19, 2022
* development:
  fix(core): dont request full non-tip block if block is empty (tari-project#4802)
  feat(comms): adds periodic socket-level liveness checks (tari-project#4819)
  feat: add multisig script that returns aggregate of signed public keys (tari-project#4742)
  fix(core): increase sync timeouts (tari-project#4800)
  fix(comms/rpc): measures client-side latency to first message received (tari-project#4817)
  fix(core): periodically commit large transaction in prune_to_height (tari-project#4805)
  feat: add deepsource config
  v0.38.7
  test: remove cucumber tests, simplify others (tari-project#4794)
  fix(miner): clippy error (tari-project#4793)
  fix(core): only resize db if migration is required (tari-project#4792)
  v0.38.6
  fix(dht): remove some invalid saf failure cases (tari-project#4787)
  feat: move nonce to first in sha hash (tari-project#4778)
  feat: optimize transaction service queries (tari-project#4775)
  fix(tari-script): use tari script encoding for execution stack serde de/serialization (tari-project#4791)
  fix(p2p/liveness): remove fallible unwrap (tari-project#4784)
  fix: fix config.toml bug (tari-project#4780)
  fix: batch rewind operations (tari-project#4752)
CjS77 added a commit that referenced this pull request Oct 19, 2022
* fix: batch rewind operations (#4752)

Description
---
Split rewind DbTx into smaller pieces.

How Has This Been Tested?
---
I did rewind on 20000+ (empty) blocks.

* fix: fix config.toml bug (#4780)

Description
---
The base node errored when reading the `block_sync_trigger = 5` setting
```
ExitError { exit_code: ConfigError, details: Some("Invalid value for `base_node`: unknown field `block_sync_trigger`, expected one of `override_from`, `unconfirmed_pool`, `reorg_pool`, `service`") }
```

Motivation and Context
---
Reading default config settings should not cause an error

How Has This Been Tested?
---
System level testing

* fix(p2p/liveness): remove fallible unwrap (#4784)

Description
---
Removed stray unwrap in liveness service

Motivation and Context
---
Caused a base node to panic in stress test conditions.

```
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: DhtOutboundError(RequesterReplyChannelClosed)', base_layer\p2p\src\services\liveness\service.rs:164:71
```

How Has This Been Tested?
---
Tests pass

* fix(tari-script): use tari script encoding for execution stack serde de/serialization (#4791)

Description
---
- Uses tari script encoding (equivalent to consensus encoding) for `ExecutionStack` serde impl
- Rename as_bytes to to_bytes as per rust convention.
- adds migration to fix execution stack encoding in db

Motivation and Context
---
Resolves #4790 

How Has This Been Tested?
---
Added test to alert if breaking changes occur with serde serialization for execution stack.
Manual testing in progress

* feat: optimize transaction service queries (#4775)

Description
---
Transaction service sql db queries must handle  `DieselError(DatabaseError(__Unknown, "database is locked"))`. This PR attempts
  to remove situations where that error may occur under highly busy async cirumstances, specifically:
- Combine find and update/write type queries into one.
- Add sql transactions around complex tasks.

_**Note:** Partial resolution for #4731._

Motivation and Context
---
See above.

How Has This Been Tested?
---
- Passed unit tests.
- Passed cucumber tests.
- ~~**TODO:**~~ System level tests under stress conditions.

* feat: move nonce to first in sha hash (#4778)

Description
---

This moves the nonce to the front of the hashing order when hashing for the sha3 difficulty. 
This is done so that mining cannot cache part most the header and only load the nonce in. This forces the miner to hash the complete header each time the nonce chances. 

Motivation and Context
---

Fixes: #4767 

How Has This Been Tested?
---
Unit tests all pass.

* fix(dht): remove some invalid saf failure cases (#4787)

Description
---
- Ignores nanos for `stored_at` field in StoredMessages
- Uses direct u32 <-> i32 conversion
- Improve error message if attempting to store an expired message
- Discard expired messages immediately
- Debug log when remote client closes the connection in RPC server

Motivation and Context
---
- Nano conversion will fail when >= 2_000_000_000, nanos are not important to preserve so we ignore them (set to zero)
- u32 to/from i32 conversion does not lose any data as both are 32-bit, only used as i32 in the database 
- 'The message was not valid for store and forward' occurs if the message has expired, this PR uses a more descriptive error message for this specific case.
- Expired messages should be discarded immediately
- Early close "errors" on the rpc server simply indicate that the client went away, which is expected and not something that the server controls, and so is logged at debug level 

How Has This Been Tested?
---
Manually,

* v0.38.6

* fix(core): only resize db if migration is required (#4792)

Description
---
Adds conditional to only increase database size if migration is required

Motivation and Context
---
A new database (cucumber, functional tests) has no inputs and so migration is not required.
Ref #4791 

How Has This Been Tested?
---

* fix(miner): clippy error (#4793)

Description
---
Removes unused function in miner

Motivation and Context
---
Clippy

How Has This Been Tested?
---
No clippy error

* test: remove cucumber tests, simplify others (#4794)

Description
---
* remove auto update tests from cucumber
* rename some tests to be prefixed with `test_`
* simplified two cucumber tests by removing steps

Motivation and Context
---
The auto update tests have an external dependency, which makes it hard to test reliably. They were marked as broken, so I rather removed them.
There were two steps in the `list_height` and `list_headers` tests that created base nodes. Upon inspection of the logs, these base nodes never synced to the height of 5 and were  not checked in the test, so were pretty useless and just slowed the test down 

How Has This Been Tested?
---
npm test

* v0.38.7

* feat: add deepsource config

* fix(core): periodically commit large transaction in prune_to_height (#4805)

* fix(comms/rpc): measures client-side latency to first message received (#4817)

* fix(core): increase sync timeouts (#4800)

Co-authored-by: Cayle Sharrock <CjS77@users.noreply.github.com>

* feat: add multisig script that returns aggregate of signed public keys (#4742)

Description
---
Added an `m-of-n` multisig TariScript that returns the aggregate public key of the signatories if successful and fails otherwise. 

This is useful if the aggregate public key of the signatories is also the script public key, where signatories would work together to create an aggregate script signature using their individual script private keys.

Motivation and Context
---
To enhance the practicality of the  `m-of-n` multisig TariScript.

How Has This Been Tested?
---
Unit tests

Co-Authored-By: SW van Heerden swvheerden@gmail.com

* feat(comms): adds periodic socket-level liveness checks (#4819)

Description
---
- adds socket-level liveness checks
- adds configuration to enable liveness checks (currently enabled by default in base node, disabled in wallet)
- update status line to display liveness status

Motivation and Context
---
Allows us to gain visibility on the base latency of the transport without including overhead of the noise socket and yamux

How Has This Been Tested?
---
Manually

* fix(core): dont request full non-tip block if block is empty (#4802)

Description
---
- checks for edge-case which prevents an unnecessary full candidate block request when block is empty.

Motivation and Context
---
A full block request for empty block is not necessary as we already have all the information required to construct the candidate block. This check was missing from the branch where the candidate block is not the next tip block.

How Has This Been Tested?
---

Co-authored-by: Martin Stefcek <35243812+Cifko@users.noreply.github.com>
Co-authored-by: Hansie Odendaal <39146854+hansieodendaal@users.noreply.github.com>
Co-authored-by: SW van Heerden <swvheerden@gmail.com>
Co-authored-by: stringhandler <mikethetike@tari.com>
Co-authored-by: CjS77 <CjS77@users.noreply.github.com>
@hansieodendaal hansieodendaal deleted the ho_CheckMultiSigVerifyAggregatePubKey branch December 13, 2022 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-acks_required Process - Requires more ACKs or utACKs P-controversial Process - This PR or Issue is controversial and/or requires more attention that simpler issues P-needs_rfc Process - Please provide link to RFC related to this change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants