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(utxo-coredao): initialize utxo-coredao #5062

Merged
merged 2 commits into from
Oct 28, 2024
Merged

Conversation

davidkaplanbitgo
Copy link
Contributor

@davidkaplanbitgo davidkaplanbitgo commented Oct 24, 2024

This is dependent on wasm-miniscript with OP_DROP, which is not merged in yet. I will add tests for this once we can import it.

This contains code for the OP_RETURN as well as the descriptor for CoreDao

TICKET: BTC-1578

@davidkaplanbitgo davidkaplanbitgo marked this pull request as ready for review October 24, 2024 21:15
@davidkaplanbitgo davidkaplanbitgo requested review from a team as code owners October 24, 2024 21:15
@davidkaplanbitgo davidkaplanbitgo force-pushed the BTC-1578-coredao branch 4 times, most recently from e84b02a to 721828c Compare October 24, 2024 21:21
@davidkaplanbitgo davidkaplanbitgo marked this pull request as draft October 25, 2024 00:54
@davidkaplanbitgo davidkaplanbitgo force-pushed the BTC-1578-coredao branch 2 times, most recently from 80eb1f9 to 4cd57fc Compare October 25, 2024 01:41
modules/utxo-coredao/README.md Outdated Show resolved Hide resolved
modules/utxo-coredao/src/transaction.ts Outdated Show resolved Hide resolved
modules/utxo-coredao/src/transaction.ts Outdated Show resolved Hide resolved
modules/utxo-coredao/src/transaction.ts Outdated Show resolved Hide resolved
modules/utxo-coredao/src/transaction.ts Show resolved Hide resolved
@davidkaplanbitgo davidkaplanbitgo force-pushed the BTC-1578-coredao branch 3 times, most recently from 9066f6f to f317b97 Compare October 25, 2024 12:35
modules/utxo-coredao/src/transaction.ts Outdated Show resolved Hide resolved
modules/utxo-coredao/src/transaction.ts Outdated Show resolved Hide resolved
Comment on lines 79 to 91
assert.throws(() =>
createCoreDaoOpReturnBuffer({
version: validVersion,
chainId: validChainId,
delegator: validDelegator,
validator: validValidator,
fee: validFee,
})
);
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm why tho?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It needs to have either a redeem script or a timelock

Copy link
Contributor

Choose a reason for hiding this comment

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

deserves a comment, however let's make it a type error instead

Copy link
Contributor

Choose a reason for hiding this comment

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

see other comment

Copy link
Contributor

@zahin-mohammad zahin-mohammad left a comment

Choose a reason for hiding this comment

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

please update codeowners

Comment on lines +18 to +34
export function createCoreDaoOpReturnOutputScript({
version,
chainId,
delegator,
validator,
fee,
redeemScript,
timelock,
}: {
version: number;
chainId: Buffer;
delegator: Buffer;
validator: Buffer;
fee: number;
redeemScript?: Buffer;
timelock?: number;
}): Buffer {
Copy link
Contributor

Choose a reason for hiding this comment

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

let's make illegal states unrepresentable!

Suggested change
export function createCoreDaoOpReturnOutputScript({
version,
chainId,
delegator,
validator,
fee,
redeemScript,
timelock,
}: {
version: number;
chainId: Buffer;
delegator: Buffer;
validator: Buffer;
fee: number;
redeemScript?: Buffer;
timelock?: number;
}): Buffer {
type BaseParams = {
version: number;
chainId: Buffer;
delegator: Buffer;
validator: Buffer;
fee: number;
};
export function createCoreDaoOpReturnOutputScript({
version,
chainId,
delegator,
validator,
fee,
...rest,
}: BaseParams & ({ redeemScript: Buffer; } | { timelock: number })): Buffer {

You will have to use 'redeemScript' in rest. Let's move this change to a follow-up PR.

@davidkaplanbitgo davidkaplanbitgo merged commit 8265567 into master Oct 28, 2024
8 checks passed
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