OmniLayer / spec

Omni Protocol Specification (formerly Mastercoin)
The Unlicense
342 stars 116 forks source link

Enforce signed 64-bit int as max number of tokens #223

Open marv-engine opened 10 years ago

marv-engine commented 10 years ago

As a follow-up to my tests (create SPs with fixed number of indiv and divis tokens greater than max value of signed 64-bit int) that uncovered a bug yesterday afternoon, this issue captures initial skype chat on this topic and documents what has been/needs to be done.

I wrote:

Zathras, Faiz - it occurred to me that we need the same check for max signed 64-bit int when issuing tokens in a crowdsale. The total number of tokens issued can't exceed that same 922337... value.

@zathras-crypto replied:

Hey Marv, in the library mods I just did, I put traps in to force the library to drop a transaction if the int64 value was exceeded on the following: Sell Offer: Amount For Sale, BTC Amount Desired, Min Fee Required Accept: Amount Accepted Simple Send: Amount Create SP - Fixed: Number of Properties Create SP - Variable: Number of Properties Per Unit

@faizkhan00 replied:

i dont know guys, i have to think about these changes i'll try to add them this weekend, they have to be added on the front end, back end, and in the parsers

marv-engine commented 10 years ago

@zathras-crypto @faizkhan00 There's at least one more case right now (others will come with new tx's) - excerpted from the middle of New Property Creation via Crowdsale with Variable number of Tokens .

The client must ensure that the number of tokens credited to the purchaser plus the number of tokens credited to the issuer will not cause the total number of tokens issued in the crowdsale to exceed the maximum number of tokens that can be issued. If that condition occurs, the client must reduce the number of tokens for the purchaser and the issuer so they both receive the correct percentages and the number of tokens issued as a result of this purchase equals the number of tokens remaining that can be issued. ...

Please see that paragraph and what follows it for more details.