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

Issues submitting proposal with less than 7.46 BSQ available #2613

Closed
devinbileck opened this issue Apr 2, 2019 · 9 comments · Fixed by #2614
Closed

Issues submitting proposal with less than 7.46 BSQ available #2613

devinbileck opened this issue Apr 2, 2019 · 9 comments · Fixed by #2614
Assignees

Comments

@devinbileck
Copy link
Member

When attempting to create a compensation request with exactly 2 BSQ in my wallet, the compensation request is submitted without error but upon generating the next block, the transaction gets marked as invalid.

To reproduce, using regtest, I sent 10 BSQ to a new wallet and then sent 8 back so I had only 2 BSQ (to work around the minimum dust limit). I then submitted a compensation request.

The following was in the log:

Apr-01 16:44:07.123 [JavaFX Application Thread] WARN  b.c.dao.node.parser.TxParser: Invalid Tx: No BSQ output found. tx=TempTx{
     txOutputs=[TempTxOutput{
     txOutputType=BTC_OUTPUT
     lockTime=-1
     unlockBlockHeight=0
} BaseTxOutput{
     index=0,
     value=1000,
     txId='0eed3395ce51eee07826e818b1a4c761b453ed483aae017605bd2941cff7dcf8',
     pubKeyScript=PubKeyScript(reqSigs=1, scriptType=ScriptType(name=pubkeyhash), addresses=[mtM79NKccjqdeBzf33DTcrUBuU2XEhW6LB], asm=OP_DUP OP_HASH160 8cbcdd06e41c7ec8561ed9262f30296d457e3e12 OP_EQUALVERIFY OP_CHECKSIG, hex=76a9148cbcdd06e41c7ec8561ed9262f30296d457e3e1288ac),
     address='mtM79NKccjqdeBzf33DTcrUBuU2XEhW6LB',
     opReturnData=null,
     blockHeight=203
}, TempTxOutput{
     txOutputType=ISSUANCE_CANDIDATE_OUTPUT
     lockTime=-1
     unlockBlockHeight=0
} BaseTxOutput{
     index=1,
     value=498292580,
     txId='0eed3395ce51eee07826e818b1a4c761b453ed483aae017605bd2941cff7dcf8',
     pubKeyScript=PubKeyScript(reqSigs=1, scriptType=ScriptType(name=pubkeyhash), addresses=[mtdD2NhgH6NNKQmZfyihnHdcfwJEQ8S6Xm], asm=OP_DUP OP_HASH160 8fc86d3a47d87e20846765e1d8f6409fed3c01df OP_EQUALVERIFY OP_CHECKSIG, hex=76a9148fc86d3a47d87e20846765e1d8f6409fed3c01df88ac),
     address='mtdD2NhgH6NNKQmZfyihnHdcfwJEQ8S6Xm',
     opReturnData=null,
     blockHeight=203
}, TempTxOutput{
     txOutputType=COMP_REQ_OP_RETURN_OUTPUT
     lockTime=-1
     unlockBlockHeight=0
} BaseTxOutput{
     index=2,
     value=0,
     txId='0eed3395ce51eee07826e818b1a4c761b453ed483aae017605bd2941cff7dcf8',
     pubKeyScript=PubKeyScript(reqSigs=0, scriptType=ScriptType(name=nulldata), addresses=null, asm=OP_RETURN 11010d68edb60b1bcc630be3ae81a49b7e6eb14d0b92, hex=6a1611010d68edb60b1bcc630be3ae81a49b7e6eb14d0b92),
     address='null',
     opReturnData=11010d68edb60b1bcc630be3ae81a49b7e6eb14d0b92,
     blockHeight=203
}],
     txType=COMPENSATION_REQUEST,
     burntBsq=200
} BaseTx{
     txVersion='1',
     id='0eed3395ce51eee07826e818b1a4c761b453ed483aae017605bd2941cff7dcf8',
     blockHeight=203,
     blockHash='323c40bcdb6d265faa19ff57f6010e6d3f329d920cb5da8dc4059f95b80dec71',
     time=1554162246000,
     txInputs=[TxInput{
     connectedTxOutputTxId='d6302c8070efe702ea0ce4c887962cec28ae9355a4f3dc4a493f056f98a85cdc',
     connectedTxOutputIndex=1,
     pubKey=03a120cfe6fe3bee9ec924c9350fdc58ab31553bc51a05701ea47391a3b1b354eb
}, TxInput{
     connectedTxOutputTxId='d6302c8070efe702ea0ce4c887962cec28ae9355a4f3dc4a493f056f98a85cdc',
     connectedTxOutputIndex=2,
     pubKey=03f3e1e4480d27d0f651c4a6fbdfbf321b26f7c4edf55d1836b1b8ca211caa9af9
}]
} 
Apr-01 16:44:07.123 [JavaFX Application Thread] WARN  b.c.dao.node.parser.TxParser: We have destroyed BSQ because of an invalid tx. Burned BSQ=2.0. tx=TempTx{
     txOutputs=[TempTxOutput{
     txOutputType=BTC_OUTPUT
     lockTime=-1
     unlockBlockHeight=0
} BaseTxOutput{
     index=0,
     value=1000,
     txId='0eed3395ce51eee07826e818b1a4c761b453ed483aae017605bd2941cff7dcf8',
     pubKeyScript=PubKeyScript(reqSigs=1, scriptType=ScriptType(name=pubkeyhash), addresses=[mtM79NKccjqdeBzf33DTcrUBuU2XEhW6LB], asm=OP_DUP OP_HASH160 8cbcdd06e41c7ec8561ed9262f30296d457e3e12 OP_EQUALVERIFY OP_CHECKSIG, hex=76a9148cbcdd06e41c7ec8561ed9262f30296d457e3e1288ac),
     address='mtM79NKccjqdeBzf33DTcrUBuU2XEhW6LB',
     opReturnData=null,
     blockHeight=203
}, TempTxOutput{
     txOutputType=ISSUANCE_CANDIDATE_OUTPUT
     lockTime=-1
     unlockBlockHeight=0
} BaseTxOutput{
     index=1,
     value=498292580,
     txId='0eed3395ce51eee07826e818b1a4c761b453ed483aae017605bd2941cff7dcf8',
     pubKeyScript=PubKeyScript(reqSigs=1, scriptType=ScriptType(name=pubkeyhash), addresses=[mtdD2NhgH6NNKQmZfyihnHdcfwJEQ8S6Xm], asm=OP_DUP OP_HASH160 8fc86d3a47d87e20846765e1d8f6409fed3c01df OP_EQUALVERIFY OP_CHECKSIG, hex=76a9148fc86d3a47d87e20846765e1d8f6409fed3c01df88ac),
     address='mtdD2NhgH6NNKQmZfyihnHdcfwJEQ8S6Xm',
     opReturnData=null,
     blockHeight=203
}, TempTxOutput{
     txOutputType=COMP_REQ_OP_RETURN_OUTPUT
     lockTime=-1
     unlockBlockHeight=0
} BaseTxOutput{
     index=2,
     value=0,
     txId='0eed3395ce51eee07826e818b1a4c761b453ed483aae017605bd2941cff7dcf8',
     pubKeyScript=PubKeyScript(reqSigs=0, scriptType=ScriptType(name=nulldata), addresses=null, asm=OP_RETURN 11010d68edb60b1bcc630be3ae81a49b7e6eb14d0b92, hex=6a1611010d68edb60b1bcc630be3ae81a49b7e6eb14d0b92),
     address='null',
     opReturnData=11010d68edb60b1bcc630be3ae81a49b7e6eb14d0b92,
     blockHeight=203
}],
     txType=INVALID,
     burntBsq=200
} BaseTx{
     txVersion='1',
     id='0eed3395ce51eee07826e818b1a4c761b453ed483aae017605bd2941cff7dcf8',
     blockHeight=203,
     blockHash='323c40bcdb6d265faa19ff57f6010e6d3f329d920cb5da8dc4059f95b80dec71',
     time=1554162246000,
     txInputs=[TxInput{
     connectedTxOutputTxId='d6302c8070efe702ea0ce4c887962cec28ae9355a4f3dc4a493f056f98a85cdc',
     connectedTxOutputIndex=1,
     pubKey=03a120cfe6fe3bee9ec924c9350fdc58ab31553bc51a05701ea47391a3b1b354eb
}, TxInput{
     connectedTxOutputTxId='d6302c8070efe702ea0ce4c887962cec28ae9355a4f3dc4a493f056f98a85cdc',
     connectedTxOutputIndex=2,
     pubKey=03f3e1e4480d27d0f651c4a6fbdfbf321b26f7c4edf55d1836b1b8ca211caa9af9
}]
} 
Apr-01 16:44:07.123 [JavaFX Application Thread] INFO  b.c.dao.state.DaoStateService: Parse block completed: Block height 203, 1 BSQ transactions. 
Apr-01 16:44:07.130 [JavaFX Application Thread] ERROR b.c.d.g.p.ProposalValidator: TxType is not a COMPENSATION_REQUEST. proposal.getTxId()=0eed3395ce51eee07826e818b1a4c761b453ed483aae017605bd2941cff7dcf8 
Apr-01 16:44:07.130 [JavaFX Application Thread] ERROR b.c.d.g.p.ProposalValidator: TxType is not a COMPENSATION_REQUEST. proposal.getTxId()=0eed3395ce51eee07826e818b1a4c761b453ed483aae017605bd2941cff7dcf8 

