What is SoftFork 0.22.2? A dive into the code

in Programming4 years ago (edited)

SoftFork 0.22.2 confused me as much as it probably did the rest of you, I slept through the fork and so I was very confused, let's take a look into the code:

/* If the time of the current block is more than the target SoftFork time */

if ( fc::time_point_sec( STEEM_PROTECTION_HARDFORK_TIME ) <= head_block_time() )
   {

Based on the kind of operation, block it if it's from a STEEMIT, Inc owned account and:

      switch( op.which() )
      {

It's a witness vote or proxy

         case operation::tag<account_witness_proxy_operation>::value:
            if ( hardforkprotect::get_steemit_accounts().count( op.get< account_witness_proxy_operation >().account ) )
               FC_THROW_EXCEPTION(transaction_exception, "Error when pushing TX:\nReason: TX has been rejected.");
            break;
         case operation::tag<account_witness_vote_operation>::value:
            if ( hardforkprotect::get_steemit_accounts().count( op.get< account_witness_vote_operation >().account ) )
               FC_THROW_EXCEPTION(transaction_exception, "Error when pushing TX:\nReason: TX has been rejected.");
            break;
         case 

It's a proposal vote

operation::tag<update_proposal_votes_operation>::value:
            if ( hardforkprotect::get_steemit_accounts().count( op.get< update_proposal_votes_operation >().voter ) )
               FC_THROW_EXCEPTION(transaction_exception, "Error when pushing TX:\nReason: TX has been rejected.");
            break;

It's a post vote

         case operation::tag<vote_operation>::value:
            if ( hardforkprotect::get_steemit_accounts().count( op.get< vote_operation >().voter ) )
               FC_THROW_EXCEPTION(transaction_exception, "Error when pushing TX:\nReason: TX has been rejected.");
            break;

It's a powerdown (you can powerdown to other accounts)

         case operation::tag<withdraw_vesting_operation>::value:
            if ( hardforkprotect::get_steemit_accounts().count( op.get< withdraw_vesting_operation >().account ) )
               FC_THROW_EXCEPTION(transaction_exception, "Error when pushing TX:\nReason: TX has been rejected.");
            break;

Trying to set powerdown route (account to powerdown to)

         case operation::tag<set_withdraw_vesting_route_operation>::value:
            if ( hardforkprotect::get_steemit_accounts().count( op.get< set_withdraw_vesting_route_operation >().from_account ) )
               FC_THROW_EXCEPTION(transaction_exception, "Error when pushing TX:\nReason: TX has been rejected.");
            break;

Trying to do a plain-old transfer

         case operation::tag<transfer_operation>::value:
            if ( hardforkprotect::get_steemit_accounts().count( op.get< transfer_operation >().from ) )
               FC_THROW_EXCEPTION(transaction_exception, "Error when pushing TX:\nReason: TX has been rejected.");
            break;

Trying to make a market order

         case operation::tag<limit_order_create_operation>::value:
            if ( hardforkprotect::get_steemit_accounts().count( op.get< limit_order_create_operation >().owner ) )
               FC_THROW_EXCEPTION(transaction_exception, "Error when pushing TX:\nReason: TX has been rejected.");
            break;
         case operation::tag<limit_order_create2_operation>::value:
            if ( hardforkprotect::get_steemit_accounts().count( op.get< limit_order_create2_operation >().owner ) )
               FC_THROW_EXCEPTION(transaction_exception, "Error when pushing TX:\nReason: TX has been rejected.");
            break;

Powering up

         case operation::tag<transfer_to_vesting_operation>::value:
            if ( hardforkprotect::get_steemit_accounts().count( op.get< transfer_to_vesting_operation >().from ) )
               FC_THROW_EXCEPTION(transaction_exception, "Error when pushing TX:\nReason: TX has been rejected.");
            break;

Sending to savings

         case operation::tag<transfer_to_savings_operation>::value:
            if ( hardforkprotect::get_steemit_accounts().count( op.get< transfer_to_savings_operation >().from ) )
               FC_THROW_EXCEPTION(transaction_exception, "Error when pushing TX:\nReason: TX has been rejected.");
            break;

Using inbuilt escrow function of the chain to make a transfer

         case operation::tag<escrow_transfer_operation>::value:
            if ( hardforkprotect::get_steemit_accounts().count( op.get< escrow_transfer_operation >().from ) )
               FC_THROW_EXCEPTION(transaction_exception, "Error when pushing TX:\nReason: TX has been rejected.");
            break;

For any other transaction, allow (so long as all the other requirements are ok)

         default:
            break;
      }
   }

Hope this helps you to understand,
~ @CADawg

Sort:  

$trdo !DERANGED !COFFEEA

Congratulations @contrabot, you successfuly trended the post shared by @cadawg!
@cadawg will receive 0.94174650 TRDO & @contrabot will get 0.62783100 TRDO curation in 3 Days from Post Created Date!

"Call TRDO, Your Comment Worth Something!"

To view or trade TRDO go to steem-engine.com
Join TRDO Discord Channel or Join TRDO Web Site

Thanks for the share, though it still sounds strange for some of us.

Posted via Steemleo

Yeah, that's understandable.

Congratulations @cadawg, your post successfully recieved 0.9417465 TRDO from below listed TRENDO callers:

@contrabot earned : 0.627831 TRDO curation


To view or trade TRDO go to steem-engine.com
Join TRDO Discord Channel or Join TRDO Web Site

Thanks snaks man!

You just received DERANGED @cadawg Keep up the great work. Congrats, you have been gifted 1 DerangedCoin. You can redeem 20 of them for an upvote from the deranged.coin account. Redeem your tokens by sending to deranged.coin through Steem Engine with your post URL in the memo field, view all your tokens at steem-engine.com

Wait, we can power down to other account? How can I do that? What tools can I use?

Also why is power up transaction also get blocked?

  1. SteemWorld -> Outgoing routes in balances tab ( https://steemworld.org/@fsm-liquid )
    image.png

  2. You can power up another account, so they could move funds that way.

  1. Thanks a lot!
  2. But it will be locked up for 13 weeks and visible on the chain though. Wow the witnesses really don't want Steemit to move funds at all.

No problem.

As for 2), think about it:

If steemit's accounts have lots of liquid, all they have to do is:

  1. Power up a new account
  2. Vote for own witnesses running 0.22.1
  3. Restore 0.22.1
  4. All funds unlocked
  5. Do whatever they were going to do anyway

Oh right, that's true. I wasn't thinking that far ahead.

Fair enough. Glad I could clarify. 👍

!BEER
for you

Thanks!

Damn, pretty tight restrictions. Thanks for the nice breakdown! I'm curious though... What actions are left ( besides posting ) are they allowed to do? Just talk & sign messages? I guess send custom json as well, right? ( maybe Justin can still play splinterlands lol )

Yeah, anything that isn't directly transferring value/using SP, i.e. custom_json's are allowed, therefore they can use SE and SplinterLands (if they could transfer money to buy packs... lol)

So this is what robbery looks like in code. #whoknew

#idid lol jk I don't even write c++ but eh I did it, correctly I think?

Glad I could shine a light on it for you!

Coin Marketplace

STEEM 0.28
TRX 0.11
JST 0.034
BTC 66038.71
ETH 3178.89
USDT 1.00
SBD 4.05