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

Add protocol feature CODE_VERSION #7835

Closed
wants to merge 5 commits into from

Conversation

conr2d
Copy link
Contributor

@conr2d conr2d commented Aug 31, 2019

Change Description

Fix #6168.

Consensus Changes

  • Consensus Changes

Consensus upgrade.

API Changes

  • API Changes

New intrinsic API get_code_version is introduced by this PR.

Documentation Additions

  • Documentation Additions

The documentation of eosio.cdt needs to include get_code_version.

@@ -987,6 +987,13 @@ class authorization_api : public context_aware_api {
return context.is_account( account );
}

void get_code_version( const account_name& account, int64_t& last_code_update_time, fc::sha256& code_hash ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intrinsics with multiple output parameters have very strange semantics when the pointers alias. I would strongly recommend either using a packed struct or splitting this into two intrinsics.

using namespace eosio;

void code_version_test::reqversion( name name, checksum256 version ) {
check( get_code_version(name) == version, "code version not match" );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message is not grammatically correct.

}

void code_version_test::reqtime( name name, time_point last_code_update ) {
check( get_code_last_update_time(name) == last_code_update, "last update time not match" );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.


#include <eosio/eosio.hpp>

namespace eosio {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better not to put this stuff in namespace eosio, as that causes a headache when cdt is eventually updated.

@conr2d conr2d closed this Sep 16, 2021
@conr2d conr2d deleted the feature/code_version branch September 16, 2021 03:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants