stacks-network / sbtc-developer-release

sBTC primitives, signer components, helper tools
https://sbtc.tech
MIT License
1.98k stars 23 forks source link

[DR] sBTC deposit transaction not minting sBTC in devenv #220

Closed kenrogers closed 1 year ago

kenrogers commented 1 year ago

Expected Behavior

When running devenv and initiating a deposit using the deposit.sh helper, a mint transaction would be triggered on the stacks chain.

Actual Behavior

The deposit transaction is created and broadcasted successfully to the bitcoin regtest network, but no corresponding mint transaction occurs on the stacks chain.

Steps to Reproduce

  1. Follow setup steps according to devenv README to get containers built and running
  2. Change the mnemonic in config.json to match Devnet deployer address
  3. Deploy contracts using deploy_contracts.sh
  4. Mine 200 BTC with mine_btc.sh 200
  5. Initiate deposit with deposit.sh
  6. Transaction shows in Bitcoin Explorer but no sBTC mint function follows

Screenshots or Videos

On running log.sh sbtc I do see this error after the Stacks chain begins mining blocks

image

Here is a screen share of my process:

https://github.com/stacks-network/sbtc/assets/7418051/0f65b852-be74-47db-a805-7df73d9f29f9

friedger commented 1 year ago

@kenrogers As a work around you can probably call sbtc/down.sh and sbtc/up.sh

It looks like the problem is that the engine expects the the contract to be deployed at startup but the devenv does not deploy the contacts.

Maybe we want to ring back the deployment of the contracts through stbc.

CC @CAGS295

EmbeddedAndroid commented 1 year ago

@kenrogers As a work around you can probably call sbtc/down.sh and sbtc/up.sh

It looks like the problem is that the engine expects the the contract to be deployed at startup but the devenv does not deploy the contacts.

Maybe we want to ring back the deployment of the contracts through stbc.

CC @CAGS295

I'm working on changes to the sbtc container to wait for the stacks blockchain to start, deploy the contracts, and then start romeo.

CAGS295 commented 1 year ago

@EmbeddedAndroid, you may find some overlap in here #215. This is how I do it.

EmbeddedAndroid commented 1 year ago

@EmbeddedAndroid, you may find some overlap in here #215. This is how I do it.

Perfect, this more or less the setup I have in an entrypoint.

One thing I notice is that .cache/requirements/ST1NXBK3K5YYMD6FD41MVNP3JS1GABZ8TRVX023PT.sip-010-trait-ft-standard.clar is not present. I'm currently pulling it from https://raw.githubusercontent.com/hirosystems/heystack/main/contracts/clarinet/sip-10-ft-standard.clar and renaming it. I assume clarinet is the one doing this for us?

kenrogers commented 1 year ago

@friedger @EmbeddedAndroid

Seeing a new error in the logs after trying docker-compose down sbtc followed by docker-compose up -d sbtc

image
CAGS295 commented 1 year ago

@kenrogers, try reproducing the error with #222 applied and tell me what happens. Also, could you share the value used in this step?

Change the mnemonic in config.json to match Devnet deployer address

EmbeddedAndroid commented 1 year ago

@friedger @EmbeddedAndroid

Seeing a new error in the logs after trying docker-compose down sbtc followed by docker-compose up -d sbtc

image

Give this a try https://github.com/stacks-network/sbtc/pull/223 with https://github.com/stacks-network/sbtc/pull/222

I get further now:

2023-10-05T01:14:00.562287Z  INFO update: romeo::state: Processing event=StacksBlock(165)
2023-10-05T01:14:00.562323Z  INFO update: romeo::state: Processing event=MintBroadcasted(DepositInfo { txid: 6e79116d427d99eb4150efcb3457beb9581aa331050772c278d1de91179a077b, amount: 7717, recipient: Standard(StandardPrincipalData(ST2ST2H80NP5C9SPR4ENJ1Z9CDM9PKAJVPYWPQZ50)), block_height: 1127 }, 7ac67b28a1ceacb48876d834dcb4b93302d76b7a342ac464510c2e3a9ad785d1)
2023-10-05T01:14:00.562344Z  INFO update: romeo::state: Processing event=BitcoinBlock(1198)
2023-10-05T01:14:00.562753Z  INFO update: romeo::state: Processing event=StacksBlock(166)
2023-10-05T01:14:00.562787Z  INFO update: romeo::state: Processing event=MintBroadcasted(DepositInfo { txid: ba44ee6866a7232cae0685e4f36ae93e120669f9b4418eb859cf79baba912e49, amount: 5836, recipient: Standard(StandardPrincipalData(ST2ST2H80NP5C9SPR4ENJ1Z9CDM9PKAJVPYWPQZ50)), block_height: 1198 }, b07916a6b51d783293dfd93fdd2d7cf644326da694d5c8e658c55ee7bae4e36d)
2023-10-05T01:14:00.562803Z  INFO update: romeo::state: Processing event=BitcoinBlock(1199)
2023-10-05T01:14:00.563129Z  INFO update: romeo::state: Processing event=StacksBlock(167)
2023-10-05T01:14:00.563161Z  INFO update: romeo::state: Processing event=StacksTransactionUpdate(7ac67b28a1ceacb48876d834dcb4b93302d76b7a342ac464510c2e3a9ad785d1, Confirmed)
thread 'main' panicked at 'Got an Confirmed status update for a Stacks transaction that is not acknowledged: 7ac67b28a1ceacb48876d834dcb4b93302d76b7a342ac464510c2e3a9ad785d1', romeo/src/state.rs:297:29
stack backtrace:
   0: rust_begin_unwind
             at ./rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at ./rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/panicking.rs:67:14
   2: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
   3: <core::iter::adapters::chain::Chain<A,B> as core::iter::traits::iterator::Iterator>::fold
   4: romeo::state::State::update
   5: tokio::runtime::park::CachedParkThread::block_on
   6: tokio::runtime::context::runtime::enter_runtime
   7: tokio::runtime::runtime::Runtime::block_on
   8: romeo::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

mint

friedger commented 1 year ago

@EmbeddedAndroid for the contract deployment, we could bring back this function to the engine.

The engine could check whether the contract exists and if not deploy it. What do you think? We have the code in the git history.

friedger commented 1 year ago

Actually, the deploy script is much better suitable.

janniks commented 1 year ago

Could the contract deploy be a part of the docker-compose up? Is that what you mean by bringing it to the engine?

kenrogers commented 1 year ago

Success 🙌🏻

image
EmbeddedAndroid commented 1 year ago

Could the contract deploy be a part of the docker-compose up? Is that what you mean by bringing it to the engine?

Yup, I'll work on this today.

friedger commented 1 year ago

Closing this as the mint works on devnet. The deployment is handled in #231