-
Notifications
You must be signed in to change notification settings - Fork 9
EIP-2935 Historical Block Hashes Detailed Guide #671
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
apps/core/content/developers/guides/eip2935-historical-block-hashes.md
Outdated
Show resolved
Hide resolved
@okjintao Thanks for your review! I've gone through and made changes, as well as left a comment for us to sync up on. |
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.
lg
|
||
Before EIP-2935, smart contracts could access only the last 256 block hashes using the `BLOCKHASH` opcode. This process raised challenges though: | ||
|
||
- Accessing a hash outside that window, returned `0x0`, silently, |
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.
- Accessing a hash outside that window, returned `0x0`, silently, | |
- Accessing a hash outside that window returns `0x0` silently |
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.
Change made.
Before EIP-2935, smart contracts could access only the last 256 block hashes using the `BLOCKHASH` opcode. This process raised challenges though: | ||
|
||
- Accessing a hash outside that window, returned `0x0`, silently, | ||
- You couldn’t fetch a blockhash using dynamic inputs (e.g. calldata or computation), |
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.
Remove commas at the end
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.
Change made.
- `eip2935GasComparison.s.sol` - A solidity script used to deploy the `eip2935GasComparison.sol` and make calls to it to simulate different blockhash reading methods. | ||
- `run_gas_comparison.sh` - A bash script created to deploy `eip2935GasComparison.sol` and tabulate the gas expenditure results. | ||
|
||
### Prerequisites |
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.
### Prerequisites | |
### Requirements |
and make it a list with versions of each tool needed vs installs
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.
Changes made.
|
||
Anyone can later call the system contract to retrieve a blockhash from that range. | ||
|
||
## Guide |
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.
Revise for keywords
## Guide | |
## How To Obtain BlockHashes & Store Them |
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.
Done.
|
||
Go through the following steps: | ||
|
||
### Step 1 - Install Deps |
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.
### Step 1 - Install Deps | |
### Step 1 - Install Dependencies |
|
||
```bash | ||
# From apps/eip-2935-gas-comparison | ||
source .env && anvil --fork-url $BEPOLIA_RPC_URL --fork-block-number 4867668 --chain-id 80069 --port 8545 |
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.
Use ```bash-vue to add variables for the bepolia rpc and chain id
|
||
```bash | ||
# From apps/eip-2935-gas-comparison | ||
./script/run_gas-comparison.sh |
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.
./script/run_gas-comparison.sh | |
# FROM: ./ | |
./script/run_gas-comparison.sh; | |
# [Expected Similar Result]: | |
# ... |
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 believe I have seen it written in the way I wrote within other guides. So are we always doing relative path locations like this going forward?
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.
Changes made, and also added in a code snippit of what the terminal output should look like when running the script. I left it so the guide still elaborates on the results later on.
|
||
The bash script, `run_gas_comparison.sh` deploys the `eip2935GasComparison.sol` contract on the locally ran anvil fork of Bepolia. It then goes through the results and tabulates the total gas expenses for each blockhashing method, including storing the blockhash or replicating the usage of an oracle. | ||
|
||
#### Step 6 - Highlevel Review of the Solidity File |
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.
#### Step 6 - Highlevel Review of the Solidity File | |
### Step 6 - Highlevel Review of the Solidity File |
### Step 5 - Understanding What the Script Does | ||
|
||
The bash script, `run_gas_comparison.sh` deploys the `eip2935GasComparison.sol` contract on the locally ran anvil fork of Bepolia. It then goes through the results and tabulates the total gas expenses for each blockhashing method, including storing the blockhash or replicating the usage of an oracle. |
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.
Go over the solidity code here
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 continue to go through the solidity code, and the methods assessed after this small section. Did you want me to rewrite it in a particular way?
Missing link in sidebar or contributions section |
Thanks for the reviews @okjintao @codingwithmanny. Manny, I made a couple of comments on some of your CRs. Please let me know if you would like me to correct anything else / if I misinterpreted your comments. I will make the same changes to the quickstart (if applicable) in the guides repo.. |
Description
Guide for Write EIP 2935 Gas Comparison Guide #121.
Contribution
I have followed the Development Workflow
I have read the CODE OF CONDUCT
I HAVE MADE SURE TO ALLOW MAINTAINERS TO EDIT THIS PULL REQUEST