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

Added Conversion Functionality #1559

Merged
merged 3 commits into from
Apr 23, 2024

Conversation

jdowning100
Copy link
Contributor

@jdowning100 jdowning100 commented Mar 25, 2024

@dominant-strategies/core-dev
Conversion is a process that allows a user to convert Quai to Qi and vice-versa at the rate determined by the header difficulty (the conversion formula is currently a stub). Conversion does not require a separate transaction type, rather, the user signs and sends a transaction that spends to an address in the same location but different ledger (Quai or Qi). This emits an ETX that must cross prime before it is included in a block in the destination (along with all other ETXs) and converts at the rate of the Prime coincident. Converted funds are locked for a length of blocks to be determined. There is a minimum conversion amount as well, to be determined.
Note:
A Qi-Quai conversion locks the funds in the lockup 'precompile' smart contract in contracts.go. The recipient sends an empty transaction to the address of this smart contract with sufficient gas (at least 100k) and the smart contract will iteratively redeem any locks that are unlocked and credit the recipients balance.
A Quai-Qi conversion will lock the UTXOs in the destination, but the rest of the address' UTXOs are not affected. The conversion executes after a prime coincident and only creates as many UTXOs as gas provided in the ETX (9000 gas per UTXO creation).

Conversion is currently not possible cross-shard.

Copy link
Member

@wizeguyy wizeguyy left a comment

Choose a reason for hiding this comment

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

We need to discuss with @kiltsonfire about account locking

consensus/misc/rewards.go Outdated Show resolved Hide resolved
@jdowning100 jdowning100 force-pushed the conversion branch 3 times, most recently from 59b4b14 to 7c92f0e Compare April 11, 2024 20:16
core/state_processor.go Outdated Show resolved Hide resolved
@jdowning100 jdowning100 force-pushed the conversion branch 3 times, most recently from e3e5726 to 7f802f0 Compare April 17, 2024 21:59
@jdowning100 jdowning100 force-pushed the conversion branch 3 times, most recently from 6c9f62b to ee13241 Compare April 18, 2024 19:33
consensus/blake3pow/consensus.go Outdated Show resolved Hide resolved
consensus/progpow/consensus.go Outdated Show resolved Hide resolved
core/state/statedb.go Show resolved Hide resolved
core/state_processor.go Show resolved Hide resolved
core/worker.go Outdated Show resolved Hide resolved
core/worker.go Outdated Show resolved Hide resolved
wizeguyy
wizeguyy previously approved these changes Apr 22, 2024
@jdowning100 jdowning100 changed the base branch from goldenage to main April 23, 2024 15:42
@jdowning100 jdowning100 dismissed wizeguyy’s stale review April 23, 2024 15:42

The base branch was changed.

@kiltsonfire kiltsonfire self-requested a review April 23, 2024 19:49
@wizeguyy wizeguyy self-requested a review April 23, 2024 19:52
@jdowning100 jdowning100 merged commit bce158f into dominant-strategies:main Apr 23, 2024
7 checks passed
@jdowning100 jdowning100 deleted the conversion branch April 23, 2024 19:57
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.

4 participants