-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wallet): new command to publish a contract definition transaction (
#4133) Description --- * Created a new transaction output features for the Contract Definition * For simplicity, I decided to leave out fields that could be more coupled to the template format. * The `contract_id` is calculated as a hash of the contents of the contract definition, in the line of what is described in the RFCs. I used `ConsensusHashWriter` to make it totally consistent. * I created a new Output Features version to signal the consensus breaking changes. * Had to update the genesis block struct to include the new features * Had to update the gRPC types to include the new features * Created a new command in the tari console wallet (`publish-contract-definition`): 1. Reads the contract definition from a JSON file. I defined auxiliary structs (`base_layer/wallet/src/assets/contract_definition.rs`) to decouple the file format from the output features. 2. Created a new transaction with the `CONTRACT_DEFNITION` flag and the new Contract Definition output features. 3. Publishes the corresponding UTXO into the network. * Right now the base layer does not perform any check in the values in the contract definition. In the future we want to implement custom consensus rules for contract definition (like avoiding duplicates, spending requirements, etc.) but I purposely left that out of this PR for simplicity. Motivation and Context --- As a user, I want to be able to publish a new contract definition into the network through the console wallet. How Has This Been Tested? --- * Created a new unit test for the consensus encoding of the new Contract Definition output features * Created a new integration test for the wallet CLI that reads the contract definition from a JSON file and successfully publishes the transaction
- Loading branch information
Showing
24 changed files
with
962 additions
and
19 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.