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

Shanghai Update #906

Merged
merged 12 commits into from
Jul 3, 2024
Merged

Shanghai Update #906

merged 12 commits into from
Jul 3, 2024

Conversation

pldespaigne
Copy link
Contributor

@pldespaigne pldespaigne commented Apr 30, 2024

Update the Yellow Paper from the Paris hard-fork to the Shanghai hard-fork.

  • EIP-3651: Warm COINBASE
  • EIP-3855: PUSH0 instruction
  • EIP-3860: Limit and meter initcode
  • EIP-4895: Beacon chain push withdrawals as operations
  • EIP-6049: Deprecate SELFDESTRUCT
  • General Updates

Here is the current pdf version of the Yellow Paper for this PR.

EIP-3651: Warm COINBASE

View Screenshot Diff
Before After
3651_before 3651_after

EIP-3855: PUSH0 instruction

View Screenshot Diff
Before After
3855_0_before 3855_0_after
3855_1_before 3855_1_after

EIP-3860: Limit and meter initcode

View Screenshot Diff
Before After
3860_0_before 3860_0_after
3860_1_before 3860_1_after_1
3860_2_before 3860_2_after_1
3860_3_before 3860_3_after_1
3860_4_before 3860_4_after

EIP-4895: Beacon chain push withdrawals as operations

View Screenshot Diff
Before After
4895_11_before 4895_11_after
4895_0_before 4895_0_after4895_0_after_1
4895_1_before 4895_1_after
4895_2_before 4895_2_after
4895_3_before 4895_3_after
4895_4_before 4895_4_after
4895_5_before 4895_5_after
4895_6_before 4895_6_after
4895_7_before 4895_7_after
4895_8_before 4895_8_after
4895_9_before 4895_9_after_1
4895_10_before 4895_10_after

EIP-6049: Deprecate SELFDESTRUCT

View Screenshot Diff
Before After
6049_0_before 6049_0_after_1

General Updates

View Screenshot Diff
Before After
shanghai_0_before shanghai_0_after
shanghai_1_before shanghai_1_after
shanghai_2_before shanghai_2_after
shanghai_3_before shanghai_3_after_1

@pldespaigne pldespaigne marked this pull request as draft April 30, 2024 17:07
@pldespaigne pldespaigne marked this pull request as ready for review April 30, 2024 17:41
@pldespaigne pldespaigne changed the title [WIP] Shanghai Update Shanghai Update Apr 30, 2024
@pldespaigne
Copy link
Contributor Author

Bump @yperbasis @timbeiko
Let me know, if you need more detail on the PR changes, or anything else!

@yperbasis
Copy link
Member

Bump @yperbasis @timbeiko Let me know, if you need more detail on the PR changes, or anything else!

Currently I don't have the capacity to review this PR unfortunately :(

@pldespaigne
Copy link
Contributor Author

@yperbasis
I understand, do you know of anyone that could have a look at this?
Should I try to bring some non-maintainer peoples in the convo to give feedback on my changes?
I've signed a grant agreement with the EF to update the YP to Shanghai & Cancun, that's why I'll try to help you as much as I can to merge this.

@alexprut
Copy link
Contributor

alexprut commented May 10, 2024

@pldespaigne not a maintainer, nor fully up to date with all the protocol changes, contributed (small) changes years ago.

However, the work you are doing is interesting, if it's helpful I can spend a spike next week to review and provide feedback.

@pldespaigne
Copy link
Contributor Author

That would be awesome 🙏
Anyone's feedback would be great!

&&&& is too low to fulfil the value transfer); and otherwise $x=\mathtt{ADDR}(I_{\mathrm{a}}, \boldsymbol{\sigma}[I_{\mathrm{a}}]_{\mathrm{n}}, \zeta, \mathbf{i} )$, the\\
&&&& address of the newly created account (\ref{eq:new-address}). \\
&&&& where $x=0$ if $z = 0$, i.e., the \hyperlink{contract_creation_result}{contract creation process failed},\\
&&&& or $\lVert \mathbf{i} \rVert > 49152$ (initcode is longer than 49152 bytes),\\
Copy link
Contributor

