Skip to content

Instantly share code, notes, and snippets.

@elmato
Created June 29, 2018 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elmato/fdbe1a969efbf8d6ef2913b6c5e4c70d to your computer and use it in GitHub Desktop.
Save elmato/fdbe1a969efbf8d6ef2913b6c5e4c70d to your computer and use it in GitHub Desktop.
1.0.6-rc1-vs-1.0.7
diff /home/matu/tmp/eosio.system-1.0.6-rc1/delegate_bandwidth.cpp /home/matu/tmp/eosio.system-1.0.7/delegate_bandwidth.cpp
157,159c157,160
< * While buying ram uses the current market price according to the bancor-algorithm, selling ram only
< * refunds the purchase price to the account. In this way there is no profit to be made through buying
< * and selling ram.
---
> * The system contract now buys and sells RAM allocations at prevailing market prices.
> * This may result in traders buying RAM today in anticipation of potential shortages
> * tomorrow. Overall this will result in the market balancing the supply and demand
> * for RAM over time.
176a178,179
> eosio_assert( tokens_out.amount > 1, "token amount received from selling ram is too low" );
>
190c193,196
< auto fee = tokens_out.amount / 200;
---
>
> auto fee = ( tokens_out.amount + 199 ) / 200; /// .5% fee (round up)
> // since tokens_out.amount was asserted to be at least 2 earlier, fee.amount < tokens_out.amount
>
209a216,218
> eosio_assert( std::abs( (stake_net_delta + stake_cpu_delta).amount )
> >= std::max( std::abs( stake_net_delta.amount ), std::abs( stake_cpu_delta.amount ) ),
> "net and cpu deltas cannot be opposite signs" );
276,277c285,294
< if ( req != refunds_tbl.end() ) { //need to update refund
< refunds_tbl.modify( req, 0, [&]( refund_request& r ) {
---
>
>
> // net and cpu are same sign by assertions in delegatebw and undelegatebw
> // redundant assertion also at start of changebw to protect against misuse of changebw
> bool is_undelegating = (net_balance.amount + cpu_balance.amount ) < 0;
> bool is_delegating_to_self = (!transfer && from == receiver);
>
> if( is_delegating_to_self || is_undelegating ) {
> if ( req != refunds_tbl.end() ) { //need to update refund
> refunds_tbl.modify( req, 0, [&]( refund_request& r ) {
296,297d312
< eosio_assert( asset(0) <= req->net_amount, "negative net refund amount" ); //should never happen
< eosio_assert( asset(0) <= req->cpu_amount, "negative cpu refund amount" ); //should never happen
299,306c314,325
< if ( req->net_amount == asset(0) && req->cpu_amount == asset(0) ) {
< refunds_tbl.erase( req );
< need_deferred_trx = false;
< } else {
< need_deferred_trx = true;
< }
< } else if ( net_balance < asset(0) || cpu_balance < asset(0) ) { //need to create refund
< refunds_tbl.emplace( from, [&]( refund_request& r ) {
---
> eosio_assert( asset(0) <= req->net_amount, "negative net refund amount" ); //should never happen
> eosio_assert( asset(0) <= req->cpu_amount, "negative cpu refund amount" ); //should never happen
>
> if ( req->net_amount == asset(0) && req->cpu_amount == asset(0) ) {
> refunds_tbl.erase( req );
> need_deferred_trx = false;
> } else {
> need_deferred_trx = true;
> }
>
> } else if ( net_balance < asset(0) || cpu_balance < asset(0) ) { //need to create refund
> refunds_tbl.emplace( from, [&]( refund_request& r ) {
318,319c337,339
< need_deferred_trx = true;
< } // else stake increase requested with no existing row in refunds_tbl -> nothing to do with refunds_tbl
---
> need_deferred_trx = true;
> } // else stake increase requested with no existing row in refunds_tbl -> nothing to do with refunds_tbl
> } /// end if is_delegating_to_self || is_undelegating
369a390
> eosio_assert( !transfer || from != receiver, "cannot use transfer flag if delegating to self" );
diff /home/matu/tmp/eosio.system-1.0.6-rc1/eosio.system.cpp /home/matu/tmp/eosio.system-1.0.7/eosio.system.cpp
99a100,102
> eosio_assert( newname != 0, "the empty name is not a valid account name to bid on" );
> eosio_assert( (newname & 0xFull) == 0, "13 character names are not valid account names to bid on" );
> eosio_assert( (newname & 0x1F0ull) == 0, "accounts with 12 character names and no dots can be created without bidding required" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment