-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 an implementation of DIP 0027 Credit Asset Locks #5026
Conversation
Please change PR title to follow conventional commits :) |
src/chainparams.cpp
Outdated
// TODO or which one? | ||
consensus.llmqTypeAssetLocks = Consensus::LLMQType::LLMQ_50_60; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably fine
src/chainparams.cpp
Outdated
consensus.llmqTypeDIP0024InstantSend = Consensus::LLMQType::LLMQ_60_75; | ||
consensus.llmqTypePlatform = Consensus::LLMQType::LLMQ_100_67; | ||
consensus.llmqTypeMnhf = Consensus::LLMQType::LLMQ_50_60; | ||
// TODO or which one? | ||
consensus.llmqTypeAssetLocks = Consensus::LLMQType::LLMQ_50_60; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused... I thought all of these should be llmq_devnet...
18e1141
to
16478ce
Compare
This pull request has conflicts, please rebase. |
This pull request has conflicts, please rebase. |
53f5d52
to
d2e9e20
Compare
879f60f
to
d894f13
Compare
assert can be triggered if Add() is called without validation of SkipSet conditions
} | ||
|
||
index = assetUnlockTx.getIndex(); | ||
toUnlock = assetUnlockTx.getFee(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping re min fee
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now blocks mined and transaction are created by different nodes to be sure that transaction are relayed
Looks good! 👍 What about
? |
added just now, thanks for reminding! |
Ok, so this diff --git a/test/functional/feature_asset_locks.py b/test/functional/feature_asset_locks.py
index 725d290f6e..32176e309c 100755
--- a/test/functional/feature_asset_locks.py
+++ b/test/functional/feature_asset_locks.py
@@ -295,7 +295,7 @@ class AssetLocksTest(DashTestFramework):
self.log.info("Generating several txes by same quorum....")
self.validate_credit_pool_amount(locked_1)
- asset_unlock_tx = self.create_assetunlock(101, COIN, pubkey)
+ asset_unlock_tx = self.create_assetunlock(101, COIN, pubkey, fee=1)
asset_unlock_tx_late = self.create_assetunlock(102, COIN, pubkey)
asset_unlock_tx_too_late = self.create_assetunlock(103, COIN, pubkey)
asset_unlock_tx_too_big_fee = self.create_assetunlock(104, COIN, pubkey, fee=int(Decimal("0.1") * COIN)) results in failures like
That's exactly what I was worried about. 0f35ff3 should help. Or maybe we need to think more about unlocking vs min fees. |
https://github.com/dashpay/dash/pull/5026/files#r1269915571 oh, so it's ok for unlock tx to fail? for example when fees are high or mempool is full |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK then :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-utACK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK for squash merge
…nce` Bad naming is noticed in dashpay#5026 by thepez
…nce` Bad naming is noticed in dashpay#5026 by thephez
…5526) ## Issue being fixed or feature implemented Bad naming is noticed in #5026 by thephez ## What was done? Renamed `assetLockedAmount` in CbTx to `creditPoolBalance` Renamed also some local variables and functions to make it matched also. ## How Has This Been Tested? Run functional/unit tests - succeed Called python's rpc binding `node.getblock(block_hash)['cbTx']`: Got this result: ``` {'version': 3, 'height': 1556, 'merkleRootMNList': '978b2b4d1b884de62799b9eaee75c7812fea59f98f80d5ff9c963b0f0f195e14', 'merkleRootQuorums': 'bc7a34eb114f4e4bf38a11080b5d8ac41bdb36dd41e17467bae23c94ba06b013', 'bestCLHeightDiff': 0, 'bestCLSignature': '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', 'creditPoolBalance': Decimal('7.00141421')} ``` ## Breaking Changes Renamed `assetLockedAmount` in CbTx to `creditPoolBalance`. @shumkov be informed ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [x] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone
…ashpay#5526) ## Issue being fixed or feature implemented Bad naming is noticed in dashpay#5026 by thephez ## What was done? Renamed `assetLockedAmount` in CbTx to `creditPoolBalance` Renamed also some local variables and functions to make it matched also. ## How Has This Been Tested? Run functional/unit tests - succeed Called python's rpc binding `node.getblock(block_hash)['cbTx']`: Got this result: ``` {'version': 3, 'height': 1556, 'merkleRootMNList': '978b2b4d1b884de62799b9eaee75c7812fea59f98f80d5ff9c963b0f0f195e14', 'merkleRootQuorums': 'bc7a34eb114f4e4bf38a11080b5d8ac41bdb36dd41e17467bae23c94ba06b013', 'bestCLHeightDiff': 0, 'bestCLSignature': '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', 'creditPoolBalance': Decimal('7.00141421')} ``` ## Breaking Changes Renamed `assetLockedAmount` in CbTx to `creditPoolBalance`. @shumkov be informed ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [x] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone
## Issue being fixed or feature implemented The bug was introduced in the original PR #5026 and refactored later (which is good actually cause we shouldn't mix refactoring and bug-fixing :) ) ## What was done? fix conditions, add tests ## How Has This Been Tested? `feature_asset_locks.py` ## Breaking Changes n/a ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_
Issue being fixed or feature implemented
This is an implementation of DIP0027 "Credit Asset Locks".
It's a mechanism to fluidly exchange between Dash and credits.
What was done?
This pull request includes:
- Asset Lock transaction
- Asset Unlock transaction (withdrawal)
- Credit Pool in coinbase
- Unit tests for Asset Lock/Unlock tx
- New functional test
feature_asset_locks.py
RPC: currently locked amount (credit pool) is available through rpc call
getblock
.How Has This Been Tested?
There added new unit tests for basic checks of transaction validity (asset lock/unlock).
Also added new functional test "feature_asset_locks.py" that cover typical cases, but not all corner cases yet.
Breaking Changes
This feature should be activated as soft-fork because:
Checklist:
To release DIP 0027