BitShares Forum

Main => General Discussion => Topic started by: inarizushi on March 20, 2015, 01:38:25 pm

Title: Problem solved !
Post by: inarizushi on March 20, 2015, 01:38:25 pm
As reported here : https://bitsharestalk.org/index.php?topic=15020.msg194798#msg194798 (https://bitsharestalk.org/index.php?topic=15020.msg194798#msg194798), there are some orders that should match that do not.

It appears that shorts cannot be bought unless they have the highest interest rate in the whole short list. No matter the price limit of the short with the highest interest rate. Someone put a 50% interest rate short order on bitBTC at 60000 BTS/bitBTC, and it seems to be impossible to short BTS for a lower interest rate.

I have done only two tests, but I have been unable to buy my own shorts.

This is an absolute emergency.


Problem solved by release 0.8.0, (23rd march) :)
Title: Re: EMERGENCY : the market is broken
Post by: btswildpig on March 20, 2015, 01:53:22 pm
already reported to Github . Several developers have been notified .
Title: Re: EMERGENCY : the market is broken
Post by: inarizushi on March 20, 2015, 02:08:23 pm
already reported to Github . Several developers have been notified .

Great, I hope this will be solved today...
Title: Re: EMERGENCY : the market is broken
Post by: xeroc on March 20, 2015, 02:22:11 pm
already reported to Github . Several developers have been notified .

Great, I hope this will be solved today...
I guess it requires a fork .. so maybe we get it fixed within 48hours .. </wild guess>
Title: Re: EMERGENCY : the market is broken
Post by: botfund on March 20, 2015, 03:17:36 pm
Oh my poor bot.
Title: Re: EMERGENCY : the market is broken
Post by: sudo on March 20, 2015, 03:32:18 pm
test totally in dvs  next time
Title: Re: EMERGENCY : the market is broken
Post by: zerosum on March 20, 2015, 05:30:23 pm

 Very cool *feature!  +5%


* block any market with 1 BTS or less! Me like it!
Title: Re: EMERGENCY : the market is broken
Post by: btswildpig on March 20, 2015, 05:34:24 pm

 Very cool *feature!  +5%


* block any market with 1 BTS or less! Me like it!

 +5% +5%
Title: Re: EMERGENCY : the market is broken
Post by: inarizushi on March 21, 2015, 02:33:28 pm
So... nobody seems to really care. Crazy.
Title: Re: EMERGENCY : the market is broken
Post by: lzr1900 on March 21, 2015, 02:49:43 pm
 +5%
