clarinet icon indicating copy to clipboard operation
clarinet copied to clipboard

Clarinet Devnet Fails to produce Stacks blocks after Bitcoin RPC call

Open BowTiedBlox opened this issue 1 year ago • 6 comments

Describe the bug After unloading the default wallet, in order to change it to a custom one, the clarinet devnet environment stops producing Stacks blocks.

To Reproduce Steps to reproduce the behavior:

  1. Create a Clarinet project with a basic smart contract
clarinet new bugBitcoinClarinet
cd bugBitcoinClarinet
clarinet contract new example
clarinet devnet start
  1. After the smart contracts are deployed (or wait more blocks, will have same outcome), go to http://localhost:8001/rpc-terminal
  2. Write unloadwallet "" and click Send
  3. Optional as the outcome is the same: create another bitcoin wallet createwallet wall and add addresses getnewaddress walladdr

Expected behavior After doing this I would expect Stacks blocks to be mined same as before.

Screenshots image

Environment (please complete the following information):

  • OS (version): Version 14.2.1 (23C71) - Sonoma
  • Docker version 25.0.3, build 4debf41
  • Clarinet version: 2.3.1

Additional context Add any other context about the problem here:

BowTiedBlox avatar Mar 19 '24 12:03 BowTiedBlox

Thanks for reporting @BowTiedBlox. I'll look into it. Could you check in the stacks-node containers if you see any warning or error logs?

Also, I'm unfamiliar with the unloadwallet command, for my own knowledge, could you explain your use case / what you are trying to achieve?

hugoclrd avatar Mar 19 '24 14:03 hugoclrd

unloadwallet is to remove the default "" wallet which doesn't support some adding addresses wanted as that wallet doesn't support them. In this context, I wanted to add the Bitcoin address for the decentralized-stacking-pool to the wallet so I could see the transactions related to it. As it didn't work, as it stopped submitting the Stacks blocks, I got to look manually in transactions for that address.

I can see the need for this for stacks-bitcoin related flows such as using given addresses and generatetoaddress x blocks and going from there with mining/signing.

I've run it and looked for errors

With unloadwallet it says warning: no UTXOs found, but after creating another wallet and using getnewaddress name_address it is saying "mined anchored block" which is quite strange as it doesn't mine the block or at least clarinet doesn't detect it.

Part of the log for context:

244202e7567042e44ee, event_type: success
2024-03-19 16:19:40 Mar 19 14:19:40.525424 INFO Miner: mined anchored block 02ec794197295dd62d168baf33a212fa7d7eb60bfc5af2f18bbcf7c1fab0d439 height 18 with 1 txs, parent block f4604c86001614c0a303514c0ae7f612b41bedd303d9131af95fee8b040d781c, parent microblock 0000000000000000000000000000000000000000000000000000000000000000 (0), state root = 2d9eab0dd7ea45826d5b43a3b085178954919da82a09f7f46baf6a5b8b99b6be
2024-03-19 16:19:40 Mar 19 14:19:40.526126 INFO Miner: mined anchored block, block_hash: 02ec794197295dd62d168baf33a212fa7d7eb60bfc5af2f18bbcf7c1fab0d439, height: 18, tx_count: 1, parent_stacks_block_hash: f4604c86001614c0a303514c0ae7f612b41bedd303d9131af95fee8b040d781c, parent_stacks_microblock: 0000000000000000000000000000000000000000000000000000000000000000, parent_stacks_microblock_seq: 0, block_size: 417, execution_consumed: {"runtime": 0, "write_len": 0, "write_cnt": 0, "read_len": 0, "read_cnt": 0}, %-full: 0, assembly_time_ms: 5, tx_fees_microstacks: 0
2024-03-19 16:19:40 Mar 19 14:19:40.526445 INFO Relayer: Succeeded assembling Stacks block #18: 02ec794197295dd62d168baf33a212fa7d7eb60bfc5af2f18bbcf7c1fab0d439, with 1 txs, attempt 1
2024-03-19 16:19:41 Mar 19 14:19:41.573562 WARN Relayer: Failed to submit Bitcoin transaction
2024-03-19 16:19:41 Mar 19 14:19:41.588105 INFO Include tx, tx: ed030524d9821c15e53f26007d05717575f2b1fa1a96d244202e7567042e44ee, payload: Coinbase, origin: ST3Q96TFVE6E0Q91XVX6S8RWAJW5R8XTZ8YEBM8RQ
2024-03-19 16:19:41 Mar 19 14:19:41.588139 INFO Tx successfully processed., event_name: transaction_result, tx_id: ed030524d9821c15e53f26007d05717575f2b1fa1a96d244202e7567042e44ee, event_type: success
2024-03-19 16:19:41 Mar 19 14:19:41.588987 INFO Miner: mined anchored block 02ec794197295dd62d168baf33a212fa7d7eb60bfc5af2f18bbcf7c1fab0d439 height 18 with 1 txs, parent block f4604c86001614c0a303514c0ae7f612b41bedd303d9131af95fee8b040d781c, parent microblock 000000000000000000000000000000000000000000000000000

BowTiedBlox avatar Mar 19 '24 14:03 BowTiedBlox

@BowTiedBlox I'm able to reproduce. It seems like it's struggling to submit the block. I need to investigate. Clarinet is probably relying on the default wallet

hugoclrd avatar Mar 19 '24 14:03 hugoclrd

Got it, thank you! Would be very useful for some of our dev flows if it would be possible to change the wallet.

BowTiedBlox avatar Mar 19 '24 14:03 BowTiedBlox

Got it, thank you! Would be very useful for some of our dev flows if it would be possible to change the wallet.

@BowTiedBlox: Thanks for the thorough report; beautiful, we appreciate you! Could you also expand on why having a different wallet would be useful for your workflow? I am curious about your use case(s).

sabbyanandan avatar Mar 19 '24 15:03 sabbyanandan

Hey @BowTiedBlox Is it still relevant for you? I think it's currently normal that clarinet doesn't operate properly if you remove the default wallet. I think it would help if you could add more context about what you are trying to achieve in the original post

hugoclrd avatar Jul 01 '24 15:07 hugoclrd

Closing this due to inactivity. Please reopen if this is still needed.

smcclellan avatar Jul 23 '24 15:07 smcclellan