Pages:
Author

Topic: Nxt source code analysis (QA) - page 3. (Read 14127 times)

hero member
Activity: 490
Merit: 504
January 05, 2014, 06:06:23 PM
at least we finally know who is that troll panama01 from nextcoin forum
newbie
Activity: 16
Merit: 0
January 05, 2014, 05:48:59 PM
wow this is very interesting.
thanks for sharing,keep updating guys.
legendary
Activity: 868
Merit: 1000
Cryptotalk.org - Get paid for every post!
January 05, 2014, 05:47:35 PM


Why not show off how smart you really are, just post some actual logic errors that lead to people losing money? My guess is that you tried to and couldn't find any, so you decided to make a copy of it and call it NGC.


That indeed is an interesting idea. 

So I wait till every gets fixed and mature.

Then I reboot NXT.

How do you like that plan?

You already said you were going to copy NXT and call it NGC. That is the reason you are here, hoping to find some tidbits that will help your NXT clone.

Not a copy,  a better version.

As it is NXT holders a losing money left and right.  Wallets getting hacked, DGEX not returning coins, negative balances etc.   

 
legendary
Activity: 1176
Merit: 1134
January 05, 2014, 05:39:36 PM


Why not show off how smart you really are, just post some actual logic errors that lead to people losing money? My guess is that you tried to and couldn't find any, so you decided to make a copy of it and call it NGC.


That indeed is an interesting idea. 

So I wait till every gets fixed and mature.

Then I reboot NXT.

How do you like that plan?

You already said you were going to copy NXT and call it NGC. That is the reason you are here, hoping to find some tidbits that will help your NXT clone.

Good luck with rebooting NXT as when everything is fixed and mature it will have LTC marketcap, while your new coin will have you and your followers.

If you are not going to contribute when you can, then lurk, steal and clone NXT. Whatever. I was hoping you had some pride in your skills. I guess if you don't have skills you can't have pride in them.

Good luck with your plan, if you are going to post, please try to post an actual bug however trivial. Please show some respect to those of us who are trying to improve NXT. I somehow get the feeling that you are able to, but choose not to as you view NXT as competition to your own clone. Why not join the original instead of trying to clone?

James
sr. member
Activity: 602
Merit: 268
Internet of Value
January 05, 2014, 05:35:32 PM


Why not show off how smart you really are, just post some actual logic errors that lead to people losing money? My guess is that you tried to and couldn't find any, so you decided to make a copy of it and call it NGC.


That indeed is an interesting idea.  

So I wait till every gets fixed and mature.

Then I reboot NXT.

How do you like that plan?

