-
Notifications
You must be signed in to change notification settings - Fork 312
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
Support for EIP-1344 CHAINID opcode #375
Conversation
examples/example_host.cpp
Outdated
@@ -129,6 +129,8 @@ class ExampleHost : public evmc::Host | |||
(void)topics; | |||
(void)topics_count; | |||
} | |||
|
|||
evmc_bytes32 get_chain_id() noexcept final { return 0_bytes32; } |
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 this should go into the tx_context
header.
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.
My line of thought was: 1. it's probably not going to be used very often, so why copy it with every get_tx_context
call; 2. it's not "transaction context" conceptually, but rather more global chain constant.
But I don't insist, can change.
e5aa7a2
to
8ae8d7e
Compare
Not sure what happens to |
7051c32
to
1ab538f
Compare
@axic I'm bumping the version here, is that ok? |
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, looks good. Except we need to start 7.0 branch separately.
For reference, we consider always providing tx_context
: #120
Now I believe this is pretty good idea - more in the issue.
@@ -153,6 +153,7 @@ struct evmc_tx_context | |||
int64_t block_timestamp; /**< The block timestamp. */ | |||
int64_t block_gas_limit; /**< The block gas limit. */ | |||
evmc_uint256be block_difficulty; /**< The block difficulty. */ | |||
evmc_uint256be chain_id; /**< The blockchain's ChainID. */ |
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.
This part is contentious. There is a long discussion on https://ethereum-magicians.org/t/eip-1344-add-chain-id-opcode/1131/56
However many say it should be a hash, e.g. bytes32, however the calculation done the transaction format requires it to be a number.
Geth uses 256-bit, Parity 64-bit and Pantheon 32-bit numbers for chain id.
Rebased. |
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.
Please rebase and squash the first 2 commits.
Rebased. |
CHANGELOG.md
Outdated
@@ -5,6 +5,10 @@ Documentation of all notable changes to the **EVMC** project. | |||
The format is based on [Keep a Changelog], | |||
and this project adheres to [Semantic Versioning]. | |||
|
|||
## [7.0.0] - unreleased | |||
- Added: [[#375](https://github.com/ethereum/evmc/pull/375)] |
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.
Please update to new format.
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.
Updated.
@axic Can you check Rust CI? It is failing from some days. |
https://eips.ethereum.org/EIPS/eip-1344