Skip to content

Conversation

@dimxy
Copy link
Collaborator

@dimxy dimxy commented May 6, 2024

Adds a burn output sending 25% of the taker utxo DEX fee to a dedicated pre-burn address. Funds collected on the pre-burn address will be traded for KMD to burn them (thus additionally burning KMD supply).
This PR partially closes #2010

The requirements for this PR: #2269

In this PR:

  • split dex fee for non-kmd utxo coins (apart from zcoin) and added an output to the pre-burn account
  • old-style non-split dex fee non-kmd txns are also allowed in validation code (until all taker nodes upgraded) - this feature is removed in favour of version-based burning activation
  • refactored dex fee pubkey in params: instead of passing dex fee and burn pubkeys in function params new methods dex_pubkey() and burn_pubkey() were added to the SwapOps trait
  • add version to maker/taker negotiation message and activate burning for the new version
  • mocktopus was made optional dependency and activated only for development builds (as its doc suggests).
  • for the burn account no burn part is added (DexFee::Standard used)
  • sending burn part to the burn account for zcoin
  • sending burn part to the burn account for tendermint
  • fix burn pubkey
  • do not pay dex fee if taker is the dex pubkey (for non-privacy utxo)

NOTE: As mocktopus now is marked 'optional = true' in coins Cargo.toml and activated from the mm2_main crate by adding features = ["mocktopus"] in [dev-dependencies] section, you also need to mark your mockable code, called from other crates, this way: #[cfg_attr(feature = "mocktopus", mockable)], otherwise mocks won't work (see samples in code)

TODO:

  • fix burn zaddr (enable burn for zcoin)
  • disable non-split non-kmd dex fee (no burn output) validation when all taker nodes upgrade to new dex fee splitting

