Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1238 from wanderingbort/feature/add-code-to-data-…
Browse files Browse the repository at this point in the history
…access

added proper code accounts to data access info and serials
  • Loading branch information
heifner authored Jan 30, 2018
2 parents 53d3c73 + 3ec982f commit c6ed03f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions libraries/chain/apply_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ void apply_context::exec_one()
ss.sequence = 1;
});
} FC_CAPTURE_AND_RETHROW((scope)(receiver));
data_access.emplace_back(data_access_info{data_access_info::write, scope, 0});
data_access.emplace_back(data_access_info{data_access_info::write, receiver, scope, 0});
} else {
data_access.emplace_back(data_access_info{data_access_info::write, scope, scope_sequence->sequence});
data_access.emplace_back(data_access_info{data_access_info::write, receiver, scope, scope_sequence->sequence});
try {
mutable_controller.get_mutable_database().modify(*scope_sequence, [&](scope_sequence_object& ss) {
ss.sequence += 1;
Expand All @@ -79,9 +79,9 @@ void apply_context::exec_one()
auto key = boost::make_tuple(lock.scope, lock.account);
const auto& scope_sequence = mutable_controller.get_database().find<scope_sequence_object, by_scope_receiver>(key);
if (scope_sequence == nullptr) {
data_access.emplace_back(data_access_info{data_access_info::read, lock.scope, 0});
data_access.emplace_back(data_access_info{data_access_info::read, lock.account, lock.scope, 0});
} else {
data_access.emplace_back(data_access_info{data_access_info::read, lock.scope, scope_sequence->sequence});
data_access.emplace_back(data_access_info{data_access_info::read, lock.account, lock.scope, scope_sequence->sequence});
}
}

Expand Down
4 changes: 2 additions & 2 deletions libraries/chain/chain_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,9 @@ static void record_locks_for_data_access(const vector<action_trace>& action_trac
for (const auto& at: action_traces) {
for (const auto& access: at.data_access) {
if (access.type == data_access_info::read) {
read_locks.emplace_back(shard_lock{at.receiver, access.scope});
read_locks.emplace_back(shard_lock{access.code, access.scope});
} else {
write_locks.emplace_back(shard_lock{at.receiver, access.scope});
write_locks.emplace_back(shard_lock{access.code, access.scope});
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion libraries/chain/include/eosio/chain/transaction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ namespace eosio { namespace chain {
};

access_type type;
account_name code;
scope_name scope;

uint64_t sequence;
};

Expand Down Expand Up @@ -207,7 +209,7 @@ FC_REFLECT_DERIVED( eosio::chain::transaction, (eosio::chain::transaction_header
FC_REFLECT_DERIVED( eosio::chain::signed_transaction, (eosio::chain::transaction), (signatures) )
FC_REFLECT_DERIVED( eosio::chain::deferred_transaction, (eosio::chain::transaction), (sender_id)(sender)(execute_after) )
FC_REFLECT_ENUM( eosio::chain::data_access_info::access_type, (read)(write))
FC_REFLECT( eosio::chain::data_access_info, (type)(scope)(sequence))
FC_REFLECT( eosio::chain::data_access_info, (type)(code)(scope)(sequence))
FC_REFLECT( eosio::chain::action_trace, (receiver)(act)(console)(region_id)(cycle_index)(data_access) )
FC_REFLECT( eosio::chain::transaction_receipt, (status)(id))
FC_REFLECT_ENUM( eosio::chain::transaction_receipt::status_enum, (executed)(soft_fail)(hard_fail))
Expand Down

0 comments on commit c6ed03f

Please sign in to comment.