Skip to content
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

Rename uint256be to bytes32 #152

Merged
merged 4 commits into from
Sep 7, 2018
Merged

Rename uint256be to bytes32 #152

merged 4 commits into from
Sep 7, 2018

Conversation

chfast
Copy link
Member

@chfast chfast commented Sep 6, 2018

Closes #121

Some things to consider

  • Add alias evmc_hash256 for explicit crypto-hashes.
  • Add alias evmc_bytes32 and evmc_address to avoid struct prefix.

/**
* The alias for evmc_bytes32 to represent a big-endian 256-bit integer.
*/
typedef struct evmc_bytes32 evmc_uint256be;
Copy link
Member

Choose a reason for hiding this comment

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

So I am thinking perhaps we should have struct __evmc_bytes32 {..} and then two typedefs (and the same applies to evmc_address) so that it is consistent requiring (or not) struct in further use cases.

Right now it is weird that one has to use struct evmc_bytes32 a; and evmc_uint256be a;

Copy link
Member

Choose a reason for hiding this comment

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

Also wonder if we do have the shared underlying type, operators applied to them propagate to the two typedefs?

Copy link
Member Author

Choose a reason for hiding this comment

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

These are the same types effectively. Yes, it feels weird to me too.


/**
* The optional value used in new contract address construction.
*
* Ignored unless kind is EVMC_CREATE2.
*/
struct evmc_uint256be create2_salt;
evmc_bytes32 create2_salt;
};


/** The transaction and block data for execution. */
struct evmc_tx_context
Copy link
Member

Choose a reason for hiding this comment

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

Maybe typedef this one, too, to write evmc_tx_context instead od struct evmc_tx_context?

@axic axic merged commit 2fcf75d into master Sep 7, 2018
@axic axic deleted the bytes32 branch September 7, 2018 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename evmc_uint256be to evmc_bytes32 to reflect its content better
3 participants