stacks-network / sbtc

Repo containing sbtc
GNU General Public License v3.0
276 stars 6 forks source link

[Feature]: `get_withdrawal_requests` always returns an empty vector #524

Open technovision99 opened 1 month ago

technovision99 commented 1 month ago

(Medium) - get_withdrawal_requests always returns an empty vector

1. Description

Whenever a bitcoin block gets polled from the client and then written to storage the write_bitcoin_block function is called with empty block confirmations: https://github.com/stacks-network/sbtc/blob/033e2cbd2def829a3e30df77bc274b325d68cdbe/signer/src/block_observer.rs#L258-L268
Then when the signer attempts to get any pending withdrawal requests, they call the get_pending_withdrawal_request function: https://github.com/stacks-network/sbtc/blob/ffbe79e0238825f3546e9429bbf89042703823df/signer/src/transaction_signer.rs#L566-L574 Which ultimately calls the associated function in the storage: https://github.com/stacks-network/sbtc/blob/ffbe79e0238825f3546e9429bbf89042703823df/signer/src/storage/in_memory.rs#L263-L285 In get_stacks_chain_tip the function will iterate through all the block's confirmations: https://github.com/stacks-network/sbtc/blob/ffbe79e0238825f3546e9429bbf89042703823df/signer/src/storage/in_memory.rs#L134-L149 These confirmations, as stated before, are an empty vector. Thus the function will always return an empty iterator and withdrawals will never be processed. The block confirmations should be updated to properly reflect stacks blocks that have been confirmed on the burnchain.

This issue is mainly just for tracking, as this is most likely WIP

djordon commented 1 month ago

🙏🏽 thank you! yeah this code is still in flight, but it's great that this issue was opened since I do not think we had one for it.