Choose a reason for hiding this comment

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

Observation rather than a proposed change: realised that MAX_CODE_SIZE=24576 and 2*24576=49152 is not defined anywhere in the paper, hence the semantic is lost, if there is a section anywhere in the paper then it could go there.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, EIP defines it as it's own constant, but since the YP used the same formalism on post deploy code check (Section 7), I decided to keep it like this.

image

@alexprut
Copy link
Contributor

Soundness of EIP-3860 changes LGTM.

@pldespaigne
Copy link
Contributor Author

Thanks a lot for your feedbacks @alexprut 🙏

@pldespaigne
Copy link
Contributor Author

@nicksavers @pirapira Any time on your side to have a look at this?
Or maybe you could delegate that to someone?

@alexprut
Copy link
Contributor

Thanks a lot for your feedbacks @alexprut 🙏

More than happy to be helpful, thanks for updating the YP.
@pldespaigne FYI I still need to look at and review commits EIP-4895, EIP-6049 and General Updates, aiming at finishing the review by EOW.

Paper.tex Outdated
@@ -1365,10 +1404,27 @@ \section{Block Finalisation} \label{ch:finalisation}
The process of finalising a block involves two stages:
Copy link
Contributor

Choose a reason for hiding this comment

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

3 stages now

Copy link
Contributor Author

@pldespaigne pldespaigne Jun 14, 2024

Choose a reason for hiding this comment

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

changes in aac8e1c

@@ -1365,10 +1404,27 @@ \section{Block Finalisation} \label{ch:finalisation}
The process of finalising a block involves two stages:

\begin{enumerate}
\item executing withdrawals;
Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding is that validate transactions precede executing withdrawals

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good question! The EIP only states that it should happen after transaction execution but it says nothing about where it should happen during block finalization.
The transaction validation step purpose in the YP is simply meant to set the block header's gas used value ($B_{Hg}$), since withdrawals incur no gas cost, it has no impact if its run before or after withdrawal execution.

Paper.tex Outdated
\item validate transactions;
\item verify state.
\end{enumerate}

\subsection{Executing Withdrawals}
After processing the block's transactions, the withdrawals are executed. A withdrawal is simply an increase of the recipient account's balance of the specified amount. No other balances are decreased, a withdrawal is not a transfer but a creation of funds.
A withdrawal operation cannot fail and has no gas cost. We define the function $P$ as the withdrawal state transition function:
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, not necessarily an issue, function P is already defined in the paper.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! It's actually a big issue here, since $P$ (the parent block function) is used just bellow in the state validation function $\Gamma$, it would be super confusing to call it $P$ as well!

image

I'll update the withdrawal state transition function as $E$ instead, I believe it's not used in the paper.

Copy link
Contributor Author

@pldespaigne pldespaigne Jun 14, 2024

Choose a reason for hiding this comment

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

changes in aac8e1c

Paper.tex Outdated
\linkdest{selfdestruct}{}0xff & {\small SELFDESTRUCT} & 1 & 0 & Halt execution and register account for later deletion. \\
\linkdest{selfdestruct}{}0xff & {\small SELFDESTRUCT} & 1 & 0 & Halt execution and register account for later deletion. Readers should be warned, \\
&&&& since the \textit{Shanghai} update, this opcode has been marked as deprecated. \\
&&&& Its behavior might be subject to change in an upcoming update. \\
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggesting adding that it may be subject "to breaking changes"

Copy link
Contributor Author

@pldespaigne pldespaigne Jun 14, 2024

Choose a reason for hiding this comment

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

changes in 22c2ca5

Paper.tex Outdated
Because the Beacon Chain generate a new slot every 12 seconds, post-\textit{Paris} updates can be scheduled to occur at a specific timestamp.
At the execution layer, the update will then happen in the first produced block after the scheduled timestamp.
For example the \textit{Shanghai} hard fork was scheduled to occur at 2023-04-12 10:27:35 UTC, on Epoch 194,048.
Validators failed to propose a block during the two first slots of this Epoch, but at slot 6,209,538 a validator finally proposed a the block 17,034,870, marking the transition to \textit{Shanghai} on the execution layer.
Copy link
Contributor

