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: new command phase1 stake to BTC delegation #90

Merged
merged 42 commits into from
Nov 29, 2024
Merged
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
580adf8
chore: init command draft
RafilxTenfen Oct 16, 2024
db1692a
chore: add get tx details from tx hash only
RafilxTenfen Oct 16, 2024
d76b933
chore: add initial impl to btc staking from phase 1
RafilxTenfen Nov 5, 2024
7a53e09
Merge branch 'main' of github.com:babylonlabs-io/btc-staker into rafi…
RafilxTenfen Nov 18, 2024
ea40b9f
feat: add cli to create babylon create btc delegation from staking tx
RafilxTenfen Nov 20, 2024
0374d0b
chore: add #90 to changelog
RafilxTenfen Nov 20, 2024
b41aa7a
chore: add stake command to CLI
RafilxTenfen Nov 20, 2024
90d7a95
fix: lint
RafilxTenfen Nov 20, 2024
0fe2886
chore: move cli and manager to separated file
RafilxTenfen Nov 20, 2024
2021de6
chore: manager split btc data
RafilxTenfen Nov 20, 2024
17ebc5d
chore: split func to generate covenant pk
RafilxTenfen Nov 20, 2024
35ec159
chore: add staking of phase 1 test
RafilxTenfen Nov 20, 2024
81b947b
fix: lint
RafilxTenfen Nov 21, 2024
7c745dd
trytest: stuck at including finality provider to running chain
RafilxTenfen Nov 21, 2024
323cdcf
chore: add last err to debug
RafilxTenfen Nov 21, 2024
f57a446
pass json serializable params
KonradStaniec Nov 22, 2024
916d27d
chore: refactory send transaction to phase 1
RafilxTenfen Nov 22, 2024
5dfe472
Merge branch 'rafilx/migrate-stk-to-phase2' of github.com:babylonlabs…
RafilxTenfen Nov 22, 2024
75c02d3
Merge branch 'main' of github.com:babylonlabs-io/btc-staker into rafi…
RafilxTenfen Nov 22, 2024
fdc155e
chore: fix comment
RafilxTenfen Nov 22, 2024
15cb74d
chore: address PR comments
RafilxTenfen Nov 25, 2024
ffff690
chore: rollback rand
RafilxTenfen Nov 25, 2024
503c8a5
chore: use rand previous created
RafilxTenfen Nov 25, 2024
4e7844f
Merge branch 'main' of github.com:babylonlabs-io/btc-staker into rafi…
RafilxTenfen Nov 25, 2024
86b1da9
chore: add possible responde of BTC delegation to consumer
RafilxTenfen Nov 25, 2024
cb95513
chore: try to refactory to receive BTC delegation tx hash
RafilxTenfen Nov 25, 2024
6bea332
chore: moved to use command
RafilxTenfen Nov 25, 2024
0f0e989
chore: add todo
RafilxTenfen Nov 25, 2024
8be6baf
chore: fix lint and allow nonamedreturns
RafilxTenfen Nov 26, 2024
9958f45
chore: remove go routine of mine empty blocks
RafilxTenfen Nov 26, 2024
417d18f
chore: add new field to transaction tracked of tx hash of btc delegation
RafilxTenfen Nov 26, 2024
5eb2542
tryfix: get btc delegation tx hash
RafilxTenfen Nov 26, 2024
28eae57
fix: lint removed unused func
RafilxTenfen Nov 26, 2024
cce90a9
chore: add goroutine to return the cmd request
RafilxTenfen Nov 26, 2024
9f1f0ab
chore: address pr comment and simplified the stking tx migration
RafilxTenfen Nov 27, 2024
d0a1c86
chore: add btc del tx hash to delegation sent to babylon
RafilxTenfen Nov 27, 2024
5e096b1
fix: lint removed unused func
RafilxTenfen Nov 27, 2024
a97cd8c
chore: removed txInclusionHeightFlag flag and getting the block heigh…
RafilxTenfen Nov 28, 2024
0a2eb54
chore: rename BtcDelegationTxHash to BabylonBTCDelegationTxHash
RafilxTenfen Nov 28, 2024
2c7964d
chore: update error msg
RafilxTenfen Nov 28, 2024
325cc3e
fix: lint
RafilxTenfen Nov 28, 2024
f63aab8
chore: add back tx-inclusion-height as optional, if not set queries t…
RafilxTenfen Nov 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: fix comment
RafilxTenfen committed Nov 22, 2024
commit fdc155ef2bad18200d34cb697d8a337f1db13a5b
14 changes: 5 additions & 9 deletions cmd/stakercli/daemon/daemoncommands.go
Original file line number Diff line number Diff line change
@@ -140,10 +140,11 @@ var stakeCmd = cli.Command{
}

