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: btc-staker improvement(#107) - remove watch staking and post-approval logic #131

Conversation

wnjoon
Copy link
Contributor

@wnjoon wnjoon commented Feb 10, 2025

This PR includes the removal of the watch-staking endpoint and the post-approval logic as part of issue #107 .

Delete watch-staking endpoint

  • Removed related RPC call paths and functions
  • Eliminated the watchTxData field and related logic in stakingRequestCmd
  • Removed database fields and query/update logic related to watched transactions
  • Modified message fields accordingly
  • Cleaned up functions that previously had a single execution branch after deleting watched (e.g., buildOwnDelegation)
  • Removed test codes related to watch-staking

As a result, calling watch_staking_tx RPC will output the following:

# Run stakerd, babylon, and bitcoind binaries by referring to the contents of README.md. 
# The following shows the log of stakerd.
$ ./stakerd
time="2025-01-31T20:06:59+09:00" level=info msg="Starting App"
time="2025-01-31T20:06:59+09:00" level=info msg="Connecting to node backend: bitcoind"
time="2025-01-31T20:06:59+09:00" level=info msg="Successfully started Prometheus metrics server at 127.0.0.1:2112"
time="2025-01-31T20:06:59+09:00" level=info msg="Successfully connected to node backend: bitcoind"
time="2025-01-31T20:06:59+09:00" level=info msg="Initial btc best block height is: 233384"
time="2025-01-31T20:06:59+09:00" level=info msg="App started"
time="2025-01-31T20:06:59+09:00" level=info msg="Staker Service fully started"
time="2025-01-31T20:06:59+09:00" level=info msg="I[2025-01-31|20:06:59.435] serve                                        msg=\"Starting RPC HTTP server on 127.0.0.1:15812\""

# Call watch_staking_tx RPC
$ curl -X POST -H "Content-Type: application/json" http://127.0.0.1:15812 -d '{"jsonrpc":"2.0","id":1,"method":"watch_staking_tx","params":["","1000","100000000","",[],"","","","","","","","","1000","1"]}'

# Message "Method not found" is returned
{"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"Method not found"}}

Remove post-approval flow

  • Removed the sendToBabylonFirst option while staking and its related codes
  • Removed the delegationActivatedPostApprovalEvent and its related codes and channel
  • Removed the handlePostApprovalCmd function and simplifying call hierarchy
  • Removed delegationActive field in unbondingTxSignaturesConfirmedOnBabylonEvent
  • Removed usePreApprovalFlow field in stakingRequestCmd
  • Removed post-approval-related channels and events, and simplified the checkTransactionsStatus function.
  • Modified e2e tests that used post-approval logic to use pre-approval logic.

This PR also includes changes to update the tests added to the main branch to use the pre-approval method.

@wnjoon wnjoon marked this pull request as ready for review February 10, 2025 08:37
@KonradStaniec
Copy link
Collaborator

KonradStaniec commented Feb 10, 2025

hey @wnjoon , given this is part of the changes, lets change the base to feature branch and only merge to main after having everything finished.

I have created feature branch for this purpose feat/b-harvest-improve-btc-staker

@wnjoon wnjoon changed the base branch from main to feat/b-harvest-improve-btc-staker February 10, 2025 09:45
@wnjoon wnjoon closed this Feb 11, 2025
@wnjoon
Copy link
Contributor Author

wnjoon commented Feb 11, 2025

This PR will be merged into the feat/b-harvest-improve-btc-staker branch and then created as a new PR including the removal of local-db state.

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.

2 participants