Choose a reason for hiding this comment

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

proposed a the block

Copy link
Contributor Author

@pldespaigne pldespaigne Jun 14, 2024

Choose a reason for hiding this comment

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

changes in 878ee5b

@@ -203,6 +203,7 @@ \subsection{Which History?}
$F_{\mathrm{Arrow Glacier}}$ & 13773000 \\
$F_{\mathrm{Gray Glacier}}$ & 15050000 \\
$F_{\mathrm{Paris}}$ & 15537394 \\
$F_{\mathrm{Shanghai}}$ & 17034870 \\
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of scope of this PR, was thinking if going forward there should be another column besides Block Number, e.g. Timestamp or whatever will be the canonical trigger.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good idea imo!

@alexprut
Copy link
Contributor

Left small comments, changes for EIP-4895, EIP-6049 and General Updates LGTM.
Assuming that for Shangai Update there are no other EIPs besides the ones listed in https://ethereum.org/en/history/#shanghai-summary

@pldespaigne
Copy link
Contributor Author

Thanks again for your time @alexprut 🙏
I've made all the requested changes and update the PR description.
I'll now try to bring more eyes on this discussion!

@yperbasis how many approvals would be required for you to be comfortable in merging this PR?

@yperbasis
Copy link
Member

Thanks again for your time @alexprut 🙏 I've made all the requested changes and update the PR description. I'll now try to bring more eyes on this discussion!

@yperbasis how many approvals would be required for you to be comfortable in merging this PR?

Sorry guys, I was on holiday and next week I'll be at a workshop. I'll take a look during the week starting from 24 June.

Copy link
Member

@yperbasis yperbasis left a comment

Choose a reason for hiding this comment

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

Please also update BRANCHES.md & README.md (see how it was done in PR #894 for Paris).

@yperbasis
Copy link
Member

Meanwhile I've created branch paris from the current master.

@pldespaigne
Copy link
Contributor Author

I've rebased the PR with latest changes from master.
I've also updated README.md & BRANCHES.md as requested.

Let me know if I can do anything else!

@yperbasis yperbasis merged commit 8455623 into ethereum:master Jul 3, 2024
1 check passed
@pldespaigne
Copy link
Contributor Author

Thanks a lot for your time @yperbasis!
I'll now start to work on the Cancun update, should I open a single PR for the whole update, or do you prefer to review it eip by eip?

@yperbasis
Copy link
Member

Thanks a lot for your time @yperbasis! I'll now start to work on the Cancun update, should I open a single PR for the whole update, or do you prefer to review it eip by eip?

Thank you! It's easier for me to review eip by eip.

@pldespaigne
Copy link
Contributor Author

Alright, I'll do it eip by eip then!
Also it looks like the merge of this PR didn't triggered a deploy of the new version of the pdf: https://ethereum.github.io/yellowpaper/paper.pdf

@alexprut
Copy link
Contributor

alexprut commented Jul 8, 2024

Alright, I'll do it eip by eip then! Also it looks like the merge of this PR didn't triggered a deploy of the new version of the pdf: https://ethereum.github.io/yellowpaper/paper.pdf

@pldespaigne If helpful, volunteering on providing feedback for the Cancun PRs, just tag me.

@pldespaigne
Copy link
Contributor Author

Thanks a lot 🙏
Will do, for sure!

@yperbasis
Copy link
Member

Alright, I'll do it eip by eip then! Also it looks like the merge of this PR didn't triggered a deploy of the new version of the pdf: https://ethereum.github.io/yellowpaper/paper.pdf

I've re-run the job and https://ethereum.github.io/yellowpaper/paper.pdf seems to be fine now.

fulldecent pushed a commit to fulldecent/yellowpaper that referenced this pull request Dec 31, 2024
* eip-3651

* eip-3855

* eip-3860

* eip-4895

* eip-6049

* shanghai

* eip-3651-alexprut-review

* eip-3860-alexprut-review

* eip-4895-alexprut-review

* eip-6049-alexprut-review

* shanghai-alexprut-review

* update README.md & BRANCHES.md
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.

3 participants