Title: Re: EMERGENCY : the market is broken
Post by: vlight on March 21, 2015, 03:10:16 pm
So... nobody seems to really care. Crazy.
:(
Title: Re: EMERGENCY : the market is broken
Post by: vikram on March 21, 2015, 06:34:05 pm
It turns out this problem has been there for a very long time. We are aware of it and currently working on a solution.
Title: Re: EMERGENCY : the market is broken
Post by: arhag on March 21, 2015, 07:12:48 pm
So... nobody seems to really care. Crazy.

I mean it is a serious bug, but I think "absolute emergency" is an over-exaggeration. The worst case with this bug is that shorts are suspended and anyone who already has a short position is unable to roll over their shorts. So it sucks if you are forced to exit your short position (either by buying BitUSD to cover or by others buying up your expired cover order at the price feed) when you did not intend to, but as far as money-related bugs go this is fairly tame IMO. It isn't as bad as the previous transaction malleability bug that would allow someone to nearly empty out your balance if you transferred a small fraction of your balance to them.
Title: Re: EMERGENCY : the market is broken
Post by: starspirit on March 21, 2015, 07:58:44 pm
Why is it necessary for shorts to compete on both interest and price? If we set the price as always equal to the feed price, wouldn't the interest rate suffice to queue shorts? Then the 50% order would be at the front of the queue and easily get taken out on small volume, and interest would normalise after that.
Title: Re: EMERGENCY : the market is broken
Post by: inarizushi on March 21, 2015, 08:06:51 pm
So... nobody seems to really care. Crazy.

I mean it is a serious bug, but I think "absolute emergency" is an over-exaggeration. The worst case with this bug is that shorts are suspended and anyone who already has a short position is unable to roll over their shorts. So it sucks if you are forced to exit your short position (either by buying BitUSD to cover or by others buying up your expired cover order at the price feed) when you did not intend to, but as far as money-related bugs go this is fairly tame IMO. It isn't as bad as the previous transaction malleability bug that would allow someone to nearly empty out your balance if you transferred a small fraction of your balance to them.

"Nobody can short." How is that not an absolute emergency ? If nobody took advantage of the bug until now, that's fine, but now, it's over. Nobody can short. When shorters will have to cover, they will have to buy at the price someone is willing to sell, or lose the 10%. I don't understand how the market peg can hold.
Title: Re: EMERGENCY : the market is broken
Post by: arhag on March 21, 2015, 08:40:03 pm
"Nobody can short." How is that not an absolute emergency ? If nobody took advantage of the bug until now, that's fine, but now, it's over. Nobody can short. When shorters will have to cover, they will have to buy at the price someone is willing to sell, or lose the 10%. I don't understand how the market peg can hold.

I'm just saying it's a matter of perspective. It is a serious bug that should be fixed as soon as possible. But shorts not working and even the market peg breaking is not as bad as actually having your funds stolen.

Are we sure that the expired cover orders will buy up to 10% higher than the BTS/BitAsset price feed or not? I haven't seen a conclusive answer to this. But if it is true, I wonder if shorts and forced covers can be temporarily shut down by the delegates not publishing price feeds? If so, I think it would make sense to do that to buy shorts time until this bug is fixed.

Or actually, the delegates could offset the price feeds by 10% so that the expired cover order is limited to the real price feed. The call price being at a slightly lower BTS/BitAsset price temporarily is not a big deal, and shorts can't short now anyway.
Title: Re: EMERGENCY : the market is broken
Post by: arhag on March 21, 2015, 08:51:57 pm
Why is it necessary for shorts to compete on both interest and price? If we set the price as always equal to the feed price, wouldn't the interest rate suffice to queue shorts? Then the 50% order would be at the front of the queue and easily get taken out on small volume, and interest would normalise after that.

If you force shorts to always short at the feed price, then in a bear market they will self-short and just sell the BitUSD at a higher BTS/BitAsset price in the free BitUSD : BTS market. Allowing shorts to match above the price feed just takes this two-step process and makes it a one-step process for the shorts.

The BitAsset design isn't flawed. This is simply a bug in the implementation of the design. And that bug should be fixed as soon as possible. Let's not pretend this is some flaw in the design that requires us to rethink the whole thing. It is just an unfortunate coding mistake.
Title: Re: EMERGENCY : the market is broken
Post by: inarizushi on March 21, 2015, 09:41:28 pm
"Nobody can short." How is that not an absolute emergency ? If nobody took advantage of the bug until now, that's fine, but now, it's over. Nobody can short. When shorters will have to cover, they will have to buy at the price someone is willing to sell, or lose the 10%. I don't understand how the market peg can hold.

I'm just saying it's a matter of perspective. It is a serious bug that should be fixed as soon as possible. But shorts not working and even the market peg breaking is not as bad as actually having your funds stolen.

Are we sure that the expired cover orders will buy up to 10% higher than the BTS/BitAsset price feed or not? I haven't seen a conclusive answer to this. But if it is true, I wonder if shorts and forced covers can be temporarily shut down by the delegates not publishing price feeds? If so, I think it would make sense to do that to buy shorts time until this bug is fixed.

Or actually, the delegates could offset the price feeds by 10% so that the expired cover order is limited to the real price feed. The call price being at a slightly lower BTS/BitAsset price temporarily is not a big deal, and shorts can't short now anyway.

I remember having seen some people that were upset that they had to pay the 10% increase when their shorts ended, maybe just last week or 2 weeks ago. Maybe, hopefully, it changed in 0.7.
Obviously, stolen funds is way worse (I didn't know there was such a bug). But losing money because of some coding error that is not taken seriously is also quite infuriating, and all shorters are at risk.
Title: Re: EMERGENCY : the market is broken
Post by: vikram on March 21, 2015, 09:47:08 pm
I remember having seen some people that were upset that they had to pay the 10% increase when their shorts ended, maybe just last week or 2 weeks ago. Maybe, hopefully, it changed in 0.7.
Obviously, stolen funds is way worse (I didn't know there was such a bug). But losing money because of some coding error that is not taken seriously is also quite infuriating, and all shorters are at risk.

We are taking the problem very seriously. It takes some time to develop a patch for the live market. We need to be careful that we do not introduce other bad issues, which has happened in the past with emergency fixes. We will have it fixed as soon as we can.
Title: Re: EMERGENCY : the market is broken
Post by: Markus on March 22, 2015, 01:10:18 am
I am slightly shocked how much the developers ignore the severity of this bug.

The asset market is BitShares' most important feature. If we were only to worry about funds not being stolen we could just stay with Bitcoin, right?

With shorting broken and the 10% penalty for expiry still in place (is it?) this will dry up the asset market, break the peg (they will be trading at 110% if at all) and piss off those few who are willing to still short in this bear market damaging liquidity for the next weeks/months.

If you want a safe quick fix, reduce the 50% max APR to something like 5%. This is one single variable and surely can not break anything else.
Title: Re: EMERGENCY : the market is broken
Post by: arhag on March 22, 2015, 01:42:23 am
I am slightly shocked how much the developers ignore the severity of this bug.

How are they ignoring it?

If you want a safe quick fix, reduce the 50% max APR to something like 5%. This is one single variable and surely can not break anything else.

And what happens if that safe quick fix somehow breaks consensus. There is a process in place now to prevent bigger problems from occurring due to a fix being rushed. The last time a fix was rushed for an even bigger bug, the "fix" ending up forking the blockchain and the real fix required rolling back many hours worth of blocks (thankfully there were apparently no double spend issues). Let's avoid having a situation where the cure is worse than the disease, and follow proper testing procedure.

The devs are taking it seriously, it seems that there is already a patch (https://github.com/BitShares/bitshares/commit/b97f25a47d10715fb5dfff7130c41978d591639a?w=1) being prepared, however these things still need to be properly reviewed and tested before release.

By the way, to the people with shorts expiring in the next few days (which is actually not a lot of money by the way), you do know you can sell your spare BTS (which you should always have if you are shorting) for BTC and then use the BTC to buy BitUSD via an outside exchange or a bridge like metaexchange, and then use the BitUSD to cover the short, right? That does add some fees due to the various spreads, but I bet it is much less than 10%. Just something that might be worth looking into.
Title: Re: EMERGENCY : the market is broken
Post by: starspirit on March 22, 2015, 02:05:42 am
Why is it necessary for shorts to compete on both interest and price? If we set the price as always equal to the feed price, wouldn't the interest rate suffice to queue shorts? Then the 50% order would be at the front of the queue and easily get taken out on small volume, and interest would normalise after that.

If you force shorts to always short at the feed price, then in a bear market they will self-short and just sell the BitUSD at a higher BTS/BitAsset price in the free BitUSD : BTS market. Allowing shorts to match above the price feed just takes this two-step process and makes it a one-step process for the shorts.

The BitAsset design isn't flawed. This is simply a bug in the implementation of the design. And that bug should be fixed as soon as possible. Let's not pretend this is some flaw in the design that requires us to rethink the whole thing. It is just an unfortunate coding mistake.

I'm not claiming its flawed, but maybe you're comment was a general one. In this case I agree with you that it looks like a coding fix. I was merely suggesting that beyond the coding fix, its a useful time to consider whether there is an improved way of handling this aspect of shorts, as we should do from time to time with all aspects of bitAssets.
Title: Re: EMERGENCY : the market is broken
Post by: arhag on March 22, 2015, 02:12:23 am
I'm not claiming its flawed, but maybe you're comment was a general one.

Yeah, sorry, I meant it generally and didn't mean to imply that you are suggesting the current design is flawed.

I was merely suggesting that beyond the quick fix, its a useful time to consider whether there is an improved way of handling this aspect of shorts, as we should do from time to time with all aspects of bitAssets.

By the way, I have some additional thoughts that I will post shortly on your BitCurrency thread. Actually, on second thought, I decided that the various corner cases made the new approach that I was thinking of more complicated for users to understand than our current BitAsset system. So nevermind, I still hold the position that the current BitAsset design is the best I've seen so far.
Title: Re: EMERGENCY : the market is broken
Post by: Markus on March 22, 2015, 02:25:58 am
I am slightly shocked how much the developers ignore the severity of this bug.

How are they ignoring it?

If you want a safe quick fix, reduce the 50% max APR to something like 5%. This is one single variable and surely can not break anything else.

And what happens if that safe quick fix somehow breaks consensus. There is a process in place now to prevent bigger problems from occurring due to a fix being rushed. The last time a fix was rushed for an even bigger bug, the "fix" ending up forking the blockchain and the real fix required rolling back many hours worth of blocks (thankfully there were apparently no double spend issues). Let's avoid having a situation where the cure is worse than the disease, and follow proper testing procedure.

The devs are taking it seriously, it seems that there is already a patch (https://github.com/BitShares/bitshares/commit/b97f25a47d10715fb5dfff7130c41978d591639a?w=1) being prepared, however these things still need to be properly reviewed and tested before release.

By the way, to the people with shorts expiring in the next few days (which is actually not a lot of money by the way), you do know you can sell your spare BTS (which you should always have if you are shorting) for BTC and then use the BTC to buy BitUSD via an outside exchange or a bridge like metaexchange, and then use the BitUSD to cover the short, right? That does add some fees due to the various spreads, but I bet it is much less than 10%. Just something that might be worth looking into.

Sorry for my language, I'm just a bit annoyed at yet another all time low in BTS price.

I realise that any fix will break consensus, that's obvious when a hard fork is needed. What I meant was that what I suggested won't introduce any other bugs.

BTW, the BitGold market is blocked with a 50% order too and there are no suitable bridges/external markets for BitGold. The best external offer is on bter for more than 2x the fair price.
Title: Re: EMERGENCY : the market is broken
Post by: arhag on March 22, 2015, 02:38:16 am
BTW, the BitGold market is blocked with a 50% order too and there are no suitable bridges/external markets for BitGold. The best external offer is on bter for more than 2x the fair price.

Well there is someone selling 0.092 BitGold (actual BitGold not a short) at a price only 1.45% higher than the price feed currently. It may not seem like a lot but the two shorts expiring on March 23 and 24 only owe a total of approximately 0.00255 BitGold. Although, the shorts expiring on March 26 owe more than that 0.092 BitGold, but I think there is a good chance the bug will be fixed before then.
Title: Re: EMERGENCY : the market is broken
Post by: starspirit on March 22, 2015, 04:25:36 am
What's the "10%" is people are referring to? I thought in the current system expiring shorts sit at the price feed if there are no lower asks (i.e. no penalty), and that called shorts can buy as high as 110% (i.e. a 10% penalty)- is that incorrect? Sorry if my understanding is wrong, I've just not seen these confirmed.
Title: Re: EMERGENCY : the market is broken
Post by: dna_gym on March 22, 2015, 06:12:27 am
Why is it necessary for shorts to compete on both interest and price? If we set the price as always equal to the feed price, wouldn't the interest rate suffice to queue shorts? Then the 50% order would be at the front of the queue and easily get taken out on small volume, and interest would normalise after that.

If you force shorts to always short at the feed price, then in a bear market they will self-short and just sell the BitUSD at a higher BTS/BitAsset price in the free BitUSD : BTS market. Allowing shorts to match above the price feed just takes this two-step process and makes it a one-step process for the shorts.

The BitAsset design isn't flawed. This is simply a bug in the implementation of the design. And that bug should be fixed as soon as possible. Let's not pretend this is some flaw in the design that requires us to rethink the whole thing. It is just an unfortunate coding mistake.

If I understand correctly, the above-mentioned self-shorter problem never exists.
The self-shorter will never make a profit, because his left hand loses (not enough high price for shorts) and his right hand wins (bought cheap BitAsset and placed sell order at high price waiting to be bought), the sum will be zero minus fees.

My understanding is that the feeds are introduced to "block" downward movements in BitAssets (apparent BTS price increases).
The current feed design doesn't "block" upward movements in BitAssets, which is considered unnecessary by the devs.

As for the shorter's price and interest rate argument, I want to confirm that the first preference is the price (the lower, the higher priority) and if the price being equal, the system compares the interest rate (the highter, the more priority), is that correct? Thanks.
Title: Re: EMERGENCY : the market is broken
Post by: sudo on March 22, 2015, 07:02:40 am
I remember having seen some people that were upset that they had to pay the 10% increase when their shorts ended, maybe just last week or 2 weeks ago. Maybe, hopefully, it changed in 0.7.
Obviously, stolen funds is way worse (I didn't know there was such a bug). But losing money because of some coding error that is not taken seriously is also quite infuriating, and all shorters are at risk.

We are taking the problem very seriously. It takes some time to develop a patch for the live market. We need to be careful that we do not introduce other bad issues, which has happened in the past with emergency fixes. We will have it fixed as soon as we can.

 +5% test in dev chains completely
Title: Re: EMERGENCY : the market is broken
Post by: Markus on March 22, 2015, 07:34:17 am
What's the "10%" is people are referring to? I thought in the current system expiring shorts sit at the price feed if there are no lower asks (i.e. no penalty), and that called shorts can buy as high as 110% (i.e. a 10% penalty)- is that incorrect? Sorry if my understanding is wrong, I've just not seen these confirmed.

This is another market bug that was introduced (in 6.2 I believe): not only the called shorts but also the expired ones will buy as high as 110%. How you describe it is how it should work and how it used to.
Title: Re: EMERGENCY : the market is broken
Post by: pc on March 22, 2015, 08:32:39 am
What's the "10%" is people are referring to? I thought in the current system expiring shorts sit at the price feed if there are no lower asks (i.e. no penalty), and that called shorts can buy as high as 110% (i.e. a 10% penalty)- is that incorrect? Sorry if my understanding is wrong, I've just not seen these confirmed.

This is another market bug that was introduced (in 6.2 I believe): not only the called shorts but also the expired ones will buy as high as 110%. How you describe it is how it should work and how it used to.

It's been like that since 0.4.19 at least. I think that will change with the new market engine.


As for the shorter's price and interest rate argument, I want to confirm that the first preference is the price (the lower, the higher priority) and if the price being equal, the system compares the interest rate (the highter, the more priority), is that correct? Thanks.

No. The interest rate is compared first, the short with the highest interest rate always wins. This has also been like that for ages.
The new market engine will prefer the higher interest rate only for shorts at the feed price, and order the others by their price limit.
Title: Re: EMERGENCY : the market is broken
Post by: milkmeat on March 23, 2015, 03:22:03 am
Is this issue fixed yet?
Title: Re: EMERGENCY : the market is broken
Post by: lastagile on March 23, 2015, 04:56:26 am
stupid stupid.
Title: Re: EMERGENCY : the market is broken
Post by: Markus on March 23, 2015, 05:39:20 am
Nothing's been fixed yet. Another 5% drop in BTS price (at the current pace in about one hour) and we'll see masses of short positions called with the asset market totally dried up and shorting still impossible. 30% more and undercollateralisation looms.

Perfect time for the dumping whales to give Bitshares the coup de grace.

Probably all just a planned resilience test.
Title: Re: EMERGENCY : the market is broken
Post by: Ander on March 23, 2015, 06:29:15 am
Nothing's been fixed yet. Another 5% drop in BTS price (at the current pace in about one hour) and we'll see masses of short positions called with the asset market totally dried up and shorting still impossible. 30% more and undercollateralisation looms.

Perfect time for the dumping whales to give Bitshares the coup de grace.

Probably all just a planned resilience test.

Whales with bitAssets are intentionally trying to break it while the bug is still there, so they can ruin the shorts and take their BTS away for cheap.
Title: Re: EMERGENCY : the market is broken
Post by: starspirit on March 24, 2015, 11:41:12 pm
I still wonder whether shorts need to compete on interest, except at the feed price. It could be simpler to treat all offers above the price feed as 0% interest, assuming all shorts are rational.

If there are no orders at the feed price, this implies that nobody is willing to short at the feed price even at 0% interest. So the rational thing for short orders at higher prices to do would be to also offer just 0%. Otherwise this is an additional and unnecessary cost to offer to the longs. So let's say the first order in the short queue sits above the feed price at 0% interest. If another short wants to get set more urgently, then instead of offering 0% + a bit at the same price, they can simply come in at same price less a bit, with 0% interest. At the feed price this is no longer possible, so interest sets the priority.

Now in theory there might be a subtle difference in outcome to the shorts, because price is an immediate cost, whereas interest is a cost borne over time that depends on the holding period. Maybe this wouldn't make much difference in practice if shorts can simply take their holding period into account when they compete on price. Open to thoughts on this.
 
Practically, this would mean that only when a short is at the price feed, does its interest offer get taken into account, and above the price feed it is always treated as zero.




Title: Re: EMERGENCY : the market is broken
Post by: Chronos on March 25, 2015, 12:33:08 am
I actually liked the short-lived idea of allowing only self-shorting, which instantly matched every new short against the issuer, so that they could then sell the created BitAsset on the market. This removed the shorts from the order book, making the whole trading experience much more approachable for newcomers. It also removed the interest rate on shorts, which has been shown to be a gimmick because equilibrium rate is 0% (via the existing ability to self-short and take an unbounded portion of it for yourself at any time).

Besides being a big change, was there a major downside to this approach?

With v0.8 out now, the sensationalist subject line should probably be changed.  :P
Title: Re: EMERGENCY : the market is broken
Post by: arhag on March 25, 2015, 12:44:01 am
This removed the shorts from the order book, making the whole trading experience much more approachable for newcomers.

Have you seen versions of the interface (https://bitsharestalk.org/index.php?topic=14974.msg194953#msg194953) with combined buy and sell tables?

The idea is that by default the trader doesn't need to care whether a BitAsset sell order is an actual sell order order (represented in that interface with red prices) or a short sell order (represented in that interface with blue prices). It seems like a normal market. Then they can look at the detailed short order table and the table of margin calls if they want.

It also removed the interest rate on shorts, which has been shown to be a gimmick because equilibrium rate is 0% (via the existing ability to self-short and take an unbounded portion of it for yourself at any time).

I think it is unfair to say the interest rate is a gimmick when only looking at market behavior during a bear market. Sure, in a bear market, shorts aren't going to offer interest, why should they? The interest mechanism is in place to prioritize shorts in a bull market.

Besides being a big change, was there a major downside to this approach?

The main downside of the approach is that it gets rids of the guarantee that BitAsset sell orders that are kept under the price feed will be matched in at most 30 days. If someone is allowed to self-short regardless of the state of the market, they can rollover their shorts indefinitely and never be forced to buy the BitAsset sells in the market. A way to resolve this is to prevent self-shorting when there is any BitAsset sells under the price feed, but in my opinion this is a less elegant solution than the system we already have.
Title: Re: EMERGENCY : the market is broken
Post by: arhag on March 25, 2015, 12:56:36 am
I still wonder whether shorts need to compete on interest, except at the feed price. It could be simpler to treat all offers above the price feed as 0% interest, assuming all shorts are rational.

Honestly, I was hoping that the market engine would be designed such that it would already be like how you describe. It just makes sense. I wonder what the devs think about that tweak to the market engine.