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: tx weight takes tariscript and output features into account [igor] #3411

Conversation

sdbondi
Copy link
Member

@sdbondi sdbondi commented Oct 4, 2021

Description

  • adds consensus encoding for tari script and output features
  • igor: tx weight takes TariScript and OutputFeatures metadata into
    account as per docs: add block/transaction weights to RFC #3368
  • igor: weights updated as per docs: add block/transaction weights to RFC #3368
  • add TransactionWeight parameters for weatherwax and igor networks
    and set them in consensus constants
  • set max block weight for igor (+95% adjust to allow similar number of
    max inputs/outputs/kernels ~2Mb)
  • decouple chain_storage from consensus_contstants module to allow
    wallet to use it
  • wallet: minor simplification/dedup code of coin split logic
  • wallet: default fee per gram depending on network
  • wallet and base node tests updated as needed

Motivation and Context

See #3368

How Has This Been Tested?

Existing tests updated, manually checked normal and one-sided transaction sending between console wallets/mobile on watherwax and igor

@sdbondi sdbondi force-pushed the core-output-features-canonical-encoding branch 3 times, most recently from 9c2302a to 736f953 Compare October 5, 2021 04:49
Copy link
Collaborator

@SWvheerden SWvheerden left a comment

Choose a reason for hiding this comment

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

Looks good

base_layer/core/src/mempool/priority/mod.rs Outdated Show resolved Hide resolved
@sdbondi sdbondi force-pushed the core-output-features-canonical-encoding branch from 736f953 to 729f88f Compare October 5, 2021 11:33
let mut buf = Vec::new();
bincode::serialize_into(&mut buf, self).unwrap(); // this should not fail
/// Encodes output features for a v1 block
pub fn to_v1_bytes(&self) -> Vec<u8> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should add a version to the output or perhaps OutputFeatures so that we know which version was used in the hash etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah think that makes sense - will do - I'll modify the hashes depending on the output version

Copy link
Member Author

Choose a reason for hiding this comment

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

The downside is additional storage and it turns this PR into a breaking one, blockchains will need to be resynced so not too bad

Copy link
Member Author

@sdbondi sdbondi Oct 6, 2021

Choose a reason for hiding this comment

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

The default impl for OutputFeatures no longer makes sense as the version depends on your network -> block version, which entails lots of changes.

The intention was to remove the v1/v2 concept and just use consensus encoding at a convenient point (like a testnet reset). But it may. be worth putting in the time to include "transaction/UTXO versioning" while maintaining backward-compatibility. Perhaps for another PR since this one is currently non-breaking for weatherwax?

@sdbondi sdbondi force-pushed the core-output-features-canonical-encoding branch 12 times, most recently from 74b7468 to 621f8bc Compare October 11, 2021 07:12
- adds consensus encoding for tari script and output features
- igor: tx weight takes TariScript and OutputFeatures metadata into
  account as per tari-project#3368
- igor: weights updated as per tari-project#3368
- add `TransactionWeight` parameters for weatherwax and igor networks
  and set them in consensus constants
- set max block weight for igor (+95% adjust to allow similar number of
  max inputs/outputs/kernels ~2Mb)
- decouple chain_storage from consensus_contstants module to allow
  wallet to use it
- minor simlification of wallet coin split logic
- wallet and base node tests updated as needed
@sdbondi sdbondi force-pushed the core-output-features-canonical-encoding branch from 621f8bc to b43270e Compare October 11, 2021 07:56
* development:
  fix: fix confusing names in get_balance functions (tari-project#3447)
  feat: add sql query to obtain balance (tari-project#3446)
  fix: u64->i64->u64 conversion; chain split height as u64 (tari-project#3442)
* development:
  fix: add display_currency_decimal method (tari-project#3445)
  fix: add sanity checks to prepare_new_block (tari-project#3448)
  test: profile wallet sqlite database operations (tari-project#3451)
  test: create cucumber test directory if necessary (tari-project#3452)
  chore: improve cucumber tags and run time speed (tari-project#3439)
stringhandler
stringhandler previously approved these changes Oct 15, 2021
stringhandler
stringhandler previously approved these changes Oct 18, 2021
* development:
  fix: ensure that accumulated orphan chain data is committed before header validation (tari-project#3462)
  fix: remove is_synced check for transaction validation (tari-project#3459)
  feat: improve logging for tari_mining_node (tari-project#3449)
@sdbondi sdbondi force-pushed the core-output-features-canonical-encoding branch from bc2c9e7 to 1c208da Compare October 18, 2021 16:59
@aviator-app aviator-app bot merged commit 5bef3fd into tari-project:development Oct 19, 2021
@sdbondi sdbondi deleted the core-output-features-canonical-encoding branch October 19, 2021 07:52
sdbondi added a commit to sdbondi/tari that referenced this pull request Oct 19, 2021
* development:
  feat: tx weight takes tariscript and output features into account [igor] (tari-project#3411)
aviator-app bot pushed a commit that referenced this pull request Oct 19, 2021
Description
---

Remove consensus breaking change from #3411

Motivation and Context
---
Breaks consensus on weatherwax

How Has This Been Tested?
---
Synced base node
sdbondi added a commit to sdbondi/tari that referenced this pull request Oct 25, 2021
* development: (31 commits)
  feat!: revalidate all outputs (tari-project#3471)
  fix: check SAF message inflight and check stored_at is in past (tari-project#3444)
  feat!: apps should not depend on other app configs (tari-project#3469)
  fix: fix recovery test reporting message (tari-project#3479)
  chore: improve cucumber tests to wait for broadcast (tari-project#3461)
  test: use TCP node for daily sync test (tari-project#3464)
  fix: remove unbounded vec allocations from base node grpc/p2p messaging (tari-project#3467)
  fix: upgrade rustyline dependencies (tari-project#3476)
  fix(dht): discard encrypted message with no destination (tari-project#3472)
  fix: remove consensus breaking change in transaction input (tari-project#3474)
  feat: tx weight takes tariscript and output features into account [igor] (tari-project#3411)
  fix: validate dht header before dedup cache (tari-project#3468)
  fix: sha256sum isn't available on all *nix platforms (tari-project#3466)
  fix: typo in console wallet (tari-project#3465)
  fix: ensure that accumulated orphan chain data is committed before header validation (tari-project#3462)
  fix: remove is_synced check for transaction validation (tari-project#3459)
  feat: improve logging for tari_mining_node (tari-project#3449)
  fix: remove unnecessary wallet dependency (tari-project#3438)
  test: simplify cucumber tests (tari-project#3457)
  ci: create script to update DNS records from hashes.txt (tari-project#3458)
  ...
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.

None yet

3 participants