I then repeated the process of transferring BSQ to ensure I only had exactly 3 BSQ and this time I was unable to submit the compensation request:
image

Apr-01 16:49:07.191 [JavaFX Application Thread] ERROR b.d.m.d.g.m.MakeProposalView: java.lang.IllegalArgumentException: We must not get dust output here. 
java.lang.IllegalArgumentException: We must not get dust output here.
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:122)
	at bisq.core.btc.wallet.BsqWalletService.addInputsAndChangeOutputForTx(BsqWalletService.java:554)
	at bisq.core.btc.wallet.BsqWalletService.getPreparedBurnFeeTx(BsqWalletService.java:534)
	at bisq.core.btc.wallet.BsqWalletService.getPreparedProposalTx(BsqWalletService.java:528)
	at bisq.core.dao.governance.proposal.BaseProposalFactory.createTransaction(BaseProposalFactory.java:90)
	at bisq.core.dao.governance.proposal.BaseProposalFactory.createProposalWithTransaction(BaseProposalFactory.java:76)
	at bisq.core.dao.governance.proposal.compensation.CompensationProposalFactory.createProposalWithTransaction(CompensationProposalFactory.java:73)
	at bisq.core.dao.DaoFacade.getCompensationProposalWithTransaction(DaoFacade.java:241)
	at bisq.desktop.main.dao.governance.make.MakeProposalView.getProposalWithTransaction(MakeProposalView.java:379)
	at bisq.desktop.main.dao.governance.make.MakeProposalView.publishMyProposal(MakeProposalView.java:275)
	at bisq.desktop.main.dao.governance.make.MakeProposalView.lambda$setMakeProposalButtonHandler$6(MakeProposalView.java:479)
	at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
	at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
	at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
	at javafx.graphics/javafx.scene.Node.fireEvent(Node.java:8865)
	at javafx.controls/javafx.scene.control.Button.fire(Button.java:200)
	at javafx.controls/com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:206)
	at javafx.controls/com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274)
	at javafx.base/com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
	at javafx.base/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
	at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
	at javafx.base/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at javafx.base/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at javafx.base/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at javafx.base/com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at javafx.base/com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.base/javafx.event.Event.fireEvent(Event.java:198)
	at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3876)
	at javafx.graphics/javafx.scene.Scene$MouseHandler.access$1300(Scene.java:3604)
	at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1874)
	at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2613)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:397)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:434)
	at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
	at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:433)
	at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:556)
	at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:942)
	at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:175)
	at java.base/java.lang.Thread.run(Thread.java:844)

