-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Update EIP-4788: post audit tweaks #7672
Conversation
✅ All reviewers have approved. |
EIPS/eip-4788.md
Outdated
"v": "0x1b", | ||
"r": "0x539", | ||
"s": "0x133700f3a77843802897db", | ||
"hash": "0x14789a20c0508b81ab7a0287a12a3a41ca960aa18244af8e98689e37ed569f07" | ||
"s": "0x133700018971c643803096", |
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 the r
and s
values have any particular meaning? I'm more curious as to why they s value had to change. Was it searched to find the first valid signature of any address from "zero" or is there some other meaning?
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.
The s
value is like the "nonce" for our address generator. We keep trying new s
values until we get a deploy address with beac02
prefix.
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.
Got it.
Is there a canonical definition of what a synthetic address is and best practices to grind out and S value?
In this particular case (r being 1337 in decimal, and s being 0x1337 left shifted 72 bytes, and then search upwards from there) it is obvious it should not have a known public key. But I think the industry would benefit from a best practice for showing a transaction is a synthetic address transaction with a know r producing a corresponding s.
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 post is the pinnacle of our knowledge on the subject and it does not give any explicit instructions: https://weka.medium.com/how-to-send-ether-to-11-440-people-187e332566b7
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.
Are you talking about Nothing-up-my-sleeve numbers?
|
Not sure I understand this, but I created my own gist to compare: https://gist.github.com/adietrichs/4f41090c37d292a96b08c8cdbd076d90 For many slot times, |
I talked with @lightclient, and out of that came the idea to maybe go the other way: I updated the gist with a third option of a modulus of |
I have opened the PR: lightclient#7.
This PR changes the modulus to a prime number, so that there can never be any shared factors with the slot time. This way, 100% of the history region will be utilized, allowing for simple reasoning about total storage requirements and the total history depth, even in the case of future slot time changes. The specific value ( |
Update EIP-4788: Move to Prime Modulus
New beacon root address found by @spencer-tb! Thanks! |
Upgrade execution-spec-tests to [v1.0.4](https://github.com/ethereum/execution-spec-tests/releases/tag/v1.0.4). Set BeaconRootsAddress to `0xbEAC020008aFF7331c0A389CB2AAb67597567d7a` in preparation for [dencun-devnet-9](https://notes.ethereum.org/@ethpandaops/dencun-devnet-9) per ethereum/EIPs#7672.
Final beacon root address is |
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.
All Reviewers Have Approved; Performing Automatic Merge...
Set BeaconRootsAddress to `0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02` in preparation for [dencun-devnet-9](https://notes.ethereum.org/@ethpandaops/dencun-devnet-9) per ethereum/EIPs#7672. Hopefully this will be the final change to BeaconRootsAddress. Also update execution-spec-tests to [v1.0.5](https://github.com/ethereum/execution-spec-tests/releases/tag/v1.0.5).
| `SYSTEM_ADDRESS` | `0xfffffffffffffffffffffffffffffffffffffffe` | | ||
| `BEACON_ROOTS_ADDRESS` | `0xbEac00dDB15f3B6d645C48263dC93862413A222D` | | ||
| `BEACON_ROOTS_ADDRESS` | `0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02` | |
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.
Why was the address changed?
jumpi | ||
|
||
push0 | ||
push0 | ||
revert | ||
|
||
jumpdest | ||
push3 0x018000 | ||
push3 0x001fff |
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 should be push2 now.
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.
yeah, this was a miss. However, not worth fixing, the runtime execution gascost is identical, the only difference is that the code is one byte larger than it would have needed to be.
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 repeats 4x so 4 bytes wasted. Forever :)
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.
Yeah. Now there are 32 bits less left in the world.
🚻 ☮️
This change contains the final (?) address for 4788 beacon root contract. The update to the EIP is being tracked here: ethereum/EIPs#7672 --------- Co-authored-by: Martin Holst Swende <martin@swende.se>
This change contains the final (?) address for 4788 beacon root contract. The update to the EIP is being tracked here: ethereum/EIPs#7672 --------- Co-authored-by: Martin Holst Swende <martin@swende.se>
This change contains the final (?) address for 4788 beacon root contract. The update to the EIP is being tracked here: ethereum/EIPs#7672 --------- Co-authored-by: Martin Holst Swende <martin@swende.se>
This change contains the final (?) address for 4788 beacon root contract. The update to the EIP is being tracked here: ethereum/EIPs#7672 --------- Co-authored-by: Martin Holst Swende <martin@swende.se>
repost from lightclient/4788asm#16
We've had a few really nice audits done on this code and things have generally been positive. There are a few pieces of feedback that I think are worth addressing before we settle on the final code though. Here is a list, ordered by priority:
Updateupdated tobuflen
to93600
-- this value will share 500-10001 more remainders if the slot time were to change versus the current modulus, decreasing the overall storage use of the contract (h/t @adietrichs).8191
as the number is prime and there is 100% utilization for all potential slot time values.calldatacopy
a single time, instead of paying for that cost at each load. This require a bit of dup'ing and swap'ing, but still extremely manageable. As a part of this I was also able to delete theget_input
macro (h/t @adietrichs).Footnotes
https://gist.github.com/lightclient/820a0d5c5861ed09c5cae5e384e9779e ↩