var stakeFromPhase1Cmd = cli.Command{
Name: "stake-from-phase1",
ShortName: "stfp1",
Usage: "stakercli stake-from-phase1 [fullpath/to/global_parameters.json]",
Description: "Creates a Babylon BTC delegation transaction from the Phase1 BTC staking tx",
Name: "stake-from-phase1",
ShortName: "stfp1",
Usage: "\nstakercli daemon stake-from-phase1 [fullpath/to/global_parameters.json]" +
" --staking-transaction-hash [txHashHex] --staker-address [btcStakerAddrHex] --tx-inclusion-height [blockHeightTxInclusion]",
Description: "Creates a Babylon BTC delegation transaction from the Phase1 BTC staking transaction",
Flags: []cli.Flag{
cli.StringFlag{
Name: stakingDaemonAddressFlag,
@@ -379,7 +380,6 @@ func stakeFromPhase1TxBTC(ctx *cli.Context) error {
}

sctx := context.Background()

stakingTransactionHash := ctx.String(stakingTransactionHashFlag)
if len(stakingTransactionHash) == 0 {
return errors.New("staking tx hash hex is empty")
@@ -394,10 +394,6 @@ func stakeFromPhase1TxBTC(ctx *cli.Context) error {
return fmt.Errorf("json file input %s does not exist", inputGlobalParamsFilePath)
}

// QUEST: should the params be loaded from the chain?
// maybe it is good to still use the global as input as this is actually
// a phase1 tx being transitioned, so the user would already have the global
// params in hand to create the BTC staking tx
globalParams, err := parser.NewParsedGlobalParamsFromFile(inputGlobalParamsFilePath)
if err != nil {
return fmt.Errorf("error parsing file %s: %w", inputGlobalParamsFilePath, err)
7 changes: 1 addition & 6 deletions itest/e2e_test.go
Original file line number Diff line number Diff line change
@@ -956,13 +956,8 @@ func TestStakeFromPhase1(t *testing.T) {
tm.insertAllMinedBlocksToBabylon(t)
tm.createAndRegisterFinalityProviders(t, testStakingData)

// tmBTC.WalletAddrInfo.
stakerAddrStr := tmBTC.MinerAddr.String()
// stakerAddrStr := tmBTC.WalletPubKey
// stakerAddrStr := btcStakerPkHex
stkTxHash := signedStkTx.TxHash().String()

// miner address and the staker addr are the same guy, maybe not
res, err := tmStakerApp.StakerClient.BtcDelegationFromBtcStakingTx(ctx, stakerAddrStr, stkTxHash, lastParamsVersioned)
require.NoError(t, err)
require.NotNil(t, res)
@@ -978,7 +973,7 @@ func TestStakeFromPhase1(t *testing.T) {
pend, err := tm.BabylonClient.QueryPendingBTCDelegations()
require.NoError(t, err)
require.Len(t, pend, 1)
// need to activate delegation to unbond

tm.insertCovenantSigForDelegation(t, pend[0])
tm.waitForStakingTxState(t, txHash, proto.TransactionState_DELEGATION_ACTIVE)