LOL at your naive sense of how to build a successful business. Even if you can replicate even a technically better version of NXT in 6 months, the best you can do is to create something akin to Quark or Doge compared to Bitcoin. Even that would be unlikely with current situation. Every decent coder could replicate Twitter in a week still Twitter is worth billion of $ with none of competitor in that space.
In 6 months, I couldn't care less that NXT's codes are 100 percent open. Imitation is the best praise someone said.
sr. member
Activity: 392
Merit: 250
January 05, 2014, 05:27:31 PM
FWIW, it's kind of annoying to be reviewing outdated code while the developers are working on a much newer copy. I understand why an older snapshot has been released, but it is still annoying to keep finding things that have already been fixed :/. But, I guess it's good that the working code is in a better state than the released code.
Thanks for your reviews, it could be that you find things I haven't thought of yet. In fact you did in a previous post, now I have added extra checks for Transaction.amount and Transaction.fee in a place where it could overflow. The code is not that outdated actually, it is as of Dec 25 when I first got access to it and we were running it until about Jan 01.
sr. member
Activity: 392
Merit: 250
January 05, 2014, 05:20:15 PM
If you need to ensure they are always consistent, you need to lock around all the reads and writes.
I know, I have done that. All direct reads of Account.balance are replaced with getBalance() which is synchronized. Account.balance is now private (doesn't make a difference now when in the same class, but it will be moved out of Nxt.java one day).
legendary
Activity: 868
Merit: 1000
Cryptotalk.org - Get paid for every post!
January 05, 2014, 05:11:58 PM


Why not show off how smart you really are, just post some actual logic errors that lead to people losing money? My guess is that you tried to and couldn't find any, so you decided to make a copy of it and call it NGC.


That indeed is an interesting idea. 

So I wait till every gets fixed and mature.

Then I reboot NXT.

How do you like that plan?
legendary
Activity: 2142
Merit: 1010
Newbie
January 05, 2014, 05:09:13 PM
Code:
						if (accumulatedAmount + amount <= accounts.get(sender).balance && transaction.validateAttachment()) {

accumulatedAmounts.put(sender, accumulatedAmount + amount);

newTransactions.put(transaction.getId(), transaction);
payloadLength += transactionLength;

}

Outcome of this code is validated by the peers. Usage of synchronized here would be an overkill in a system with eventual consistency...
sr. member
Activity: 299
Merit: 250
January 05, 2014, 05:06:26 PM
FWIW, it's kind of annoying to be reviewing outdated code while the developers are working on a much newer copy. I understand why an older snapshot has been released, but it is still annoying to keep finding things that have already been fixed :/. But, I guess it's good that the working code is in a better state than the released code.
sr. member
Activity: 299
Merit: 250
January 05, 2014, 05:02:57 PM
All of those synchronized(this) can be replaced with AtomicInteger.addAndGet
How about this:
Code:
            synchronized (this) {
                this.balance += amount;
                this.unconfirmedBalance += amount;
            }
Each of them being Atomic by itself will not ensure balance and unconfirmedBalance are both updated atomically, a thread could still see balance incremented but unconfirmedBalance not yet updated.


It depends. You're correct that a thread could see balance updated and unconfirmedBalance not updated. But, that exists in the code that was released since there are places where balance and unconfirmedBalance are read outside of locks on the account, e.g.:

Code:
						if (accumulatedAmount + amount <= accounts.get(sender).balance && transaction.validateAttachment()) {

accumulatedAmounts.put(sender, accumulatedAmount + amount);

newTransactions.put(transaction.getId(), transaction);
payloadLength += transactionLength;

}

If you need to ensure they are always consistent, you need to lock around all the reads and writes.
sr. member
Activity: 299
Merit: 250
January 05, 2014, 04:55:19 PM
All of those synchronized(this) can be replaced with AtomicInteger.addAndGet

There was a lot of code that looked like:

synchronized (account) {
   1. Check balance
   2. Do something
   3. Adjust balance
}

Is it safe to get rid of synchronized in the quoted code?

I was specifically referring to code like this:

Code:
synchronized (this) {
    this.balance += amount;
}

If you just need to check the balance and conditionally update it, you can use compareAndSet.

For anything more complicated, you're better off sticking with synchronized.
legendary
Activity: 1176
Merit: 1134
January 05, 2014, 04:54:58 PM
For the people who don't code, this is essentially, "if you see some kind of error, just ignore it."

Grin

Actually not. This is a paradigm heavily used in Erlang. If u tried to recover after an exception or even logged it, u would just consume resources without real profit.

No,  it's more like,  if I see some kind of error,  let me keep quiet about it!
Can you explain how that would effect the actual functionality of the system.  Isn't it the same as someone submitting improperly signed transactions so those should be ignored?  You keep bringing up issues with the code but without actual explanations of how those issues are supposed to screw things up.

It's in over 18 places in the code.

Anyway,  it is bad practice because if an unexpected error happens (which it always does), you do want to know that something happened.   To assume that you can ignore this because you think you know what you are doing is just bad practice.

Folks,  I don't need to explain to you guys who to write code properly!



Do you understand what beta release means? NXT just made first beta release with released source code. You are clearly the worlds best java programmer (no offense jean-luc) and due to your fluency in all things java you are able to see logic flaws much clearer than C programmers like me.

Why not show off how smart you really are, just post some actual logic errors that lead to people losing money? My guess is that you tried to and couldn't find any, so you decided to make a copy of it and call it NGC.

Prove me wrong. Prove that you are able to actually find flaws. That is what this thread is about. Notice how in spite of your almost total uselessness to this thread, you haven't been banned. Most people haven't even ignored you based on the hope that you will use your talents to help. If NXT is the sum of all people who contribute to NXT and you contribute too, how is that a ponzi scheme?

Isn't a ponzi scheme something that has no intrinsic value. Are you saying that NXT has no intrinsic value? Are you saying that NXT doesn't work at all? Are you saying that a refactoring can't fix critical problems that you haven't even identified yet?

What exactly are the flaws in NXT logic. Treat it as a whitepaper not a final release by perfect software engineering team staffed by clones of yourself. NXT is in BETA TEST. Not very smart to criticize things that are accepted during beta tests. I thought you were a smart guy, maybe that makes me stupid?

James
sr. member
Activity: 392
Merit: 250
January 05, 2014, 04:52:51 PM
There was a lot of code that looked like:

synchronized (account) {
   1. Check balance
   2. Do something
   3. Adjust balance
}

Is it safe to get rid of synchronized in the quoted code?
It is not, and I haven't.
Code:
			synchronized (account) {

if (account.getUnconfirmedBalance() < amount * 100L) {

doubleSpendingTransaction = true;

} else {

doubleSpendingTransaction = false;

account.addToUnconfirmedBalance(- amount * 100L);

...
sr. member
Activity: 392
Merit: 250
January 05, 2014, 04:50:21 PM
All of those synchronized(this) can be replaced with AtomicInteger.addAndGet
How about this:
Code:
            synchronized (this) {
                this.balance += amount;
                this.unconfirmedBalance += amount;
            }
Each of them being Atomic by itself will not ensure balance and unconfirmedBalance are both updated atomically, a thread could still see balance incremented but unconfirmedBalance not yet updated.
legendary
Activity: 2142
Merit: 1010
Newbie
January 05, 2014, 04:45:52 PM
All of those synchronized(this) can be replaced with AtomicInteger.addAndGet

There was a lot of code that looked like:

synchronized (account) {
   1. Check balance
   2. Do something
   3. Adjust balance
}

Is it safe to get rid of synchronized in the quoted code?
newbie
Activity: 10
Merit: 0
January 05, 2014, 04:43:07 PM
@Frictionless.  I see that you know what you're talking about with regard to programming.  In fact, you may very well be a brilliant programmer, but the problem is, no one cares.  Why?  Because you have taken it upon yourself as a right to criticize but have not contributed anything productive.  You haven't earned that right yet.  In order to earn the right to be heard you should contribute, even in small amount, not with criticism, but with real productive help.  Once you do that then you've earned the right to criticize and others will actually listen to you.  As it stands, people just think you are a jerk, and using Simon Crowell, a known jerk, as an example doesn't help your cause.  Simon Crowell may be rich and be a star power broker, but I believe he has very few "real" deep long lasting friendships, if any.  

You have not gone about this in an effective way.  If you had played this right you would have contributed in a huge way and others would have sung your praises and others would have gladly signed up for your next generation plan.  In fact they would have become your best sales people and you would have had more folks sign up to help with your development and vision.  But as it stands there are only a few willing to help you and your chances of developing a great system are slim to none.



Why would I contribute to what obviously looks like a Ponzi scheme?

You all first explain to me why this entire shenanigan is any different from a Ponzi scheme?


Ponzi scheme or no ponzi scheme, what you're doing here doesn't really help.  If you think you are the defender of the naive who are investing then I would ask "Who appointed you the defender".  I think you know the answer.  If you are against the concept of pre-mining I can understand your opposition.  But do you think we can't figure that out for ourselves whether or not to trust pre-mined concepts or not?  Whether or not this is a risky venture or not?  In fact most people in the financial and investment business would consider all virtual systems scams and ponzi schemes.  In any case it is up to the investors to weigh the risks for themselves.  
legendary
Activity: 2142
Merit: 1010
Newbie
January 05, 2014, 04:41:50 PM
I am afraid CfB and BCNext may get mad at me, but 0.5.0 relies heavily on the Concurrent API...

It's ok. Released source code is the whitepaper written in Java. Now we don't need that rule.
sr. member
Activity: 299
Merit: 250
January 05, 2014, 04:38:36 PM
legendary
Activity: 868
Merit: 1000
Cryptotalk.org - Get paid for every post!
January 05, 2014, 04:32:17 PM
@Frictionless.  I see that you know what you're talking about with regard to programming.  In fact, you may very well be a brilliant programmer, but the problem is, no one cares.  Why?  Because you have taken it upon yourself as a right to criticize but have not contributed anything productive.  You haven't earned that right yet.  In order to earn the right to be heard you should contribute, even in small amount, not with criticism, but with real productive help.  Once you do that then you've earned the right to criticize and others will actually listen to you.  As it stands, people just think you are a jerk, and using Simon Crowell, a known jerk, as an example doesn't help your cause.  Simon Crowell may be rich and be a star power broker, but I believe he has very few "real" deep long lasting friendships, if any.  

You have not gone about this in an effective way.  If you had played this right you would have contributed in a huge way and others would have sung your praises and others would have gladly signed up for your next generation plan.  In fact they would have become your best sales people and you would have had more folks sign up to help with your development and vision.  But as it stands there are only a few willing to help you and your chances of developing a great system are slim to none.



Why would I contribute to what obviously looks like a Ponzi scheme?

You all first explain to me why this entire shenanigan is any different from a Ponzi scheme?
Pages:
Jump to: