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 burned outputs #4364

Merged
merged 5 commits into from
Aug 2, 2022

Conversation

SWvheerden
Copy link
Collaborator

@SWvheerden SWvheerden commented Jul 29, 2022

Description

This Pr adds in the ability to create burned outputs.
There will be a follow-up PR addressing the kernel mutability as currently the fields are mutable and need to be signed to block mutability, see: #4365.

For added reasoning why this is needed see RFC: tari-project/rfcs#10

Full testing of this is also blocked by: #4360

How Has This Been Tested?

Unit and integration tests.

@SWvheerden SWvheerden changed the title feat: add burned outputs feat!: add burned outputs Aug 2, 2022
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.

Nice looks good - few minor comments.
Will run a test.

base_layer/core/src/validation/helpers.rs Outdated Show resolved Hide resolved
base_layer/wallet/src/transaction_service/service.rs Outdated Show resolved Hide resolved
integration_tests/log4rs/base_node.yml Outdated Show resolved Hide resolved
Copy link
Collaborator

@stringhandler stringhandler left a comment

Choose a reason for hiding this comment

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

Happy to merge. Please create an issue for the missing unit tests

/// THis function checks the total burned sum in the header ensuring that every burned output is counted in the total
/// sum.
#[allow(clippy::mutable_key_type)]
pub fn check_total_burned(body: &AggregateBody) -> Result<(), ValidationError> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Need some unit tests to prove this picks up the errors

@aviator-app aviator-app bot merged commit 60f3877 into tari-project:development Aug 2, 2022
@sdbondi
Copy link
Member

sdbondi commented Aug 2, 2022

@SWvheerden Tested via grpc. Base node accepted the transaction into the mempool but rejected the block

Contains Invalid Burn: Burned kernel does not match burned output.


>> get-mempool-state
----------------- Mempool -----------------
--- Unconfirmed Pool ---
    508f0e89a9bab64e4d0bc791a28eec1680a591672d1c4b6efe8df54861d31100 Fee: 630 µT, Outputs: 2, Kernels: 1, Inputs: 1, metadata: 26 bytes
--- Reorg Pool ---
>> get-mempool-state
get-mempool-stats  get-mempool-state  get-mempool-tx
>> get-mempool-tx /onion3/xjata3libyepyoijgvanblbpv2iv7udolxc5fuz7u3nauuu3x7s6qqad:18141

----------------- Mempool -----------------
--- Unconfirmed Pool ---
--- TX: 508f0e89a9bab64e4d0bc791a28eec1680a591672d1c4b6efe8df54861d31100 ---
WARNING: Block body is not sorted.
--- Transaction Kernels ---
Kernel 0:
Fee: 630 µT
Lock height: 0
Features: BURN_KERNEL
Excess: 6a2a5c91e32b3e87e97cf9e845f0ff09700d7b4f029175ccc5358e6cbfbfb03f
Excess signature: {"public_nonce":"082edc8d90fd89ceefa1a986959b53ce8e58f4ef570b65b877ae8a2da1605b5d","signature":"508f0e89a9bab64e4d0bc791a28eec1680a591672d1c4b6efe8df54861d31100"}
Commitment: 40c8e7df7235743635f0d5078c32b3c99cc2b792773d2764444bbed0f682d32b

--- Inputs (1) ---
be955fbe4672e25fb463ba9a8e9ba54b371959825e42095f0b389d7fc4a6d046 [OutputFeatures { version: V0, output_type: Coinbase, maturity: 8, metadata: [], sidechain_features: None, unique_id: None, parent_public_key: None, asset: None, mint_non_fungible: None, sidechain_checkpoint: None, committee_definition: None }], Script: (Nop), Offset_Pubkey: (46246a4a77c2ec2abe69b5f46cd21d2ab4ee7576bb49076ff6d83e3a88893a18), Input Hash: 8a16522acf64c8c5047e535b3f9c2642b40ca8aa7e0a2788029f0ce9dcf7965f, Output: d92d85054ab563d86119841139c68af0f724faf3ca942afacd0c70f390f2bf01
--- Outputs (2) ---
40c8e7df7235743635f0d5078c32b3c99cc2b792773d2764444bbed0f682d32b [OutputFeatures { version: V0, output_type: Burn, maturity: 0, metadata: [], sidechain_features: None, unique_id: None, parent_public_key: None, asset: None, mint_non_fungible: None, sidechain_checkpoint: None, committee_definition: None }], Script: (PushZero), Offset Pubkey: (f8c35755dd74ab7674a3cc946f679a11206e3f41722404d49177d0e3e253d208), Metadata Signature: (91ec6a0fc426cfacc89648c0c581ed364b3cf26da060f57ff285652ef917e502, 25f079b97f0ecfd5fd68395959f14dc6fb0f249a016546d6342529d0250d9f0c, 40e73d52135be2f7c67b1f585bd3c33ccedc3d9d7b31265c4dc54389808baf16), Proof: 01d40989eaed0148..d2bd5c128ad8ec07
5ccfd6b036716368ca24e426bba8caff063f445f07a05d290b49ed2765c74b16 [OutputFeatures { version: V0, output_type: Standard, maturity: 0, metadata: [], sidechain_features: None, unique_id: None, parent_public_key: None, asset: None, mint_non_fungible: None, sidechain_checkpoint: None, committee_definition: None }], Script: (Nop), Offset Pubkey: (d8413a76a7b6b0c01da565cafbc4cefd891e0ab68cdf9270e8f4d5ca10307722), Metadata Signature: (e6791a973c860bbb1920d3c478c062d9321e19f28f425e69619eb938d1041b0f, fa04e7dd956cde3ce1364a3285f94ac09eaa58b336a6ca51b48034c7c917b70d, f0a8be7742d27760f12e5e7d97b841307103045d5b2197f944566f304543e813), Proof: 01622522191ff8d7..d7cfddaff2121507

@SWvheerden
Copy link
Collaborator Author

#4374

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.

3 participants