-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests: Add is_code_cached and use in tests to verify #607
Conversation
…-head-of-abieos [3.2] mandel: rebase abieos to the head of abieos submodule (fixing compile warnings)
@@ -63,6 +63,9 @@ namespace eosio { namespace chain { | |||
//Immediately exits currently running wasm. UB is called when no wasm running | |||
void exit(); | |||
|
|||
//Returns true if the code is cached | |||
size_t is_code_cached(const digest_type& code_hash, const uint8_t& vm_type, const uint8_t& vm_version) const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you meant for the return value to be bool
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thanks. Fixed.
bool base_tester::is_code_cached( eosio::chain::account_name name ) const { | ||
const auto& db = control->db(); | ||
const account_metadata_object* receiver_account = &db.template get<account_metadata_object,by_name>( name ); | ||
if ( receiver_account->code_hash == digest_type() ) return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check receiver_account != nullptr
first? If the account doesn't exist
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get()
throws unknown key if not found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops yeah I was looking at find()
Adds new
is_code_cached
method towasm_interface
for use by tests to check if the code for a given account has been cached.Resolves #260