This above error occurred until I had at least 8 (I assume more accurately 7.46) BSQ available at which point submitting a compensation request was successful.

So we need to prevent the invalid transaction in the first case (exactly 2 BSQ), and improve the error in the other case (less than 7.46 BSQ).

@ManfredKarrer
Copy link
Contributor

In case the tx would create a dust output (e.g. 3 BSQQ input - 2 BSQ fee -> 1 BSQ) the tx is not allowed.
The tx should not be created in that case. I will check it...

@ManfredKarrer
Copy link
Contributor

Great thanks btw for finding such non trivial bugs!

@ManfredKarrer
Copy link
Contributor

I could reproduce it but I did not get an invalid tx.

@ManfredKarrer
Copy link
Contributor

I changed the error message to that:
Screen Shot 2019-04-01 at 20 02 28

@ManfredKarrer
Copy link
Contributor

Tried a few times but never got an invalid tx. Can you email me the log file?

ManfredKarrer added a commit that referenced this issue Apr 2, 2019
@ManfredKarrer ManfredKarrer self-assigned this Apr 2, 2019
@ManfredKarrer
Copy link
Contributor

Ah now I see the invalid tx... will check...

@ManfredKarrer
Copy link
Contributor

Ah the invalid tx happens when it was exactly 2 BSQ! Good find that would have been a critical bug!

ManfredKarrer added a commit to ManfredKarrer/bisq that referenced this issue Apr 2, 2019
Fixes bisq-network#2613

If the user has the exact fee in his wallet no BSQ change output would
be created but that violates our requirement for compensation or
reimbursement txs.
Beside that the error message for dust outputs was not clear.
@ManfredKarrer
Copy link
Contributor

@devinbileck I think that finding justifies a bug bounty payment. I would estimate it with 1000 BSQ.

@ghost
Copy link

ghost commented Apr 2, 2019

We could create a bug trophy hall somewhere, with the advertised bounties.
To motivate the hunters. ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants