-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Error in validating transition seals #55
Comments
Hi @dr-orlovsky, Currently, I think we need an extra step on the Today, the first transfer retrieves the information from This is one way to change WitnessTx to prev_out txid and pass in validation. |
It is not; it is just not validated, opening a vector for double-spending attack. This step should work since it has to take The question remains though why the validation still fails not finding the input. Can you add |
Yes, yes, I know! I commented on this snippet to make sure there not were other issues. =)
In general, only genesis BTW, I will provide this information to you ASAP. |
Not seal, witness structure is the one which has txid always. When a seal without txid happens it means that a txid from the anchor must be used - and that txid is transferred through |
Hi @dr-orlovsky, Added a
|
Right... Very interesting. The first transfer creates witness transaction spending Now, the second transfer tries to transfer assets not from that newly created assignment - but from Unsuprisingly the validation fails. Good news: validation works as expected and doesn't allow bullshit to pass. I.e. this is an application-level bullshit, not consensus-level, i.e. the issue is in Can you pls provide details about how this transfers were created? Can I expect transactions with that IDs? Are they in testnet or your regtest? |
@crisdut I need more information from you here:
You can also check the explanation of the problem I have given above. Right now it is not clear to me how to process with the issue without understanding how these tx ids are produced and what is in the actual transactions. |
Hi @dr-orlovsky, I tested in Regtest. My tests consist of issuing a contract with five amounts and trying to send it to the beneficiary in two parts, 1 per invoice.
I generate the second PSBT (transaction) from the change UTXO, using the "change" derivation path /1/0 + tweak (Tapret commitment). Because of this, the prev_out of the |
Hi @dr-orlovsky, Some updates: I think I found the issue with consecutive transfers. When we create a transfer in RGB, the bundle is add to the consignment file with BlindSeal->Txid set to WitnessTx. The problem is that if the transition has a change assets, the rgb-wallet does not relate the TxId of the transfer with the BlindSeal of change. So when the user tries to spend this change, the system returns the In this case, the bundle should be correctly updated in the transfer creation step. In this way, the acceptance stage would remain only to update the status of the contract. PS: I managed to make a transfer with the change, but I was updating the bundles in the acceptance step and not in the transfer. Tomorrow I will try to do the operations in the transfer step. |
Sorry, I am failing to parse what you are saying...
What do you mean by "relate"? Wallet doesn't do that relations at all...
This error is generated not when we are trying to spend the change, but when we verify the spend.
Correctly updated to what? |
Ok, sure, I will try to clarify. I believe that the problem of not being able to make asset transactions using the change from the previous asset transaction is related to the lack of information on the bundles. I will separate my explanation into two parts: On the side of who creates the transaction (aka. owner) and on the beneficiary side. In the current version of rgb-wallet, when an asset transaction is created and accepted, the beneficiary can use the received asset because, in the accept step, we use the secret seal to reveal the content of the bundles. However, on the owner's side, we cannot use the change asset from the previous state transition because when we validate the consignment file, the system returns Yesterday I added one more step in the accept process, which allowed updating the owner's bundle containing the transaction information performed in L1. I managed to spend the owner's change after that. But in the case of changing the owner, the bundle update should be in the transfer step itself in this piece of code. Is it clearer now? |
Why would the owner have a need to use the output belonging to the receiver?
Still struggling, especially with this part due to a non-standard terminology: What do you mean by transaction? Bitcoin witness transaction? State transition? Consignment? It looks like you are talking about consignment since the transaction can't be "accepted" - it is a property of the consignment. But why would the creator of the transfer consignment need to accept it? Can't compile |
To update the owner contract state in stock/inventory.
I updated the content. I hope this help.
Anyway, I'll try to solve it, too, as mentioned above. I think we can talk better using Rust 😆😆😆😆 |
The sender should not accept the consignment it creates: it must be a no-op. All the data are already put to the stash when the consignment was created. |
Ok, I have finally out figured this out. Highly untrivial bug. It is caused by the fact that the validator needs to know a witness_txid for each of the inputs of the current state transition - which is different from the witness_txid for the current state transition. The code itself was providing the validator with the current one, not the previous one. This resulted that WitnessVout seals resolving to invalid txid and didn't pass the validation. Bugfix required changes to both BP Core and RGB Core. Here are the PRs: |
WOW, really? I had noticed this difference between the TxID that was provided by the seals, sometimes the witness TxId, sometimes the current Txid. I thought the problem lay in some bad construction of the transitions in the transfer step. Unfortunately I didn't have time to dig deeper and find this, but I'm glad you did. I will test ASAP and update you! Thanks! |
Yes, these multiple txid are really confusing and I was hunting them down for a week. |
I've tried to patch the dependencies but I'm encountering the following error:
|
@zoedberg it can be I forget to push from the other machine. Will be able to check bit later |
@dr-orlovsky I've seen you force pushed the PRs, now code compiles but some send tests that previously worked are now failing with:
Call throwing the error seems to be: let transfer = bindle
.unbindle()
.validate(runtime.resolver())
.unwrap_or_else(|c| c); |
@zoedberg I added this exception to see if the logic is invalid. And it seems to be invalid.
|
Ok, I have understood in which assumption I was wrong. Pushed to both repos. Also the footprint of the fix now is minimal. Can you pls check now? |
@dr-orlovsky Send tests that stopped working with the last update are now working again. While the send test that I think is related to this issue is still failing. To add more info, the test does the following:
|
I have tried the updated code in our regtest sandbox, which uses rgb-contracts (with patched dependencies and a quick fix to have a working issuance). What I do to check for this issue is:
This way I check that the issuer is able to spend the change allocation, which is created via At the moment, step 4 fails when I call
Looking at consignment validation from step 3 I see the following warnings:
I'm using rgb-contracts with the following patched dependencies and respective commits:
|
@nicbus this looks like a different bug from the originally reported in thus issue, isn't it? I mean can I merge the PR fixing this issue and can you open a new one with this problem? ("Anchor absent in the index") |
I'll open a new issue about the warning, but I'm not sure the The reason for this is that I'm seeing the |
It could be unrelated, so probably a dedicated issue is desirable. Can you also attach a stash which fails in the test? |
@nicbus btw do you confirm that this issue is closed and the bugfix works? |
I confirm I don't see the original validation error |
Hi @dr-orlovsky,
I continued the consecutive transfer test and found strange behavior at this step.
The condition is only valid on the first transfer. In subsequent transfers, the outpoint of the seal is always None, causing the
VerifyError::WitnessNotClosingSeal
. This error occurs because the seal outpoints always None after the first transfer.For Example, the in the list below, the first
blindseal
causesVerifyError::WitnessNotClosingSeal
:If we comment the step, the consignment is validated correctly.
The text was updated successfully, but these errors were encountered: