Skip to content

Commit

Permalink
Merge pull request #107 from gxchain/hotfix-1226
Browse files Browse the repository at this point in the history
disable update contract for normal account
  • Loading branch information
albert authored Dec 26, 2018
2 parents 60a5284 + 81df8a9 commit a27c747
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libraries/chain/contract_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ void_result contract_update_evaluator::do_evaluate(const contract_update_operati

const account_object& contract_obj = op.contract(d);
FC_ASSERT(op.owner == contract_obj.registrar, "only owner can update contract, current owner: ${o}", ("o", contract_obj.registrar));
if(d.head_block_time() > HARDFORK_1015_TIME) {
FC_ASSERT(contract_obj.code.size() > 0, "can not update a normal account: ${a}", ("a", op.contract));
}

code_hash = fc::sha256::hash(op.code);
FC_ASSERT(code_hash != contract_obj.code_version, "code not updated");
Expand Down
5 changes: 5 additions & 0 deletions libraries/chain/include/graphene/chain/hardfork.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@
#define HARDFORK_1103_TIME (fc::time_point_sec( 1543507200 ))
#endif

#ifndef HARDFORK_1015_TIME
// disable udpate_contract for normal account
#define HARDFORK_1015_TIME (fc::time_point_sec( 1546084800 )) // for mainnet, 2018-12-29T12:00:00 UTC
#endif

// #413 Add operation to claim asset fees
#ifndef HARDFORK_413_TIME
#define HARDFORK_413_TIME (fc::time_point_sec( 1446652800 ))
Expand Down

0 comments on commit a27c747

Please sign in to comment.