From b98b1f8c08ae924bb337431ac93c0511570a751b Mon Sep 17 00:00:00 2001 From: Stan Bondi Date: Thu, 27 Jun 2024 12:49:01 +0400 Subject: [PATCH] feat(transaction)!: allow multiple signers (#1053) Description --- Allow multiple signers for a transaction Motivation and Context --- This enables many use cases including paying for another user's fees (gasless) and invoking two or more components owned by different public keys in the same transaction. It is possible for a party to remove all signatures but one and still have a valid transaction. In future, we'll add a final signature that includes all signatures in the preimage. How Has This Been Tested? --- Manually. TODO: Multiple signer integration test What process can a PR reviewer use to test or verify this change? --- Submit transactions requiring badges from multiple public keys Breaking Changes --- - [ ] None - [x] Requires data directory to be deleted - [ ] Other - Please specify BREAKING CHANGE: wallet database changed, transaction struct changed --- .../src/transaction_executor.rs | 19 +- .../routes/Transactions/FeeInstructions.tsx | 105 ++-- .../Transactions/TransactionDetails.tsx | 585 +++++++++--------- .../src/utils/json_rpc.tsx | 228 +++---- .../src/p2p/services/mempool/error.rs | 2 + .../mempool/validators/before/signature.rs | 9 +- .../src/substate_resolver.rs | 27 +- .../src/transaction_processor.rs | 110 ---- bindings/src/types/Transaction.ts | 4 +- bindings/src/types/UnsignedTransaction.ts | 2 - dan_layer/engine/src/transaction/processor.rs | 14 +- dan_layer/engine/tests/account.rs | 28 + dan_layer/p2p/proto/transaction.proto | 16 +- dan_layer/p2p/src/conversions/common.rs | 4 +- dan_layer/p2p/src/conversions/transaction.rs | 80 ++- .../up.sql | 2 +- dan_layer/state_store_sqlite/src/reader.rs | 2 +- dan_layer/state_store_sqlite/src/schema.rs | 2 +- .../src/sql_models/transaction.rs | 23 +- dan_layer/state_store_sqlite/src/writer.rs | 4 +- dan_layer/template_lib/src/args/arg.rs | 8 +- dan_layer/transaction/src/builder.rs | 77 +-- dan_layer/transaction/src/lib.rs | 2 + dan_layer/transaction/src/substate.rs | 260 ++++++++ dan_layer/transaction/src/transaction.rs | 347 ++--------- .../transaction/src/unsigned_transaction.rs | 126 +++- .../2023-02-08-122514_initial/up.sql | 31 +- .../storage_sqlite/src/models/transaction.rs | 31 +- dan_layer/wallet/storage_sqlite/src/schema.rs | 3 +- dan_layer/wallet/storage_sqlite/src/writer.rs | 3 +- .../tests/features/wallet_daemon.feature | 26 +- integration_tests/tests/steps/indexer.rs | 11 + integration_tests/tests/steps/miner.rs | 2 +- integration_tests/tests/steps/mod.rs | 1 + integration_tests/tests/steps/network.rs | 46 ++ .../tests/steps/validator_node.rs | 4 +- integration_tests/tests/steps/wallet.rs | 2 +- 37 files changed, 1191 insertions(+), 1055 deletions(-) delete mode 100644 applications/tari_validator_node/src/transaction_processor.rs create mode 100644 dan_layer/transaction/src/substate.rs create mode 100644 integration_tests/tests/steps/network.rs diff --git a/applications/tari_dan_app_utilities/src/transaction_executor.rs b/applications/tari_dan_app_utilities/src/transaction_executor.rs index 03de46dc2..d29ec0b06 100644 --- a/applications/tari_dan_app_utilities/src/transaction_executor.rs +++ b/applications/tari_dan_app_utilities/src/transaction_executor.rs @@ -108,10 +108,15 @@ where TTemplateProvider: TemplateProvider