dimxy added 9 commits April 27, 2024 14:33
* dev:
  docs(README): remove outdated information from the README (#2097)
  fix(sia): fix sia compilation after hd wallet PR merge (#2103)
  feat(hd_wallet): utxo and evm hd wallet and trezor (#1962)
  feat(sia): initial Sia integration (#2086)
  fix(BCH): deserialize BCH header that uses KAWPOW version correctly (#2099)
  fix(eth_tests): remove ETH_DEV_NODE from tests (#2101)
@dimxy dimxy changed the title Add utxo burn output for non-kmd taker fee feat(utxo-swap): add utxo burn output for non-kmd taker fee May 6, 2024
* dev:
  feat(tendermint): pubkey-only activation and unsigned tx (#2088)
  fix(tests): set txfee for some tbtc tests (#2116)
  fix(eth): remove my_address from sign_and_send_transaction_with_keypair (#2115)
  fix(utxo-swap): apply events occurred while taker down (#2114)
  refactor(memory): memory usage improvements (#2098)
  feat(app-dir): implement root application dir `.kdf` (#2102)
  fix tendermint fee calculation (#2106)
  update dockerfile (#2104)
* dev:
  feat(ETH): eip1559 gas fee estimator and rpcs (#2051)
  fix(p2pk-tests): fix p2pk tests post merge (#2119)
  fix(p2pk): show and spend P2PK balance (#2053)
  fix(swap): use tmp file for swap and order files (#2118)
dimxy added 9 commits June 14, 2024 20:54
fix zhtlc send and spend tests
add should_burn_dex_fee method to indicate which coin has burn output
* dev:
  fix(indexeddb): window usage in worker env (#2131)
  feat(tx-history): handle encoded transaction values (#2133)
  fix(core): tendermint withdraws on hd accounts (#2130)
  fix(core): improve validation rules for table names (#2123)
  fix(test): improve log wait condition to fix taker restart test (#2125)
…er test

add timeout in wait for fee in qrc20 docker test
… docker test failed due to different dex fee values if trait default impl was used)
Copy link

@laruh laruh left a comment

Choose a reason for hiding this comment

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

Great progress! Here is the first review iteration

dimxy added 2 commits June 19, 2024 13:05
use same ovk for dex fee and burn outputs
add sanity check for dex_fee in calc_burn_amount_for_op_return
@shamardy shamardy self-requested a review March 17, 2025 11:17
@shamardy
Copy link
Collaborator

@dimxy please add the correct DEX_BURN_Z_ADDR

dimxy added 3 commits March 17, 2025 17:18
* dev:
  refactor(eth): use trait addr_to_string method instead of old function (#2348)
  fix(ci): use correct rustup component syntax in fmt-and-lint job (#2390)
  refactor(tx-query): use TxSearchRequest for tx queries (#2384)
  refactor(tpu-v2): allow to skip p2p message with taker payment spend preimage for eth (#2359)
shamardy
shamardy previously approved these changes Mar 19, 2025
Copy link
Collaborator

@shamardy shamardy left a comment

Choose a reason for hiding this comment

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

LGTM! Please resolve conflicts and this #2112 (comment) for me to merge it. Next step (next week) we should bring back versioning to finally enable this feature.

@laruh
Copy link

laruh commented Mar 20, 2025

Next step (next week) we should bring back versioning to finally enable this feature.

Could you clarify, you suggest to add it in new pr or in the current?

laruh
laruh previously approved these changes Mar 20, 2025
Copy link

@laruh laruh left a comment

Choose a reason for hiding this comment

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

I dont have more comments. LGTM!

@dimxy dimxy dismissed stale reviews from laruh and shamardy via 1ed4af7 March 20, 2025 08:41
@dimxy
Copy link
Collaborator Author

dimxy commented Mar 20, 2025

@onur-ozkan plz take a look at this: 1ed4af7, I had to do this apparently bcz of mockable added to TendermintCoin

@shamardy
Copy link
Collaborator

Could you clarify, you suggest to add it in new pr or in the current?

In a new PR :)

@onur-ozkan
Copy link

@onur-ozkan plz take a look at this: 1ed4af7, I had to do this apparently bcz of mockable added to TendermintCoin

I don't know the context of the error but the change doesn't seem harmful.

So it looks good to me. :)

@shamardy shamardy changed the title feat(utxo-swap): add utxo burn output for non-kmd taker fee feat(swap): add utxo/cosmos/ARRR burn address output Mar 24, 2025
@shamardy shamardy changed the title feat(swap): add utxo/cosmos/ARRR burn address output feat(swap): add utxo/cosmos/ARRR pre-burn address output Mar 24, 2025
@shamardy shamardy merged commit 5b2f045 into dev Mar 24, 2025
26 checks passed
@shamardy shamardy deleted the burn-dex-fee-for-non-kmd branch March 24, 2025 23:23
dimxy pushed a commit that referenced this pull request Apr 7, 2025
* dev:
  improvement(best-orders): return an rpc error when we can't find best orders (#2318)
  feat(utxo): support FIRO Spark verbose tx
  feat(ARRR): dockerize zombie/pirate tests  (#2374)
  improvement(event-streaming): move UnknownClient error to trace level (#2401)
  feat(tpu): implement 0 dexfee for kmd trading pairs (#2323)
  feat(db-arch): ctx functions and use of global db (#2378)
  feat(swap): add utxo/cosmos/ARRR pre-burn address output (#2112)
dimxy pushed a commit to dimxy/komodo-defi-framework that referenced this pull request May 27, 2025
* lr-swap-wip: (45 commits)
  review (mariocynicys): fix iterators zipping, refactor 1inch url builder, add docs to cross prices data, remove extra coin decimals check
  added doc comments for LrData struct
  error msg improved
  fix tx value eth conversion
  eliminate from_api_error fn
  fix src_decimals var name
  improve bad api TokenInfo error messages
  improvement(best-orders): return an rpc error when we can't find best orders (GLEECBTC#2318)
  feat(utxo): support FIRO Spark verbose tx
  feat(ARRR): dockerize zombie/pirate tests  (GLEECBTC#2374)
  improvement(event-streaming): move UnknownClient error to trace level (GLEECBTC#2401)
  feat(tpu): implement 0 dexfee for kmd trading pairs (GLEECBTC#2323)
  feat(db-arch): ctx functions and use of global db (GLEECBTC#2378)
  feat(swap): add utxo/cosmos/ARRR pre-burn address output (GLEECBTC#2112)
  review (laruh): rename fn
  review (laruh): add fn to get contracts from LrData
  add TODO
  fix find best lr swap behaviour: skip lr provider error results (to use successful ones)
  refactor 1inch url builder
  fix 1inch result conversion test
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: high Important tasks that need attention soon. status: pending review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants